18

I'm trying to install arch-linux for the first time. everything was OK till I tried to install "grub" boot-loader to a USB drive.

I am working by the WIKI ARCH LINUX guide.

both of this commands worked with no errors:

# mkdir -p /mnt/usb ; mount /dev/sdc1 /mnt/usb

# grub-install --target=i386-pc --recheck --debug --boot-directory=/mnt/usb/boot /dev/sdc

but the next command return an error:

failed to get canonical path of 'airootfs' :

# grub-mkconfig -o /mnt/usb/boot/grub/grub.cfg

can any one assist?

(tried to arch-chroot /mnt /bin/bash on this one the command is not found).

4

4 Answers 4

22

Try adding --root-directory=/mnt to the grub-install command. It seems to be undocumented, but I saw it mentioned on some forum, and it worked for me.

1
  • This is a good workaround and I voted it up, however, the better solution is this one below. It's better, in my opinion, because it explains the cause of the problem and also gives a solution. Oct 25, 2022 at 20:31
4

Hit this same problem a short while ago, and figured it out. It seems like you may not have the grub package installed in your target file system.

So arch-chroot to the target (/mnt/usb), run pacman -S grub, and then execute grub-install and grub-mkconfig with correspondingly updated parameters to account for the chroot.

4

I may be three years too late, but for googlers like myself who happened upon this thread, here is the answer:

The problem is that you are running the grub-install and grub-mkconfig programs from the archiso live media. If you arch-chroot into the mounted filesystem, the error will be corrected.

By appending --root-directory=mnt to the grub-install options, you can bypass the issue, but grub-mkconfig does not include such a nifty workaround.

1
  • BANG! awesome --root-directory=mnt
    – BozoJoe
    May 26, 2021 at 2:27
1

try executing arch-chroot /mnt /bin/bash first

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .