Ubuntu安装内核
1.查看当前os已安装的内核
$sudo dpkg --get-selections |grep linux-image
linux-image-5.10.0-1013-oem install
linux-image-5.11.0-27-generic install
linux-image-5.11.0-41-generic install
linux-image-generic-hwe-20.04 install
linux-image-unsigned-5.10.0-051000-generic install
2.下载指定版本内核,以5.10.0-051000-generic为例。
前往Linux v5.10主线版本deb包地址下载以下四个软件包:
amd64/linux-headers-5.10.0-051000_5.10.0-051000.202012132330_all.deb
amd64/linux-headers-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb
amd64/linux-image-unsigned-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb
amd64/linux-modules-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb
$ ls linux-*
linux-headers-5.10.0-051000_5.10.0-051000.202012132330_all.deb
linux-headers-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb
linux-image-unsigned-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb
linux-modules-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb
3.安装内核软件包
一键安装命令: sudo dpkg -i *.deb
4.重启后,修改引导菜单,指定安装内核版本启动
查看当前已安装系统内核
$ sudo grep menuentry /boot/grub/grub.cfg
[sudo] password for petaio:
if [ x"${feature_menuentry_id}" = xy ]; thenmenuentry_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-5d721445-5194-4623-8959-32c05ce969f7' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.15.0-105-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-105-generic-advanced-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.15.0-105-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-105-generic-recovery-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.10.0-051000-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-051000-generic-advanced-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.10.0-051000-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-051000-generic-recovery-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.10.0-1013-oem' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-1013-oem-advanced-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.10.0-1013-oem (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-1013-oem-recovery-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.4.0-182-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-182-generic-advanced-5d721445-5194-4623-8959-32c05ce969f7' {menuentry 'Ubuntu, with Linux 5.4.0-182-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-182-generic-recovery-5d721445-5194-4623-8959-32c05ce969f7' {
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
根据上图修改引导菜单,/etc/default/grub
GRUB_DEFAULT=0
# GRUB_TIMEOUT_STYLE=hidden >>>>>>>>>>>注释该行 显示grub菜单
GRUB_TIMEOUT=20 >>>>>>>>>>>设置菜单超时时长
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
修改GRUB_DEFAULT的值为"1>2"
5.更新grup后,重启生效
sudo update-grub ;reboot
重启后可确认,指定内核已生效。