查看已安装的 kernel
$ dpkg -l | grep linux-image ii linux-image-4.15.0-45-generic 4.15.0-45.48~16.04.1 amd64 Signed kernel image generic ii linux-image-4.15.0-88-generic 4.15.0-88.88~16.04.1 amd64 Signed kernel image generic
查看当前使用的 kernel
$ uname -r 4.15.0-88-generic
查看 grub 配置信息
$ vim /boot/grub/grub.cfg
... submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-1aedbe15-d824-41c6-8e0f-37999910dd79' { menuentry 'Ubuntu, with Linux 4.15.0-88-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-88-generic-advanced-1aedbe15-d824-41c6-8e0f-37999910dd79' { ... } menuentry 'Ubuntu, with Linux 4.15.0-88-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-88-generic-init-upstart-1aedbe15-d824-41c6-8e0f-37999910dd79' { ... } menuentry 'Ubuntu, with Linux 4.15.0-88-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-88-generic-recovery-1aedbe15-d824-41c6-8e0f-37999910dd79' { ... } menuentry 'Ubuntu, with Linux 4.15.0-45-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-45-generic-advanced-1aedbe15-d824-41c6-8e0f-37999910dd79' { ... } menuentry 'Ubuntu, with Linux 4.15.0-45-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-45-generic-init-upstart-1aedbe15-d824-41c6-8e0f-37999910dd79' { ... } menuentry 'Ubuntu, with Linux 4.15.0-45-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-45-generic-recovery-1aedbe15-d824-41c6-8e0f-37999910dd79' { ... } }
Ubuntu 默认会使用最新版本 kernel 4.15.0-88-generic,为了将其切换到 4.15.0-45-generic,做如下更改
$ sudo vim /etc/default/grub
原始内容为
... GRUB_DEFAULT=0 ...
改为
GRUB_DEFAULT='Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-45-generic'
更新 grub,并重启机器
$ sudo update-grub $ sudo reboot
再次查看当前使用的 kernel
$ uname -r 4.15.0-45-generic
完。