Friday, February 7, 2014

Solving "grub-probe: error: cannot find a device for / (is /dev mounted?)"

A few days ago I encountered this error, which caused me a bit of head scratching.

There are a few causes for this; if you have your O/S installed on Btrfs, then the problem is most likely that you're mounting the entire partition (which is correct in case of other FSs, but not Btrfs) instead of the subvolume for the root.

The correct mount option is:

$ sudo mount -o subvol=@  
So if for example you want to recover grub, using chroot from a live cd, a sample sequence is:
$ sudo mount -o subvol=@ /dev/sda1 /mnt
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo chroot /mnt