ubuntu16.04启动过程怎么选择内核版本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu16.04启动过程怎么选择内核版本相关的知识,希望对你有一定的参考价值。
参考技术A 内核版本是没法选择的,你在Load MBR过程中就已经有镜像了,只有说选择镜像的说法,选择好了镜像就是确定了某个内核的版本
你的问题应该是在下面的Load MBR部分(这里就有内核的版本了),还没到Bootload这里。
我的理解,启动的基本理解过程如下,仅供参考:
Post--->Bios--->Load MBR(比如安装多个不同的系统时需要)--->Bootload--->Kernel init--->initrd--->inittab(执行各种初始化脚本,系统变量、网络配置,等等)本回答被提问者采纳 参考技术B 没法选啊,镜像就决定了什么内核。
Ubuntu 指定默认启动内核
版本:Ubuntu 18.04
可以通过开机启动Ubuntu时按 ESC 键来进入GRUB选项,
选择 Advanced options for Ubuntu,然后可以看到所有内核启动菜单,Index从0开始。
或者输入以下命令:
wayde@wayde-desktop:~$ cat /boot/grub/grub.cfg |grep menuentry if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" menuentry_id_option="" export menuentry_id_option menuentry ‘Ubuntu‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-simple-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { submenu ‘Advanced options for Ubuntu‘ $menuentry_id_option ‘gnulinux-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 5.3.0-59-generic‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-5.3.0-59-generic-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 5.3.0-59-generic (recovery mode)‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-5.3.0-59-generic-recovery-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 5.3.0-53-generic‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-5.3.0-53-generic-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 5.3.0-53-generic (recovery mode)‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-5.3.0-53-generic-recovery-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 5.3.0‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-5.3.0-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 5.3.0 (recovery mode)‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-5.3.0-recovery-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 4.19.65-d1‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-4.19.65-d1-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘Ubuntu, with Linux 4.19.65-d1 (recovery mode)‘ --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-4.19.65-d1-recovery-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ { menuentry ‘System setup‘ $menuentry_id_option ‘uefi-firmware‘ {
Index同样从0开始,记住你需要指定内核的Index
修改grub文件,修改后如下:
wayde@wayde-desktop:~$ cat /etc/default/grub # If you change this file, run ‘update-grub‘ afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n ‘Simple configuration‘ GRUB_DEFAULT="1>6" GRUB_TIMEOUT_STYLE=hidden GRUB_TIMEOUT=0 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ignore_loglevel log_buf_len=32M console=tty i915.enable_gvt=1 i915.enable_fbc=0 kvm.ignore_msrs=1 intel_iommu=on,igfx_off drm.debug=0" GRUB_CMDLINE_LINUX="" # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo‘ #GRUB_GFXMODE=640x480 # Uncomment if you don‘t want GRUB to pass "root=UUID=xxx" parameter to Linux #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1"
以上只修改了 GRUB_DEFAULT="1>6" 部分,1代表启动时第一层菜单里的 Advanced options for Ubuntu,6即为指定内核的Index。
注意引号是必须的。
另一种方法是直接填入内核的名称:
GRUB_DEFAULT="Ubuntu, with Linux 4.19.65-d1"
update grub后会有警告提示使用新的名称格式:
root@wayde-desktop:/home/wayde# update-grub Sourcing file `/etc/default/grub‘ Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.3.0-59-generic Found initrd image: /boot/initrd.img-5.3.0-59-generic Found linux image: /boot/vmlinuz-5.3.0-53-generic Found initrd image: /boot/initrd.img-5.3.0-53-generic Found linux image: /boot/vmlinuz-5.3.0 Found initrd image: /boot/initrd.img-5.3.0 Found linux image: /boot/vmlinuz-4.19.65-d1 Found initrd image: /boot/initrd.img-4.19.65-d1 Warning: Please don‘t use old title `Ubuntu, with Linux 4.19.65-d1‘ for GRUB_DEFAULT, use `Advanced options for Ubuntu>Ubuntu, with Linux 4.19.65-d1‘ (for versions before 2.00) or `gnulinux-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8>gnulinux-4.19.65-d1-advanced-a0b77529-08f4-4fbc-b3a8-85bb77db44e8‘ (for 2.00 or later) Adding boot menu entry for EFI firmware configuration done
按照其提示的名字再次进行修改即可。
修改完毕之后:
sudo update-grub
重启即可自动从指定内核启动。
以上是关于ubuntu16.04启动过程怎么选择内核版本的主要内容,如果未能解决你的问题,请参考以下文章
4.8.3内核的Ubuntu16.04服务器应该怎么安装docker