Ubuntu更换内核

  • 查看当前内核

uname -r

  • 安装所需内核

sudo apt install linux-image-extra-3.13.0-29-generic

  • 更新grub启动项

sudo vim /etc/default/grub,把GRUB_DEFAULT=0改成:

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-29-generic"

以上字符串值为我的Ubuntu 14.04上的真实菜单项,表示默认启动项为“Advanced options for Ubuntu”菜单项下的子菜单“Ubuntu, with Linux 3.13.0-29-generic”。你根据自己的内核版本,作相应修改基本上就Ok了。

保存对/etc/default/grub作出的修改,再执行:sudo update-grub
如果没有错误提示,那就可以安心重启了:sudo reboot,之后可以确认运行的是否是目的版本的内核。
如果有错误提示,说明上面的启动菜单项字符串给错了。你可以这样进行排查:

确定一级菜单:

grep submenu /boot/grub/grub.cfg

输出形如:

submenu ‘Advanced options for Ubuntu‘ $menuentry_id_option ‘gnulinux-advanced-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {

于是可以确认第一级菜单为:Advanced options for Ubuntu

确定二级菜单:

grep 'menuentry ' /boot/grub/grub.cfg

输出形如:

menuentry ‘Ubuntu‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-simple-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Ubuntu, with Linux 3.13.0-101-generic‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.13.0-101-generic-advanced-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Ubuntu, with Linux 3.13.0-101-generic (recovery mode)‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.13.0-101-generic-recovery-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Ubuntu, with Linux 3.13.0-32-generic‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.13.0-32-generic-advanced-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Ubuntu, with Linux 3.13.0-32-generic (recovery mode)‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.13.0-32-generic-recovery-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Ubuntu, with Linux 3.13.0-29-generic‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.13.0-29-generic-advanced-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Ubuntu, with Linux 3.13.0-29-generic (recovery mode)‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.13.0-29-generic-recovery-50aa4fca-e19c-4a89-a3ba-c8b72a03130d’ {
menuentry ‘Memory test (memtest86+)’ {
menuentry ‘Memory test (memtest86+, serial console 115200)’ {

可用的二级菜单项我已经用粗体标黑,从里面找到你需要的内核即可,比如我需要这条:Ubuntu, with Linux 3.13.0-29-generic

两者用>拼接起来作为启动项字符串即可。

  • 确定内核更换成功后,你可以删除不需要的内核
sudo apt purge linux-image-3.13.0-32-generic
sudo apt-get autoremove

Ubuntu更换内核》有1个想法

  1. 在V2EX看到您的回答,能不能写篇 关于 怎么 使用 VPS 下载视频 并保存在WWW根目录下,然后用迅雷取回的 完整教程呢,新手不太懂。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.