Unable to generate grub.cfg via ChRoot

Ok so I recently bought a new graphics card and would like to use pci passthrough to a windows VM to play the few games I can't play through wine. However unfortunately to get this working I need to be booted via UEFI and my original manjaro install was installed through the legacy BIOS/MBR way so I set about converting my install to a UEFI one.

I've been using the following guides and have got about 95% of the way there but have hit a ■■■■■ wall.

My original set up was a 5GiB ext4 /boot partition as the first partition and the remaining space as a btrfs partition as my / on /dev/sdb.I booted into the kde livecd of manjaro, resized and moved my partitions around until I had the partitioning scheme below:

[manjaro@manjaro ~]$ sudo lsblk -f
NAME   FSTYPE   LABEL          UUID                                 MOUNTPOINT
loop0  squashfs                                                     /run/miso/sfs/livefs
loop1  squashfs                                                     /run/miso/sfs/mhwdfs
loop2  squashfs                                                     /run/miso/sfs/desktopfs
loop3  squashfs                                                     /run/miso/sfs/rootfs
└─sda1 ntfs                    19B4EE684E10D406                     
├─sdb1 vfat                    ABB0-9D7D                            /mnt/@/boot/efi
├─sdb2 btrfs                   25bb28e8-9f58-471e-8e39-fddd35f3eed9 /mnt
└─sdb3 ext4     boot_partition aaed9e31-db62-43fd-ba38-ccdcd095e507 /mnt/@/boot
sdc    iso9660  MJRO1702       2017-06-25-18-42-17-00               /run/miso/bootmnt
├─sdc1 iso9660  MJRO1702       2017-06-25-18-42-17-00               
└─sdc2 vfat     MISO_EFI       21C7-92D8                            

I was able to chroot into my old installation (/dev/sdb2) and install grub via:

[manjaro /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck
Installing for x86_64-efi platform.
Installation finished. No error reported.

and I reinstalled the currently installed kernels so that they would get placed into /boot. This all went fine until I try and create the grub config file (/boot/grub/grub.cfg) where I get the below result:

[manjaro grub]# grub-mkconfig -o /boot/grub/grub.cfg
/usr/bin/grub-probe: error: cannot find a device for / (is /dev mounted?).
[manjaro grub]# update-grub
/usr/bin/grub-probe: error: cannot find a device for / (is /dev mounted?).

I've read through a bunch of pages of people having similar issues and they all seem to be stemming from not having the virtual filesystems mounted properly before chrooting into the installation, however I've checked and tried multiple different ways of mounting them and they seem fine.

/dev/sdb2 on /mnt type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/)
/dev/sdb3 on /mnt/@/boot type ext4 (rw,relatime,data=ordered)
/dev/sdb1 on /mnt/@/boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
proc on /mnt/@/proc type proc (rw,relatime)
sys on /mnt/@/sys type sysfs (rw,relatime)
dev on /mnt/@/dev type devtmpfs (rw,nosuid,relatime,size=16425412k,nr_inodes=4106353,mode=755)
pts on /mnt/@/dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
pts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
efivarfs on /mnt/@/sys/firmware/efi/efivars type efivarfs (rw,relatime)

I've tried mounting the virt filesystems two different ways, via "mount -o bind /dev /mnt/@/dev/" and "mount -t proc proc /mnt/proc" (applying these two methods to /dev /dev/pts /proc /sys with and without /run done aswell). If I try to update grub.cfg outside of the chroot I get the below result:

[root@manjaro manjaro]# update-grub
/usr/bin/grub-probe: error: failed to get canonical path of `overlay'.

The grub install seems to have worked fine aswell because the boot option shows up in the UEFI setup, If I try to boot to it, it goes straight to the grub cmd line (presumably because there's no valid grub.cfg). I'm completely stumped at this point so any help anyone can give me would be greatly appreciated. See below for my inxi output, keep in mind though that I'm booted from the livecd and can no longer boot into my normal install.

[root@manjaro manjaro]# inxi -Fx
Resuming in non X mode: xrandr not found. For package install advice run: inxi --recommends
System:    Host: manjaro Kernel: 4.9.34-1-MANJARO x86_64 (64 bit gcc: 7.1.1) Desktop: N/A Distro: Manjaro Linux
Machine:   Device: desktop Mobo: ASUSTeK model: P8Z77-V LK v: Rev X.0x serial: MT7023045300177                                                                       
           UEFI: American Megatrends v: 1402 date: 03/21/2014                                                                                                        
CPU:       Quad core Intel Core i5-3570 (-MCP-) cache: 6144 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 27288
           clock speeds: max: 3800 MHz 1: 1954 MHz 2: 1836 MHz 3: 1607 MHz 4: 1613 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Ellesmere [Radeon RX 470/480] bus-ID: 02:00.0
           Display Server: X.org 1.19.3 drivers: amdgpu (unloaded: modesetting)
           tty size: 165x24 Advanced Data: N/A for root
Audio:     Card-1 Intel 7 Series/C216 Family High Definition Audio Controller
           driver: snd_hda_intel bus-ID: 00:1b.0
           Card-2 Advanced Micro Devices [AMD/ATI] Device aaf0 driver: snd_hda_intel bus-ID: 02:00.1
           Card-3 Turtle Beach driver: USB Audio usb-ID: 002-005
           Sound: Advanced Linux Sound Architecture v: k4.9.34-1-MANJARO
Network:   Card: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           driver: r8169 v: 2.3LK-NAPI port: d000 bus-ID: 04:00.0
           IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: c8:60:00:c4:6e:ea
Drives:    HDD Total Size: 635.8GB (7.8% used)
           ID-1: /dev/sdb model: INTEL_SSDSC2BW12 size: 120.0GB
           ID-2: /dev/sda model: ST500DM002 size: 500.1GB
           ID-3: USB /dev/sdc model: Cruzer_Edge size: 15.6GB
Partition: ID-1: / size: 24G used: 159M (1%) fs: overlay dev: N/A
Sensors:   System Temperatures: cpu: 29.8C mobo: 27.8C gpu: 36.0
           Fan Speeds (in rpm): cpu: 0
Info:      Processes: 227 Uptime: 1:04 Memory: 1585.8/32122.2MB Init: systemd Gcc sys: 7.1.1
           Client: Shell (bash 4.4.121) inxi: 2.3.20 

Thanks in advance.

I suggest you follow The uefi section of this to the letter ignore all above it. I actually prefer the second method though both should work.


Hi, thanks for the response.

I have already tried following that guide, everything works until I have to run update-grub which gives me the error in my original post.

I have just found the solution to my issue.

The issue was related to the fact that my root partition is formatted as a btrfs partition and it needed to be mounted in a specific way before chrooting into it. See the below link for the solution and explanation as to why and what the issue was:


From what I understand; when you mount the filesystem that you are going to chroot into, you must specify the same mount options that appear in your /etc/fstab or the grub config generation script won't be able to find what to point to for the root partition. In my case adding "-o subvol=@" to my mount command worked, so:

[root@manjaro manjaro]# mount -o subvol=@ /dev/sdb2 /mnt

after mounting the rest of the required filesystems and then chrooting in, running grub-mkconfig -o /boot/grub/grub.cfg worked like a charm. Thanks for the help anyway :slight_smile:

1 Like

Sounds like that should be added to the wiki even if not a lot of people use btrfs

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by