![Ubuntu 18.04 正在尝试加载错误的 vmlinuz 文件,如何修复?](https://linux22.com/image/940320/Ubuntu%2018.04%20%E6%AD%A3%E5%9C%A8%E5%B0%9D%E8%AF%95%E5%8A%A0%E8%BD%BD%E9%94%99%E8%AF%AF%E7%9A%84%20vmlinuz%20%E6%96%87%E4%BB%B6%EF%BC%8C%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%EF%BC%9F.png)
我有一台配备 2 TB M.2 HD 双启动的机器,装有 Ubuntu 20.04 和 18.04(由于遗留原因仍然需要 18.04,请不要询问详细信息:)。
我刚刚更新到 20.04,现在如果不选择特殊选项,18.04 将无法启动。这是我启动时通常的 grub 屏幕:
如果我选择,Ubuntu 18.04
我会得到这个:
如果我选择在主启动菜单中,Advanced options for Ubutnu 18.04.5 LTS (18.04) (on /dev/nvme0n1p2)
则会得到以下信息:
如果我选择任何非恢复模式选项,一切都会正常启动并运行。
我不明白的是,为什么通常的启动选项会查找以 结尾的内核版本70
?它不再存在了!我怎样才能让它查找其中一个内核版本?
我又做了一些探索,然后我得到了ls
以下内容/boot
:
$ ls -l
total 169176
-rw-r--r-- 1 root root 237757 Apr 16 07:44 config-5.4.0-73-generic
-rw-r--r-- 1 root root 237757 Jul 13 10:52 config-5.4.0-80-generic
-rw-r--r-- 1 root root 237757 Jul 23 05:56 config-5.4.0-81-generic
drwx------ 3 root root 4096 Dec 31 1969 efi
drwxr-xr-x 6 root root 4096 Aug 19 11:17 grub
-rw-r--r-- 1 root root 43261536 Jul 22 09:33 initrd.img-5.4.0-73-generic
-rw-r--r-- 1 root root 43267722 Jul 23 10:31 initrd.img-5.4.0-80-generic
-rw-r--r-- 1 root root 43266831 Aug 17 11:26 initrd.img-5.4.0-81-generic
-rw-r--r-- 1 root root 182704 Jan 28 2016 memtest86+.bin
-rw-r--r-- 1 root root 184380 Jan 28 2016 memtest86+.elf
-rw-r--r-- 1 root root 184840 Jan 28 2016 memtest86+_multiboot.bin
-rw------- 1 root root 4586616 Apr 16 07:44 System.map-5.4.0-73-generic
-rw------- 1 root root 4587397 Jul 13 10:52 System.map-5.4.0-80-generic
-rw------- 1 root root 4587874 Jul 23 05:56 System.map-5.4.0-81-generic
-rw------- 1 root root 9449728 Apr 16 07:44 vmlinuz-5.4.0-73-generic
-rw------- 1 root root 9453824 Jul 13 11:28 vmlinuz-5.4.0-80-generic
-rw------- 1 root root 9457920 Jul 23 05:59 vmlinuz-5.4.0-81-generic
因此,再次以、和vmlinuz
结尾的 存在,但没有grub 似乎正在寻找的 。我还检查了,它也有、和的条目,但没有! grub从哪里获取的?73
80
81
70
/boot/grub/grub.conf
73
80
81
70
70
根据其他一些帖子,我也尝试c
从 grub 主菜单按下来执行终端会话,我发现了以下信息,但我不确定该怎么做,抱歉这张图片有点模糊:
如果可能的话,我不确定如何在这里输入命令来解决这个问题。
我还应该提到的一件事是,在执行高级启动选项以返回 Ubuntu 18.04 后,我尝试了:
sudo apt-get update
sudo apt-get upgrade
和
sudo update-grub
希望这些可以解决问题,但并没有。有什么建议吗?
-- 回复 @heynnema --
以下是我根据您建议的命令所得到的终端输出:
$ sudo update-initramfs -c -k 5.4.0-81-generic
[sudo] password for cdahms:
update-initramfs: Generating /boot/initrd.img-5.4.0-81-generic
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125a-3.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168fp-3.fw for module r8169
重启后结果与之前相同(与通常的 18.04 启动菜单选择相同的错误,仍然适用于高级选项选择)
-- 对@heynnema 的第二次回应 --
fdisk
:
$ sudo fdisk -l
Disk /dev/loop0: 32.3 MiB, 33865728 bytes, 66144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 704 KiB, 720896 bytes, 1408 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 243.9 MiB, 255762432 bytes, 499536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop3: 276 KiB, 282624 bytes, 552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop4: 2.5 MiB, 2621440 bytes, 5120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop5: 32.3 MiB, 33853440 bytes, 66120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop6: 2.4 MiB, 2555904 bytes, 4992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop7: 61.7 MiB, 64729088 bytes, 126424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/nvme0n1: 1.9 TiB, 2048408248320 bytes, 4000797360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 63850E58-ACD2-4B55-B5D5-29E46C830D03
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1050623 1048576 512M EFI System
/dev/nvme0n1p2 1050624 2029461901 2028411278 967.2G Linux filesystem
/dev/nvme0n1p3 2029463552 4000796671 1971333120 940G Linux filesystem
Disk /dev/loop8: 65.1 MiB, 68259840 bytes, 133320 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop9: 548 KiB, 561152 bytes, 1096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop10: 2.5 MiB, 2605056 bytes, 5088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop11: 219 MiB, 229638144 bytes, 448512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop12: 2.2 MiB, 2342912 bytes, 4576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop13: 219 MiB, 229629952 bytes, 448496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop14: 64.8 MiB, 67915776 bytes, 132648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop15: 548 KiB, 561152 bytes, 1096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop16: 55.4 MiB, 58130432 bytes, 113536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop17: 55.5 MiB, 58134528 bytes, 113544 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop18: 61.8 MiB, 64770048 bytes, 126504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
blkid
:
$ sudo blkid
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/nvme0n1: PTUUID="63850e58-acd2-4b55-b5d5-29e46c830d03" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="B97B-4975" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="b1d40bc5-1bc0-490b-92d4-256bad74c673"
/dev/nvme0n1p2: UUID="cdc92bbb-f4d8-4a31-9cbf-5215632adb49" TYPE="ext4" PARTUUID="3079da12-a09d-4a1a-a21a-61af34810c23"
/dev/nvme0n1p3: UUID="93b02138-35e3-4446-a2b9-e16cf6c22786" TYPE="ext4" PARTUUID="51df7e8c-fa57-4275-9348-27902134ee6a"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/loop13: TYPE="squashfs"
/dev/loop14: TYPE="squashfs"
/dev/loop15: TYPE="squashfs"
/dev/loop16: TYPE="squashfs"
/dev/loop17: TYPE="squashfs"
/dev/loop18: TYPE="squashfs"
根据这篇文章的一个答案如何从终端检测我的磁盘是使用 GPT 还是 MBR?我做到了:
$ sudo ls
aws IntelliScan_Haze_Class_005 pycharm
awscliv2.zip IntelliScan_Images_005 rotated_IntelliScan_Images_007
Desktop IntelliScan_Images_006 snap
Documents IntelliScan_Images_007 temp
Downloads minicom.log temp2.txt
Downloads2 Music Templates
Dropbox 'Nala devices' temp.txt
eclipse Nala_PVT3_2mm_lens_haze Videos
examples.desktop Pictures 'Volumetric Dummy Devices.txt'
IntelliScan_Haze_Class_001 Public workspace-apps
IntelliScan_Haze_Class_002 PVT3_haze workspace-prod
IntelliScan_Haze_Class_003 PVT4
IntelliScan_Haze_Class_004 'PVT4 IMEIs.txt'
然后:
$ sudo fdisk -l | grep -B 5 Disklabel
Disk /dev/nvme0n1: 1.9 TiB, 2048408248320 bytes, 4000797360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
看来我正在使用 GPT 格式
-- 对@heynnema 的第三次回应 --
是的,我确实使用了Grub Customizer
,那会把事情搞砸吗?我听说它可以做到这一点,但我以前从未遇到过问题。这是我的ls -al /etc/grub.d
:
$ ls -al /etc/grub.d
total 100
drwxr-xr-x 5 root root 4096 Aug 19 11:00 .
drwxr-xr-x 140 root root 12288 Aug 19 10:32 ..
-rwxr-xr-x 1 root root 10046 Jul 30 2020 00_header
-rwxr-xr-x 1 root root 6258 Jul 20 2020 05_debian_theme
-rwxr-xr-x 1 root root 914 May 23 22:55 10_linux_proxy
-rwxr-xr-x 1 root root 221 May 23 22:55 40_custom_proxy
-rwxr-xr-x 1 root root 914 May 23 22:55 41_linux_proxy
-rwxr-xr-x 1 root root 11298 Jul 30 2020 44_linux_xen
-rwxr-xr-x 1 root root 1992 Jan 28 2016 45_memtest86+
-rwxr-xr-x 1 root root 1539 May 23 22:55 46_os-prober_proxy
-rwxr-xr-x 1 root root 1418 Jul 30 2020 47_uefi-firmware
-rwxr-xr-x 1 root root 285 May 23 22:55 48_custom_proxy
-rwxr-xr-x 1 root root 216 Jul 30 2020 49_custom
drwxr-xr-x 4 root root 4096 May 23 22:55 backup
drwxr-xr-x 2 root root 4096 May 23 22:55 bin
drwxr-xr-x 2 root root 4096 May 23 22:55 proxifiedScripts
-rw-r--r-- 1 root root 483 Jul 30 2020 README
-rw-r--r-- 1 root root 272 May 23 22:55 .script_sources.txt
-- 对@heynnema 的第 4 次回应 --
grep -i 5.4.0-70 /etc/grub.d/*
:
$ grep -i 5.4.0-70 /etc/grub.d/*
/etc/grub.d/10_linux_proxy:-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-73-generic'~408f07b7e0dd8d620374c5b681855861~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-73-generic (recovery mode)'~003de087994ae2af14e29d21bf9905b2~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-72-generic'~c5a297cf454d7588afd791e38e600c79~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-72-generic (recovery mode)'~fdd81b462724bdc5fe27e5506ee615f4~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-70-generic'~6f6c570f06cb15f97ea26de817f5f40a~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-70-generic (recovery mode)'~6b0d22eb9c2641ea1add550c2162c631~}
/etc/grub.d/41_linux_proxy:+'SUBMENU' as 'Advanced options for Ubuntu'{+'Advanced options for Ubuntu'/*, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-73-generic'~408f07b7e0dd8d620374c5b681855861~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-73-generic (recovery mode)'~003de087994ae2af14e29d21bf9905b2~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-72-generic'~c5a297cf454d7588afd791e38e600c79~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-72-generic (recovery mode)'~fdd81b462724bdc5fe27e5506ee615f4~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-70-generic'~6f6c570f06cb15f97ea26de817f5f40a~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-70-generic (recovery mode)'~6b0d22eb9c2641ea1add550c2162c631~}
grep: /etc/grub.d/backup: Is a directory
grep: /etc/grub.d/bin: Is a directory
grep: /etc/grub.d/proxifiedScripts: Is a directory
看来 5.4.0-70 在 grub.d 中!!也许这就是问题所在?
cat /etc/fstab
:
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=cdc92bbb-f4d8-4a31-9cbf-5215632adb49 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=B97B-4975 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
-- 对@heynnema 的第 5 次回复 --
这是我的 Grub Customizer 针对常规 Ubuntu 18.04 菜单项的编辑屏幕:
我不明白为什么这里-73
不是吗-70
?!?!
-- 对@heynnema 的第 6 次回复 --
Grub 定制器主屏幕:
答案1
默认 GRUB 启动正在寻找不存在的内核 vmlinuz-5.4.0-70-generic。
这其他选项启动正确显示内核 -73、-80 和 -81。
GRUB Customizer
用来定制 GRUB 菜单,结果搞砸了。查看GRUB Customizer
菜单,寻找 -70 的自定义条目,或者找到恢复到标准 GRUB 菜单的方法。