WeAir

Debian修改默认启动内核

查看当前系统内核

1
2
3
4
5
6
7
8
9
10
11
12
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 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cdd695b0-e558-4915-ba1d-38c769fee1b1' {
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-cdd695b0-e558-4915-ba1d-38c769fee1b1' {
menuentry 'Debian GNU/Linux, with Linux 4.9.0-12-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-12-amd64-advanced-cdd695b0-e558-4915-ba1d-38c769fee1b1' {
menuentry 'Debian GNU/Linux, with Linux 4.9.0-12-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-12-amd64-recovery-cdd695b0-e558-4915-ba1d-38c769fee1b1' {
menuentry 'Debian GNU/Linux, with Linux 4.9.0-11-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-11-amd64-advanced-cdd695b0-e558-4915-ba1d-38c769fee1b1' {
menuentry 'Debian GNU/Linux, with Linux 4.9.0-11-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-11-amd64-recovery-cdd695b0-e558-4915-ba1d-38c769fee1b1' {

###修改grub文件

假设修改启动内核为4.9.0-11,修改文件/etc/default/grub

1
2
3
4
5
sudo vim /etc/default/grub

GRUB_DEFAULT=0
修改为
GRUB_DEFAULT="Advanced options for Debian GNU/Linux>Debian GNU/Linux, with Linux 4.9.0-11-amd64"

其中Advanced options for Debian GNU/Linux是一级菜单,Debian GNU/Linux, with Linux 4.9.0-11-amd64是二级菜单,两者之间用>连接。

更新grub文件

1
sudo update-grub

重启

重启之后使用uname -r可以查看当前的系统内核。