昨天我试图更改启动参数以将我的第二个 GPU 传递给 VM。几周前我已经成功做到了。但现在,由于某种原因,相同的 GRUB 选择无法启动。GRUB 菜单出现,我选择任何选项,它尝试启动,然后 initramfs 出现错误,boot args require root= Parameter
尽管有错误。
我在 USB 驱动器上有一个辅助 Ubuntu 20.04,我将其 GRUB 配置为启动到硬盘驱动器上的 Ubuntu 20.04,并且它启动了。当我可以启动到硬盘驱动器上的 Ubuntu 时,我尝试以另一种方式进行。从硬盘驱动器上的 GRUB 启动到 USB 上的 Ubuntu,失败了。
我尝试过重新安装 GRUB ( grub-install --target=i386-pc /dev/sda
)、mkinitramfs、重新安装 grub-customizer、通过更改环境使用 USB 上的 Ubuntu 在硬盘上定制 GRUB、在两个 Ubuntu 上使用 grub-customizer 将启动脚本从 USB 复制到硬盘。
来自 Boot-Repair 的 Pastebin(修复前):https://paste.ubuntu.com/p/CBr699jv3r/。Boot-Repair Boot Info Summary 的 Pastebin 部分如下所示。
============================== Boot Info Summary ===============================
=> Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 2048
of the same hard drive for core.img. core.img is at this location and
looks for (,gpt2)/boot/grub. It also embeds following components:
modules
---------------------------------------------------------------------------
fshelp ext2 part_gpt biosdisk
---------------------------------------------------------------------------
=> Grub2 (v2.00) is installed in the MBR of /dev/sdb and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for (,msdos1)/grub. It also embeds following components:
modules
---------------------------------------------------------------------------
fshelp ext2 part_msdos biosdisk
---------------------------------------------------------------------------
sda1: __________________________________________________________________________
File system: BIOS Boot partition
Boot sector type: Grub2's core.img
Boot sector info:
sda2: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 20.04.4 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
/boot/grub/i386-pc/core.img
sda4: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: According to the info in the boot sector, sda4 starts
at sector 1953318912. But according to the info from
fdisk, sda4 starts at sector 4883970048.
Operating System: Windows 8 or 10
Boot files: /Windows/System32/winload.exe
sdb1: __________________________________________________________________________
File system: ext2
Boot sector type: -
Boot sector info:
Operating System:
Boot files: /grub/grub.cfg /grub/i386-pc/core.img
sdb2: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sdb3: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 20.04.4 LTS
Boot files: /etc/fstab /etc/default/grub
================================ 3 OS detected =================================
OS#1: The OS now in use - Ubuntu 20.04.4 LTS CurrentSession on sda2
OS#2: Ubuntu 20.04.4 LTS on sdb3
OS#3: Windows 8 or 10 on sda4
================================ Host/Hardware =================================
CPU architecture: 64-bit
Video: Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X] Cedar [Radeon HD 5000/6000/7350/8350 Series] from Advanced Micro Devices, Inc. [AMD/ATI] Advanced Micro Devices, Inc. [AMD/ATI]
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.13.0-48-generic root=UUID=7b9b093f-077c-4693-a0ae-93e464d52727 ro quiet splash
df -Th / : /dev/sda2 ext4 2.3T 1.9T 261G 89% /
===================================== UEFI =====================================
BIOS/UEFI firmware: F7 from Award Software International, Inc.
This installed-session is in Legacy/BIOS/CSM mode (not in EFI mode).
============================= Drive/Partition Info =============================
Disks info: ____________________________________________________________________
sda : is-GPT, hasBIOSboot, has-noESP, not-usb, not-mmc, has-os, has-win, 2048 sectors * 512 bytes
sdb : notGPT, no-BIOSboot, has-noESP, usb-disk, not-mmc, has-os, no-wind, 2048 sectors * 512 bytes
Partitions info (1/3): _________________________________________________________
sda2 : is-os, 64, apt-get, grub-pc , grub2, grub-install, grubenv-ok, update-grub, farbios
sda4 : is-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sdb1 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, grubenv-ok, noupdategrub, not-far
sdb2 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sdb3 : is-os, 64, apt-get, grub-pc , grub2, grub-install, no-grubenv, update-grub, not-far
Partitions info (2/3): _________________________________________________________
sda2 : isnotESP, fstab-without-efi, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda4 : isnotESP, part-has-no-fstab, no-nt, haswinload, no-recov-nor-hid, no-bmgr, notwinboot
sdb1 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb2 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb3 : isnotESP, fstab-without-efi, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
Partitions info (3/3): _________________________________________________________
sda2 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, customized, sda
sda4 : not--sepboot, no-kernel, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sdb1 : is---sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb2 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb3 : not--sepboot, no---boot, fstab-has-goodBOOT, not-sep-usr, with--usr, fstab-without-usr, customized, sdb
fdisk -l (filtered): ___________________________________________________________
Disk sda: 2.75 TiB, 3000592982016 bytes, 5860533168 sectors
Disk identifier: 53FA307E-15D6-42AF-924E-E969393ED491
Start End Sectors Size Type
sda1 2048 194559 192512 94M BIOS boot
sda2 194560 4883967999 4883773440 2.3T Linux filesystem
sda4 4883970048 5860532223 976562176 465.7G Microsoft basic data
Disk sdb: 28.67 GiB, 30765219840 bytes, 60088320 sectors
Disk identifier: 0x4047f93c
Boot Start End Sectors Size Id Type
sdb1 * 2048 999423 997376 487M 83 Linux
sdb2 999424 20531199 19531776 9.3G 83 Linux
sdb3 20531200 60088319 39557120 18.9G 83 Linux
parted -lm (filtered): _________________________________________________________
sda:3001GB:scsi:512:4096:gpt:ATA TOSHIBA DT01ACA3:;
1:1049kB:99.6MB:98.6MB:::bios_grub;
2:99.6MB:2501GB:2500GB:ext4:ubuntu:;
4:2501GB:3001GB:500GB:ntfs:win10old:msftdata;
sdb:30.8GB:scsi:512:512:msdos:SanDisk Cruzer Blade:;
1:1049kB:512MB:511MB:ext2::boot;
2:512MB:10.5GB:10.0GB:ext4::;
3:10.5GB:30.8GB:20.3GB:ext4::;
blkid (filtered): ______________________________________________________________
NAME FSTYPE UUID PARTUUID LABEL PARTLABEL
sda
├─sda1 cdd316f1-8ba6-4dbf-ada9-8d394e7d5106
├─sda2 ext4 7b9b093f-077c-4693-a0ae-93e464d52727 6350c9fc-a9c3-417e-9c4b-6d928f725b04 ubuntu
└─sda4 ntfs 109E03B29E039000 24c61a43-c524-4fcb-9aa4-23b7030c7687 win10old
sdb
├─sdb1 ext2 643df8ce-4bc3-4c00-a066-42d128b98097 4047f93c-01
├─sdb2 ext4 2e899ba0-a146-4282-8fdf-ad7456d80327 4047f93c-02
└─sdb3 ext4 0b68fe75-a179-4b4d-8362-22dfd343fadb 4047f93c-03
Mount points (filtered): _______________________________________________________
Avail Use% Mounted on
/dev/sda2 261G 84% /
/dev/sda4 151.9G 67% /mnt/boot-sav/sda4
/dev/sdb1 285.4M 34% /media/alienus/643df8ce-4bc3-4c00-a066-42d128b98097
/dev/sdb2 8G 8% /media/alienus/2e899ba0-a146-4282-8fdf-ad7456d80327
/dev/sdb3 8.1G 51% /media/alienus/0b68fe75-a179-4b4d-8362-22dfd343fadb
Mount options (filtered): ______________________________________________________
/dev/sda2 ext4 rw,relatime,errors=remount-ro
/dev/sda4 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb1 ext2 rw,nosuid,nodev,relatime
/dev/sdb2 ext4 rw,nosuid,nodev,relatime
/dev/sdb3 ext4 rw,nosuid,nodev,relatime
注意:我不使用 sda4 上的 Windows。它只是从我的旧驱动器复制的,并且故意让它无法启动。
硬盘上的 GRUB 脚本:
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 --hint='hd0,gpt2' 7b9b093f-077c-4693-a0ae-93e464d52727
else
search --no-floppy --fs-uuid --set=root 7b9b093f-077c-4693-a0ae-93e464d52727
fi
linux /boot/vmlinuz-5.13.0-48-generic root=UUID=7b9b093f-077c-4693-a0ae-93e464d52727 ro quiet splash $vt_handoff
initrd /boot/initrd.img-5.13.0-48-generic
USB 中的 GRUB 脚本:
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7b9b093f-077c-4693-a0ae-93e464d52727
else
search --no-floppy --fs-uuid --set=root 7b9b093f-077c-4693-a0ae-93e464d52727
fi
linux /boot/vmlinuz-5.13.0-48-generic root=UUID=7b9b093f-077c-4693-a0ae-93e464d52727 ro quiet splash $vt_handoff
initrd /boot/initrd.img-5.13.0-48-generic
答案1
使用启动修复在实时 USB 上解决了无法加载根分区的问题。但它只安装了 5.15.0-41-generic 内核,而我在这个内核上遇到了问题。所以我再次启动实时 USB,使用
sudo mount /dev/sda2 /mnt (root partition)
sudo mount /dev/sda1 /mnt/boot (required if separate boot partition)
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
并用于sudo chroot /mnt
进入系统切换。
此后我重新安装了 GRUB(因为我是 root,所以不需要 sudo)
grub-mkdevicemap
grub-install /dev/sda
update-grub
在此之后,我获得了更多的内核和恢复选项。
在启动时,我选择了 5.13.0-48-generic 内核选项,对我来说运行良好。然后我通过 grub-customizer 将默认选项从 5.15.0-41-generic 编辑为 5.13.0-48-generic。确保启动没有问题后,我添加了第二个 GRUB 选项,其中包含阻止我的第二个 GPU 的启动参数,并在正常和 GPU 通道之间切换重启了几次,看到它在两个选项中都启动了,没有任何问题,我可以说这个问题已经解决了。