19

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
  • Could you link to the guide you are following? Is it this one? Commented Dec 30, 2015 at 22:36
  • no. i was using this:wiki.archlinux.org/index.php/Dm-crypt/… and: wiki.archlinux.org/index.php/Beginners'_guide#Installation Commented Dec 31, 2015 at 19:29
  • I'm running into the same issue - did you ever find a solution? Commented Feb 27, 2016 at 17:11
  • Another "mee too" problem. What is so broken with Arch that it can't boot after an update. This is the third time in about 18 months. Commented Jan 26, 2017 at 14:24

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. Commented Oct 25, 2022 at 20:31
5

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 Commented May 26, 2021 at 2:27
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.

1

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.