重新安装 Windows 后无法为 Manjaro 安装 grub

重新安装 Windows 后无法为 Manjaro 安装 grub

我最近重新安装了 Windows,Windows 是一个很棒的操作系统,它会删除引导加载程序。我认为这很容易修复,但我只需用 Manjaro 刷新我的拇指驱动器并启动它即可。当我尝试时grub-install /dev/sda4,它出错并说找不到 EFI 目录。接下来,我尝试执行grub-install --target=i386-pc /dev/sda4,它说它无法获取覆盖的规范路径。我现在有点困惑,所以我尝试挂载所有内容,chroot 到/mnt,然后grub-install /dev/sda4再次运行。这导致 grub 说该系统不支持 EFI 变量。我尝试退出 chroot,运行modprobe efivarfs然后执行efivar-tester,它还告诉我不支持 EFI 变量。我回到 chroot 并尝试grub-install --target=i386-pc /dev/sda4,它说File systemext2' 不支持嵌入。无法嵌入。只能使用黑名单在此设置中安装 GRUB。但是,黑名单不可靠,不鼓励使用它们. I tried exiting chroot again and mounting /dev/sdsa1 which appeared to be an EFI partition to/mnt/boot/efi`。我回到 chroot 并再次尝试安装两个 grub,都出现相同的错误。我尝试了在线找到的所有方法,但似乎都不起作用,有人能帮我吗?

fdisk -l

Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA MQ04ABF1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 292A7C98-9DF5-4C73-BCDA-0F4F87A64955

Device         Start        End    Sectors   Size Type
/dev/sda1       2048     534527     532480   260M EFI System
/dev/sda2     534528     567295      32768    16M Microsoft reserved
/dev/sda3     567296  207581183  207013888  98.7G Microsoft basic data
/dev/sda4  207581184 1953521663 1745940480 832.5G Linux filesystem


Disk /dev/loop0: 24.4 MiB, 25587712 bytes, 49976 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: 539.27 MiB, 565469184 bytes, 1104432 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: 1.63 GiB, 1752920064 bytes, 3423672 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: 656.32 MiB, 688197632 bytes, 1344136 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/sdb: 28.64 GiB, 30752636928 bytes, 60063744 sectors
Disk model: Ultra           
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: dos
Disk identifier: 0x00000000

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1  *         64 6060299 6060236  2.9G  0 Empty
/dev/sdb2       6060300 6068491    8192    4M ef EFI (FAT-12/16/32)

lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  24.4M  1 loop /run/miso/sfs/livefs
loop1    7:1    0 539.3M  1 loop /run/miso/sfs/mhwdfs
loop2    7:2    0   1.6G  1 loop /run/miso/sfs/desktopfs
loop3    7:3    0 656.3M  1 loop /run/miso/sfs/rootfs
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   260M  0 part /mnt/boot/efi
├─sda2   8:2    0    16M  0 part 
├─sda3   8:3    0  98.7G  0 part 
└─sda4   8:4    0 832.5G  0 part /mnt
sdb      8:16   1  28.6G  0 disk /run/miso/bootmnt
├─sdb1   8:17   1   2.9G  0 part 
└─sdb2   8:18   1     4M  0 part

答案1

我通过重新启动并尝试以下命令解决了该问题:

sudo mount /dev/sda4 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
manjaro-chroot /mnt /bin/bash
pacman -Syu grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
grub-mkconfig -o /boot/grub/grub.cfg

相关内容