如何停止启动旧内核版本?

如何停止启动旧内核版本?

我的 Ubuntu 系统总是启动到旧内核版本。我想我之前曾摆弄过它,但不知道怎样才能让它恢复到安装的最新版本。

当我启动时,它总是显示 grub2 菜单,当我进入高级菜单时,我在列表顶部看到内核版本 53,下面是以下旧版本:52、51、50、49 和 48。我无法选择比 53 更新的任何版本。

这是一个带有/etc/default/grub和 的pastebin /boot/grub/grub.cfghttp://paste.ubuntu.com/13245586/

以下是更多信息:

$ cat /proc/version
Linux version 3.13.0-53-generic (buildd@phianna) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015
$
$ ls -la /boot/
total 359516
drwxrwxr-x  3 root root     4096 Nov  5 22:09 .
drwxr-xr-x 28 root root     4096 Nov 11 23:22 ..
-rw-r--r--  1 root root  1164723 Mar 24  2015 abi-3.13.0-49-generic
-rw-r--r--  1 root root  1164671 May 20 04:11 abi-3.13.0-53-generic
-rw-r--r--  1 root root  1164806 May 26 13:11 abi-3.13.0-54-generic
-rw-r--r--  1 root root  1164806 Jun 17 18:03 abi-3.13.0-55-generic
-rw-r--r--  1 root root  1164984 Jun 19 03:04 abi-3.13.0-57-generic
-rw-r--r--  1 root root  1165129 Jul  7 20:53 abi-3.13.0-58-generic
-rw-r--r--  1 root root  1165129 Jul 29 05:35 abi-3.13.0-61-generic
-rw-r--r--  1 root root  1165261 Aug 11 09:15 abi-3.13.0-62-generic
-rw-r--r--  1 root root  1165204 Aug 14 16:07 abi-3.13.0-63-generic
-rw-r--r--  1 root root  1165204 Oct  2 16:53 abi-3.13.0-65-generic
-rw-r--r--  1 root root  1165260 Oct  7 09:34 abi-3.13.0-66-generic
-rw-r--r--  1 root root  1165260 Oct 23 07:39 abi-3.13.0-67-generic
-rw-r--r--  1 root root   165773 Mar 24  2015 config-3.13.0-49-generic
-rw-r--r--  1 root root   165762 May 20 04:11 config-3.13.0-53-generic
-rw-r--r--  1 root root   165762 May 26 13:11 config-3.13.0-54-generic
-rw-r--r--  1 root root   165762 Jun 17 18:03 config-3.13.0-55-generic
-rw-r--r--  1 root root   165762 Jun 19 03:04 config-3.13.0-57-generic
-rw-r--r--  1 root root   165762 Jul  7 20:53 config-3.13.0-58-generic
-rw-r--r--  1 root root   165763 Jul 29 05:35 config-3.13.0-61-generic
-rw-r--r--  1 root root   165763 Aug 11 09:15 config-3.13.0-62-generic
-rw-r--r--  1 root root   165763 Aug 14 16:07 config-3.13.0-63-generic
-rw-r--r--  1 root root   165763 Oct  2 16:53 config-3.13.0-65-generic
-rw-r--r--  1 root root   165763 Oct  7 09:34 config-3.13.0-66-generic
-rw-r--r--  1 root root   165763 Oct 23 07:39 config-3.13.0-67-generic
drwxr-xr-x  2 root root     4096 Nov  5 22:10 grub
-rw-r--r--  1 root root 20007897 Apr  8  2015 initrd.img-3.13.0-49-generic
-rw-r--r--  1 root root 20128409 Jun  2 23:04 initrd.img-3.13.0-53-generic
-rw-r--r--  1 root root 20128375 Jun 13 14:56 initrd.img-3.13.0-54-generic
-rw-r--r--  1 root root 20129960 Jun 23 21:40 initrd.img-3.13.0-55-generic
-rw-r--r--  1 root root 20130591 Jul  8 22:21 initrd.img-3.13.0-57-generic
-rw-r--r--  1 root root 20132619 Jul 24 22:45 initrd.img-3.13.0-58-generic
-rw-r--r--  1 root root 20131894 Aug 12 22:36 initrd.img-3.13.0-61-generic
-rw-r--r--  1 root root 20134255 Aug 19 22:39 initrd.img-3.13.0-62-generic
-rw-r--r--  1 root root 20133923 Sep 26 21:50 initrd.img-3.13.0-63-generic
-rw-r--r--  1 root root 20133650 Oct 15 22:19 initrd.img-3.13.0-65-generic
-rw-r--r--  1 root root 20136415 Oct 23 19:05 initrd.img-3.13.0-66-generic
-rw-r--r--  1 root root 20133100 Nov  5 22:09 initrd.img-3.13.0-67-generic
-rw-------  1 root root  3389437 Mar 24  2015 System.map-3.13.0-49-generic
-rw-------  1 root root  3390132 May 20 04:11 System.map-3.13.0-53-generic
-rw-------  1 root root  3390881 May 26 13:11 System.map-3.13.0-54-generic
-rw-------  1 root root  3390881 Jun 17 18:03 System.map-3.13.0-55-generic
-rw-------  1 root root  3391581 Jun 19 03:04 System.map-3.13.0-57-generic
-rw-------  1 root root  3391763 Jul  7 20:53 System.map-3.13.0-58-generic
-rw-------  1 root root  3391819 Jul 29 05:35 System.map-3.13.0-61-generic
-rw-------  1 root root  3392306 Aug 11 09:15 System.map-3.13.0-62-generic
-rw-------  1 root root  3392068 Aug 14 16:07 System.map-3.13.0-63-generic
-rw-------  1 root root  3392068 Oct  2 16:53 System.map-3.13.0-65-generic
-rw-------  1 root root  3392380 Oct  7 09:34 System.map-3.13.0-66-generic
-rw-------  1 root root  3392383 Oct 23 07:39 System.map-3.13.0-67-generic
-rw-------  1 root root  5815264 Mar 24  2015 vmlinuz-3.13.0-49-generic
-rw-------  1 root root  5821152 May 20 04:11 vmlinuz-3.13.0-53-generic
-rw-------  1 root root  5821664 May 26 13:11 vmlinuz-3.13.0-54-generic
-rw-------  1 root root  5821984 Jun 17 18:03 vmlinuz-3.13.0-55-generic
-rw-------  1 root root  5820800 Jun 19 03:04 vmlinuz-3.13.0-57-generic
-rw-------  1 root root  5823136 Jul  7 20:53 vmlinuz-3.13.0-58-generic
-rw-------  1 root root  5822208 Jul 29 05:35 vmlinuz-3.13.0-61-generic
-rw-------  1 root root  5820896 Aug 11 09:15 vmlinuz-3.13.0-62-generic
-rw-------  1 root root  5821152 Aug 14 16:07 vmlinuz-3.13.0-63-generic
-rw-------  1 root root  5820640 Oct  2 16:53 vmlinuz-3.13.0-65-generic
-rw-------  1 root root  5820544 Oct  7 09:34 vmlinuz-3.13.0-66-generic
-rw-------  1 root root  5822368 Oct 23 07:39 vmlinuz-3.13.0-67-generic
$
$ 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_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=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"
$
$ sudo 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-67-generic
Found initrd image: /boot/initrd.img-3.13.0-67-generic
Found linux image: /boot/vmlinuz-3.13.0-66-generic
Found initrd image: /boot/initrd.img-3.13.0-66-generic
Found linux image: /boot/vmlinuz-3.13.0-65-generic
Found initrd image: /boot/initrd.img-3.13.0-65-generic
Found linux image: /boot/vmlinuz-3.13.0-63-generic
Found initrd image: /boot/initrd.img-3.13.0-63-generic
Found linux image: /boot/vmlinuz-3.13.0-62-generic
Found initrd image: /boot/initrd.img-3.13.0-62-generic
Found linux image: /boot/vmlinuz-3.13.0-61-generic
Found initrd image: /boot/initrd.img-3.13.0-61-generic
Found linux image: /boot/vmlinuz-3.13.0-58-generic
Found initrd image: /boot/initrd.img-3.13.0-58-generic
Found linux image: /boot/vmlinuz-3.13.0-57-generic
Found initrd image: /boot/initrd.img-3.13.0-57-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-54-generic
Found initrd image: /boot/initrd.img-3.13.0-54-generic
Found linux image: /boot/vmlinuz-3.13.0-53-generic
Found initrd image: /boot/initrd.img-3.13.0-53-generic
Found linux image: /boot/vmlinuz-3.13.0-49-generic
Found initrd image: /boot/initrd.img-3.13.0-49-generic
done

更新:

我发现我的硬盘上还有一个 255mb 的小分区。我挂载了它并对其执行了 ls。看来我安装了两个 grub,正在使用的那个就在这个小分区上。这是正常的吗?我应该怎么做才能解决这个问题?

ls -la /media/jabrams/3241b98f-b24e-4699-8a73-7b29a95bd5cd/
total 150315
drwxr-xr-x  4 root root     3072 May 22 23:03 .
drwxr-x---+ 3 root root     4096 Nov 12 22:33 ..
-rw-r--r--  1 root root  1164723 Mar 12  2015 abi-3.13.0-48-generic
-rw-r--r--  1 root root  1164723 Apr 10  2015 abi-3.13.0-49-generic
-rw-r--r--  1 root root  1164671 Apr 15  2015 abi-3.13.0-51-generic
-rw-r--r--  1 root root  1164671 May  3  2015 abi-3.13.0-52-generic
-rw-r--r--  1 root root  1164671 May 20 04:11 abi-3.13.0-53-generic
-rw-r--r--  1 root root   165773 Mar 12  2015 config-3.13.0-48-generic
-rw-r--r--  1 root root   165773 Apr 10  2015 config-3.13.0-49-generic
-rw-r--r--  1 root root   165762 Apr 15  2015 config-3.13.0-51-generic
-rw-r--r--  1 root root   165762 May  3  2015 config-3.13.0-52-generic
-rw-r--r--  1 root root   165762 May 20 04:11 config-3.13.0-53-generic
drwxr-xr-x  5 root root     1024 May 22 23:03 grub
-rw-r--r--  1 root root 20008474 Mar 23  2015 initrd.img-3.13.0-48-generic
-rw-r--r--  1 root root 20007214 Apr 30  2015 initrd.img-3.13.0-49-generic
-rw-r--r--  1 root root 20005543 May  2  2015 initrd.img-3.13.0-51-generic
-rw-r--r--  1 root root 20007376 May  8  2015 initrd.img-3.13.0-52-generic
-rw-r--r--  1 root root 20005275 May 22 23:03 initrd.img-3.13.0-53-generic
drwx------  2 root root    12288 Apr 19  2014 lost+found
-rw-r--r--  1 root root   176500 Mar 12  2014 memtest86+.bin
-rw-r--r--  1 root root   178176 Mar 12  2014 memtest86+.elf
-rw-r--r--  1 root root   178680 Mar 12  2014 memtest86+_multiboot.bin
-rw-------  1 root root  3389235 Mar 12  2015 System.map-3.13.0-48-generic
-rw-------  1 root root  3389437 Apr 10  2015 System.map-3.13.0-49-generic
-rw-------  1 root root  3389875 Apr 15  2015 System.map-3.13.0-51-generic
-rw-------  1 root root  3389875 May  3  2015 System.map-3.13.0-52-generic
-rw-------  1 root root  3390132 May 20 04:11 System.map-3.13.0-53-generic
-rw-------  1 root root  5815680 Mar 12  2015 vmlinuz-3.13.0-48-generic
-rw-------  1 root root  5815392 Apr 10  2015 vmlinuz-3.13.0-49-generic
-rw-------  1 root root  5818368 Apr 15  2015 vmlinuz-3.13.0-51-generic
-rw-------  1 root root  5818592 May  3  2015 vmlinuz-3.13.0-52-generic
-rw-------  1 root root  5821152 May 20 04:11 vmlinuz-3.13.0-53-generic

答案1

我修复了它。问题是我的 grub2 引导加载程序位于操作系统启动时实际上未安装的分区上。因此 grub2 认为最新内核不可用。修复方法是取消注释我的 /etc/fstab 文件中的一行,以便在操作启动期间将引导加载程序分区安装在 /boot 上,然后删除主操作系统分区上的 /boot 目录。完成此操作后,我还重新安装了 grub2。我不知道为什么我的 /etc/fstab 文件会弄乱,我猜一定是我在某个时候弄乱了它,或者使用了弄乱它的工具。

答案2

运行:sudo update-grub可能会解决问题,它应该按版本顺序重新排列内核条目。

相关内容