当前运行的是 3.11.0-18,但还安装了许多其他更高版本。由于某种原因,grub 未选择更新:
$ uname -r
3.11.0-18-generic
列出内核:
$ sudo /usr/sbin/update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-55-generic
Found initrd image: /boot/initrd.img-3.13.0-55-generic
Found linux image: /boot/vmlinuz-3.13.0-46-generic
Found initrd image: /boot/initrd.img-3.13.0-46-generic
Found linux image: /boot/vmlinuz-3.13.0-43-generic
Found initrd image: /boot/initrd.img-3.13.0-43-generic
Found linux image: /boot/vmlinuz-3.13.0-40-generic
Found initrd image: /boot/initrd.img-3.13.0-40-generic
Found linux image: /boot/vmlinuz-3.13.0-39-generic
Found initrd image: /boot/initrd.img-3.13.0-39-generic
Found linux image: /boot/vmlinuz-3.13.0-35-generic
Found initrd image: /boot/initrd.img-3.13.0-35-generic
Found linux image: /boot/vmlinuz-3.11.0-18-generic
Found initrd image: /boot/initrd.img-3.11.0-18-generic
Found linux image: /boot/vmlinuz-3.13.0-55-generic
Found initrd image: /boot/initrd.img-3.13.0-55-generic
Found linux image: /boot/vmlinuz-3.13.0-46-generic
Found initrd image: /boot/initrd.img-3.13.0-46-generic
Found linux image: /boot/vmlinuz-3.13.0-43-generic
Found initrd image: /boot/initrd.img-3.13.0-43-generic
Found linux image: /boot/vmlinuz-3.13.0-40-generic
Found initrd image: /boot/initrd.img-3.13.0-40-generic
Found linux image: /boot/vmlinuz-3.13.0-39-generic
Found initrd image: /boot/initrd.img-3.13.0-39-generic
Found linux image: /boot/vmlinuz-3.13.0-35-generic
Found initrd image: /boot/initrd.img-3.13.0-35-generic
Found linux image: /boot/vmlinuz-3.11.0-18-generic
Found initrd image: /boot/initrd.img-3.11.0-18-generic
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
我注意到我的 /boot/grub/grub.cfg 实际上确实包含最新的内核,只是不在位置 0。它实际上看起来相当混乱(500 多行),但它是 update-grub 生成的。我该如何修复它?
$ 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="0"
GRUB_RECORDTAIL_TIMEOUT="2"
GRUB_HIDDEN_TIMEOUT="5"
GRUB_HIDDEN_TIMEOUT_QUIET="false"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
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_DISABLE_OS_PROBER="true"
GRUB_CMDLINE_LINUX="reboot=b
“还有我的 grub.d 目录:
$ ll /etc/grub.d/
total 144
drwxr-xr-x 4 root root 4096 Jun 28 02:10 ./
drwxr-xr-x 167 root root 12288 Jun 28 01:40 ../
-rwxr-xr-x 1 root root 9424 Apr 11 2014 00_header*
-rwxr-xr-x 1 root root 6058 Apr 10 2014 05_debian_theme*
-rwxr-xr-x 1 root root 11608 Apr 11 2014 10_linux.dpkg-dist*
-rwxr-xr-x 1 root root 694 Mar 18 2014 10_linux_proxy*
-rwxr-xr-x 1 root root 172 Mar 18 2014 11_custom_proxy*
-rwxr-xr-x 1 root root 694 Mar 18 2014 12_linux_proxy*
-rwxr-xr-x 1 root root 10258 Oct 10 2013 13_linux_xen*
-rwxr-xr-x 1 root root 1798 Jun 17 2013 14_memtest86+*
-rwxr-xr-x 1 root root 11531 Oct 10 2013 15_os-prober*
-rwxr-xr-x 1 root root 1426 Oct 10 2013 16_uefi-firmware*
-rwxr-xr-x 1 root root 172 Mar 18 2014 17_custom_proxy*
-rwxr-xr-x 1 root root 216 Oct 10 2013 18_custom*
-rwxr-xr-x 1 root root 10412 Apr 11 2014 20_linux_xen.dpkg-dist*
-rwxr-xr-x 1 root root 1992 Mar 12 2014 20_memtest86+*
-rwxr-xr-x 1 root root 11692 Apr 11 2014 30_os-prober.dpkg-dist*
-rwxr-xr-x 1 root root 1416 Apr 11 2014 30_uefi-firmware.dpkg-dist*
drwxr-xr-x 2 root root 4096 Mar 18 2014 bin/
drwxr-xr-x 2 root root 4096 Mar 18 2014 proxifiedScripts/
-rw-r--r-- 1 root root 483 Oct 10 2013 README
编辑:好的,现在一切都已修复。原来我的文件乱了/etc/defaults/grub
,里面有奇怪的脚本/etc/grub.d/
。我从 livecd 启动中恢复了这些脚本。
答案1
LTS Trusty 的当前内核:
linux-generic-lts-trusty:
Installed: (none)
Candidate: 3.13.0.55.62
要安装它,请运行:
sudo apt-get update
sudo apt-get install linux-generic-lts-trusty
确保dkms
在某些情况下还需要手动安装视频驱动程序等。要安装它,请运行:sudo apt-get install dkms
在内核安装过程中,它会自动更新 initramfs 和启动配置。安装完成后,重新启动系统,启动后按照本教程从系统中删除旧内核。
如果您仍无法启动到最新内核,则重新启动系统并启动,SHIFT以进入 Grub 并选择最新内核进行启动。启动时运行uname -r
以确保运行的是最新版本,然后运行:
sudo update-initramfs -u -k all
sudo update-grub
或关注飞行员6建议。
答案2
问题是 /etc/grub.d 中出现了一堆奇怪的东西(不知道怎么回事)。我用同一路径的 live CD 的内容恢复了它。我还重新安装了 grub-pcsudo apt-get install --reinstall grub-pc
并让它覆盖当前内容etc/defaults/grub
,这样一切就恢复正常了。别忘了运行sudo update-grub
以重新生成/boot/grub/grub.cfg
。
答案3
您手动配置了/etc/default/grub
。因此才出现此问题。
删除此内容
GRUB_DISABLE_OS_PROBER="true"
GRUB_CMDLINE_LINUX="reboot=b
然后运行
sudo update-grub
它应该被修复。
最后一行是废话。而且 GRUB_DISABLE_OS_PROBER 不允许查找新内核。
该文件中可能还存在其他隐藏错误。这是默认错误。
# 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=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
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=1280x1024x32
GRUB_GFXPAYLOAD_LINUX=keep
# 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"
你可以用这个来替换你的。
我希望您知道如何使用 编辑系统文件sudo
。
这是我的内容/etc/grub.d
00_header 10_linux 20_memtest86+ 30_uefi-firmware 41_custom
05_debian_theme 20_linux_xen 30_os-prober 40_custom README