使用 GRUB 修改内核参数后无法在 Arch Linux 上启动

使用 GRUB 修改内核参数后无法在 Arch Linux 上启动

为了找到一种方法来设置运行 Arch Linux(和双启动的 Windows)的笔记本电脑的背光,我编辑了文件/etc/default/grub以更改内核参数。以下是我所做的更改:

# before edition
# GRUB_CMDLINE_LINUX_DEFAULT="lsm=lockdown,yama,apparmor,bpf loglevel=3 quiet acpi_backlight=vendor"

# after edition
GRUB_CMDLINE_LINUX_DEFAULT="lsm=lockdown,yama,apparmor,bpf loglevel=3 quiet acpi_backlight=linux"

然后我grub.cfg用 重新生成了文件grub-mkconfig -o /boot/grub/grub.cfg并重启了电脑。从那以后我就再也没能在 Arch 上启动了。不过我仍然能在 Windows 上启动。从 Arch USB 实时会话中,我仍然可以访问我的分区。因此,我首先挂载了它们:

# my root is on the nvme0n1p5 partition and my home on nvme0n1p6 
mount /dev/nvme0n1p5 /mnt
mount /dev/nvme0n1p6 /mnt/home

然后我要么这样做:

mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt

或直接

arch-chroot /mnt

然后我将/etc/default/grub文件编辑回原来的状态(acpi_backlight=vendor)。我甚至尝试完全删除该acpi_backlight参数。然后,我这样做grub-mkconfig -o /boot/grub/grub.cfg并得到了以下输出:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux-lts
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux-lts.img
Found fallback initrd image(s) in /boot: amd-ucode.img initramfs-linux-lts.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
ERROR: mkdir /var/lock/dmraid
Adding boot menu for UEFI Firmware Settings ...
done

注意:ERROR: mkdir /var/lock/dmraid只有使用 时才会出现错误arch-chroot,使用 时不会出现错误chroot。否则,两个输出是相似的。

我也尝试过,grub-install --target=i386-pc /dev/nvme0n1但没有成功。以下是此命令的输出:

Installing for i386=pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition: embedding won't be possible.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.
grub-install: error: will not proceed with blocklists.

在我的 BIOS 上,我有以下可用的启动路径:

  • SYSTEM 256MB\EFI\arch-> 出现GRUB菜单并显示error: unknown filesystem. Entering rescue mode...,然后grub rescue>给出提示符;
  • SYSTEM 256MB\EFI\Boot-> 在 Windows 上启动。
  • SYSTEM 256MB\EFI\GRUB-> GRUB 菜单短暂出现然后将我带回 BIOS;
  • SYSTEM 256MB\EFI\Microsoft-> 也可在 Windows 上启动;

请问我怎样才能让 GRUB 在 Arch 会话中重新启动?

相关内容