25

I was following the official installation tutorial. Everything was smooth until the boot loader section.

I had encountered the error of

/usr/bin/grub-probe: error: failed to get canonical path of 'airootfs'.

same as this question while executing the command:

grub-mkconfig -o /boot/grub/grub.cfg

I was installing arch on VirtualBox and was following the official's wiki tutorial GRUB section step by step.

I can boot into grub successfully but all that I can see is only a grub shell. As a inference, I think it has derailed since the step to generate the grub configuration file. Hope that my info is helpful.


BTW in fact, I had also encountered this error in the previous step - installing the grub

grub-install --target=i386-pc /dev/sda

I added the root directory parameter and it went on without appearing error.

grub-install --root-directory=/mnt /dev/sda

I did so because I mounted my main Linux partition /dev/sda3 on /mnt but there isn't any root or boot directory parameter for me to use in grub-mkconfig.

Here is my partition table displayed by fdisk utility: mypartitiontable

Thx a lot. Regards.

李智修
  • 373
  • 1
  • 3
  • 7
  • what error? which error? –  Feb 09 '16 at 13:30
  • @user137124 just a mistake. Sorry for my unclear title. Still, I improved it and hope for someone to reply. – 李智修 Feb 09 '16 at 14:00
  • Still unclear, please post the exact error message. – Johnson Steward Feb 09 '16 at 15:28
  • @JohnsonSteward I'm sorry, you must have been tired of those unclear questions. I again tried my best to describe the question. Please reply if you still don't understand the error I stated, then I'll post the full screen shot on here. Great thanks. – 李智修 Feb 10 '16 at 11:16
  • @李智修 seems like you should do `grub2-mkconfig` **in** the chroot instead of doing it outside. `grub2-mkconfig` uses `grub-probe` to detect real devices associated with mount points, while `airootfs` (archiso's rootfs) is loaded into the ram and don't have a canonical path. – Johnson Steward Feb 10 '16 at 11:20
  • The correct way to install and make config for grub is doing it inside the chroot. Otherwise you may be greeted with strange filesystems which only exist in livecd (e.g. `rootfs`, `/cow` and many more) – Johnson Steward Feb 10 '16 at 11:22
  • @JohnsonSteward I see, thanks for your reply. I think official's wiki should have added this notice(since a small frustration may easily defeat a Arch newbie) – 李智修 Feb 10 '16 at 11:30
  • OK, when the question's reopened, add the answer yourself! – Johnson Steward Feb 10 '16 at 11:31

1 Answers1

27

Seems like you should do grub2-mkconfig in the chroot instead of doing it outside. grub2-mkconfig uses grub-probe to detect real devices associated with mount points, while airootfs (archiso's rootfs) is loaded into the ram and doesn't have a canonical path.

So before installing grub and generating config, do this first:

arch-chroot /mnt /bin/bash
Johnson Steward
  • 781
  • 6
  • 16
  • I get the same errors as OP. The commands listed above result in *"Error failed to setup chroot..."*. I wouldn't be in this fine mess if Arch did not break itself after the last update. Its amazing how often this OS breaks itself. Its worse than damn Microsoft Windows. –  Jan 26 '17 at 14:12
  • But I am currently fine with the use of AUR from time to time without breaking my setup. Maybe limiting the use of self-build(build from source by yourself) may help? I always enter Y when pacman ask me anything lol – 李智修 Feb 17 '17 at 04:04
  • 6
    But the GRUB install commands aren't available inside the chroot... – flarn2006 Feb 20 '17 at 02:14
  • 3
    @flarn2006 You need to install the grub package inside the chroot. – chris Apr 02 '17 at 15:39
  • 8
    @flarn2006 `pacman -S grub` – Vitaly Zdanevich Jul 22 '17 at 10:35
  • This is the right answer, thanks! similarly: https://bbs.archlinux.org/viewtopic.php?pid=1225067#p1225067 – MewX Nov 01 '18 at 06:26