在 20.10 上从 Grub 启动 Ubuntu 时出现问题

在 20.10 上从 Grub 启动 Ubuntu 时出现问题

我有一个 Ubuntu 20.10 系统,与 Windows 10 双重启动。它已经运行了大约 8 个月,但今天突然无法从 Grub 启动。从下拉菜单中选择 Ubuntu 后,我的笔记本电脑立即切换到亮着但黑屏的状态,并且一直停留在那里。我的笔记本电脑是联想 Yoga 720 15 英寸。我让它放置的最长时间是 30 分钟,没有关机。我尝试在实时 USB 上使用启动修复,但这并没有解决任何问题。它给了我以下链接:https://paste.ubuntu.com/p/QfkxbrnmNX/

在 Grub 中我可以选择 Ubuntu 的高级选项。如果我选​​择 Ubuntu,使用 Linux 5.8.0-59-generic,屏幕上只会显示两行:

Loading Linux 5.8.0-59-generic ...
Loading initial ramdisk ...

如果我选择 Linux 5.8.0-59-generic(恢复),在高级选项中会出现相同的结果。

只有使用 5.8.0-55-generic 时才能成功启动系统。

有人曾经遇到过这个问题吗?或者有什么解决该问题的建议吗?

任何帮助是极大的赞赏!

更新 #1:我目前正在使用这个解决方法。这意味着我必须在启动时按两次返回键,而不是一次,如何使用旧版本的内核启动?,但看起来我可能遇到了一个错误。

更新 #2:运行建议的注释和输出:

(基础)tyler@tyler-desktop:~$ ls -al /boot

total 204836

drwxr-xr-x  5 root root      4096 Jul 16 20:44 .
drwxr-xr-x 23 root root      4096 Apr 30 16:15 ..
-rw-r--r--  1 root root    248155 Jun  1 02:57 config-5.8.0-55-generic
-rw-r--r--  1 root root    248155 Jun 16 18:11 config-5.8.0-59-generic
drwxr-xr-x  4 root root     16384 Dec 31  1969 efi
drwxr-xr-x  4 root root      4096 Jul 18 14:30 grub
drwxr-xr-x  5 root root      4096 Jan 20 14:02 grub.bak
lrwxrwxrwx  1 root root        27 Jun 22 17:47 initrd.img -> initrd.img-5.8.0-59-generic
-rw-r--r--  1 root root  54119063 Jul  5 19:46 initrd.img-5.8.0-55-generic
-rw-r--r--  1 root root 115559351 Jul 16 20:44 initrd.img-5.8.0-59-generic
lrwxrwxrwx  1 root root        27 Jun 22 17:47 initrd.img.old -> initrd.img-5.8.0-55-generic
-rw-r--r--  1 root root    182704 Aug 18  2020 memtest86+.bin
-rw-r--r--  1 root root    184380 Aug 18  2020 memtest86+.elf
-rw-r--r--  1 root root    184884 Aug 18  2020 memtest86+_multiboot.bin
-rw-------  1 root root   5654214 Jun  1 02:57 System.map-5.8.0-55-generic
-rw-------  1 root root   5654841 Jun 16 18:11 System.map-5.8.0-59-generic
lrwxrwxrwx  1 root root        24 Jun 22 17:47 vmlinuz -> vmlinuz-5.8.0-59-generic
-rw-------  1 root root  13824992 Jun  1 03:01 vmlinuz-5.8.0-55-generic
-rw-------  1 root root  13825888 Jun 16 18:20 vmlinuz-5.8.0-59-generic
lrwxrwxrwx  1 root root        24 Jun 22 17:47 vmlinuz.old -> vmlinuz-5.8.0-55-generic

更新 #3:再次运行建议的输入:

(基础)tyler@tyler-desktop:~$ sudo update-initramfs -c -k 5.8.0-59-generic

[sudo] password for tyler: 
update-initramfs: Generating /boot/initrd.img-5.8.0-59-generic
I: The initramfs will attempt to resume from /dev/nvme0n1p5
I: (UUID=53453367-1200-4da4-85dc-38594b9965a7)
I: Set the RESUME variable to override this.
(base) tyler@tyler-desktop:~$ ls -al /boot
total 204836
drwxr-xr-x  5 root root      4096 Jul 19 18:25 .
drwxr-xr-x 23 root root      4096 Apr 30 16:15 ..
-rw-r--r--  1 root root    248155 Jun  1 02:57 config-5.8.0-55-generic
-rw-r--r--  1 root root    248155 Jun 16 18:11 config-5.8.0-59-generic
drwxr-xr-x  4 root root     16384 Dec 31  1969 efi
drwxr-xr-x  4 root root      4096 Jul 18 14:30 grub
drwxr-xr-x  5 root root      4096 Jan 20 14:02 grub.bak
lrwxrwxrwx  1 root root        27 Jun 22 17:47 initrd.img -> 
initrd.img-5.8.0-59-generic
-rw-r--r--  1 root root  54119063 Jul  5 19:46 initrd.img-5.8.0-55-generic
-rw-r--r--  1 root root 115558409 Jul 19 18:25 initrd.img-5.8.0-59-generic
lrwxrwxrwx  1 root root        27 Jun 22 17:47 initrd.img.old -> 
initrd.img-5.8.0-55-generic
-rw-r--r--  1 root root    182704 Aug 18  2020 memtest86+.bin
-rw-r--r--  1 root root    184380 Aug 18  2020 memtest86+.elf
-rw-r--r--  1 root root    184884 Aug 18  2020 
memtest86+_multiboot.bin
-rw-------  1 root root   5654214 Jun  1 02:57 System.map-5.8.0-55-generic
-rw-------  1 root root   5654841 Jun 16 18:11 System.map-5.8.0-59-generic
lrwxrwxrwx  1 root root        24 Jun 22 17:47 vmlinuz -> vmlinuz-5.8.0-59-generic
-rw-------  1 root root  13824992 Jun  1 03:01 vmlinuz-5.8.0-55-generic
-rw-------  1 root root  13825888 Jun 16 18:20 vmlinuz-5.8.0-59-generic
lrwxrwxrwx  1 root root        24 Jun 22 17:47 vmlinuz.old -> vmlinuz-5.8.0-55-generic

更新 #4

(base) tyler@tyler-desktop:~$ grep -i compress /etc/initramfs-tools/initramfs.conf
 # Amount of RAM to use for RAM-based compressed swap space.
 # COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ] 
COMPRESS=lz4
(base) tyler@tyler-desktop:~$ grep -v "#" /etc/modules

如果第二个输入有预期的输出,则什么都没有。

更新 #5:更多输出:

(base) tyler@tyler-desktop:~$ grep -i resume /etc/default/grub
(base) tyler@tyler-desktop:~$ cat /etc/initramfs-tools/conf.d/resume
cat: /etc/initramfs-tools/conf.d/resume: No such file or directory
(base) tyler@tyler-desktop:~$ grep -i swap /etc/fstab
# swap was on /dev/nvme0n1p5 during installation
UUID=53453367-1200-4da4-85dc-38594b9965a7 none            swap    sw              0       0

更新 #6

(base) tyler@tyler-desktop:~$ cat /etc/initramfs-tools/initramfs.conf
#
# initramfs.conf
# Configuration file for mkinitramfs(8). See initramfs.conf(5).
#
# Note that configuration options from this file can be overridden
# by config files in the /etc/initramfs-tools/conf.d directory.

#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list
#

MODULES=most

#
# BUSYBOX: [ y | n | auto ]
#
# Use busybox shell and utilities.  If set to n, klibc utilities will be used.
# If set to auto (or unset), busybox will be used if installed and klibc will
# be used otherwise.
#

BUSYBOX=auto

#
# COMPCACHE_SIZE: [ "x K" | "x M" | "x G" | "x %" ]
#
# Amount of RAM to use for RAM-based compressed swap space.
#
# An empty value - compcache isn't used, or added to the initramfs at all.
# An integer and K (e.g. 65536 K) - use a number of kilobytes.
# An integer and M (e.g. 256 M) - use a number of megabytes.
# An integer and G (e.g. 1 G) - use a number of gigabytes.
# An integer and % (e.g. 50 %) - use a percentage of the amount of RAM.
#
# You can optionally install the compcache package to configure this setting
# via debconf and have userspace scripts to load and unload compcache.
#

COMPCACHE_SIZE=""

#
# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ]
#

COMPRESS=lz4

#
# NFS Section of the config.
#

#
# DEVICE: ...
#
# Specify a specific network interface, like eth0
# Overridden by optional ip= or BOOTIF= bootarg
#

DEVICE=

#
# NFSROOT: [ auto | HOST:MOUNT ]
#

NFSROOT=auto

#
# RUNSIZE: ...
#
# The size of the /run tmpfs mount point, like 256M or 10%
# Overridden by optional initramfs.runsize= bootarg
#

RUNSIZE=10%

更新#7:可能导致问题的卡住目录

(base) tyler@tyler-desktop:~/Downloads$ rm -r ventoy-1.0.46
rm: cannot remove 'ventoy-1.0.46': Read-only file system
(base) tyler@tyler-desktop:~/Downloads$ rm ventoy-1.0.46-linux.tar.gz 
rm: cannot remove 'ventoy-1.0.46-linux.tar.gz': Read-only file system

答案1

您的 initrd.img-5.8.0-59-generic ramdisk 文件已损坏,这就是您无法启动 -59 内核的原因。

Loading Linux 5.8.0-59-generic ...
Loading initial ramdisk ...

查看 /boot 中以下两个 ramdisk 文件的文件大小和修改日期...

-rw-r--r-- 1 root root  54119063 Jul  5 19:46 initrd.img-5.8.0-55-generic
-rw-r--r-- 1 root root 115559351 Jul 16 20:44 initrd.img-5.8.0-59-generic

修复...

启动到-55内核,打开terminal并输入以下命令:

sudo update-initramfs -c -k 5.8.0-59-generic

ls -al /boot# 确认 initrd.img-5.8.0-59-generic 的新文件大小

reboot# 到正常的 -59 内核

更新#1:

检查你的文件系统...

  • 以“试用 Ubuntu”模式启动 Ubuntu Live DVD/USB
  • terminalCtrl+ Alt+打开窗口T
  • 类型sudo fdisk -l
  • 识别“Linux 文件系统”的 /dev/sdXX 设备名称
  • 输入sudo fsck -f /dev/sdXX,替换sdXX为您之前找到的数字
  • fsck如果有错误则重复命令
  • 类型reboot

相关内容