grub-probe: cannot find a device for /boot/grub

Bug #591454 reported by ykanello
42
This bug affects 8 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: grub2

dpkg: dependency problems prevent configuration of ubuntu-standard:
 ubuntu-standard depends on memtest86+; however:
  Package memtest86+ is not configured yet.
dpkg: error processing ubuntu-standard (--configure):
 dependency problems - leaving unconfigured
Setting up grub-pc (1.98-1ubuntu6) ...
/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

ProblemType: Package
DistroRelease: Ubuntu 10.04
Package: grub-pc 1.98-1ubuntu6
ProcVersionSignature: Ubuntu 2.6.31-22.60-generic
Uname: Linux 2.6.31-22-generic x86_64
Architecture: amd64
Date: Tue Jun 8 22:41:58 2010
ErrorMessage:
 ErrorMessage: subprocess installed post-installation script returned error exit status 1
SourcePackage: grub2
Title: package grub-pc 1.98-1ubuntu6 failed to install/upgrade:

Revision history for this message
ykanello (ykanello) wrote :
Revision history for this message
ykanello (ykanello) wrote :

:~# grub-install --modules=ext4 /dev/sdc
/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
You attempted a cross-disk install, but the filesystem containing /boot/grub does not support UUIDs.

Revision history for this message
Colin Watson (cjwatson) wrote :

Forget about the --modules option.

Could you please run these commands and show me the output:

  cat /boot/grub/device.map
  sudo grub-probe -vvv --target=device /boot/grub

Changed in grub2 (Ubuntu):
status: New → Incomplete
summary: - package grub-pc 1.98-1ubuntu6 failed to install/upgrade:
+ grub-probe: cannot find a device for /boot/grub
Revision history for this message
Carlos Eduardo Moreira dos Santos (cemsbr) wrote :

I had this problem yesterday because I'm using an LVM boot partition and /dev/mapper/VolumeGroup-LogicalVolume was a symlink to /dev/dm-X. After removing the symlink and running "cp -R /dev/dm-X /dev/mapper/VolumeGroup-LogicalVolume", I could run grub-install successfully.

Revision history for this message
Colin Watson (cjwatson) wrote :

Carlos, the version of GRUB 2 in Maverick should deal with symlinks in /dev/mapper/. For that matter, the LVM configuration in Ubuntu does not yet create symlinks in /dev/mapper/ as far as I know, so I'm not sure how you ran across this problem in Ubuntu ...

Revision history for this message
Carlos Eduardo Moreira dos Santos (cemsbr) wrote :

In fact, all entries in /dev/mapper are not symlinks in Ubuntu. Somehow my grub2 could not find the disk and I had to boot using a rescue cd and it created the symlinks I saw after chrooting in Ubuntu.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for grub2 (Ubuntu) because there has been no activity for 60 days.]

Changed in grub2 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Adam Porter (alphapapa) wrote :

Carlos, I had the same problem as you. I think it works like this (in my case, anyway):

1. Upgrading from Hardy to Lucid doesn't install LVM support--the lvm2 package is not even installed by update-manager.
2. After upgrading ALL packages, resolving many conflicts by hand, getting the new kernel installed, etc, I rebooted and the kernel couldn't find my root partition because it's in an LVM VG, and lvm2 wasn't installed, so there was no lvm in the initramfs.
3. I booted from a Lucid LiveCD, chrooted, installed lvm2.
4. I'm not sure if it was absolutely necessary, but I went ahead and installed grub2 (grub-common, grub-pc packages).
5. The install scripts couldn't find my root partition, because of this symlink problem. Apparently the GRUB from Lucid and the lvm2 from Maverick don't play well together because of the symlinks created by the newer version of lvm2.

I went around in circles for a long time. Thanks to some bug reports and forum posts, I was able to get it working by replacing the /dev/mapper symlinks with the device nodes, then reinstalled GRUB (and lvm, just to be sure...all the rebooting and chrooting is vulnerable to typos and human error), and finally all the GRUB and lvm2 scripts worked and I was able to boot into Lucid.

Upgrading from Hardy to Lucid is supposed to be supported--shouldn't it work even if users have LVM root partitions? I suppose that fixing the upgrade-manager so it installs lvm2 would fix it, but is it really that simple? How did this situation slip by testing? Are there really that few LVM users?

I imagine other people could eventually upgrade from Hardy to Lucid and encounter this problem again. Do we need to file a new bug against update-manager?

Here are some links for reference, in case they may help anyone else:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544577
http://ubuntuforums.org/showthread.php?t=1581099
http://ubuntuforums.org/showthread.php?t=1520447

Changed in grub2 (Ubuntu):
status: Expired → Confirmed
tags: added: hardy lvm
Revision history for this message
Adam Porter (alphapapa) wrote :

This was specifically encountered by update-manager not installing lvm2 when upgrading from Hardy to Lucid on a system using LVM for several partitions, including root.

Revision history for this message
gcc (chris+ubuntu-qwirx) wrote :

Thank you Carlos! I had no idea how to fix this problem with Lucid, but your answer in #4 worked perfectly. Thanks again.

Revision history for this message
Nils Sabelstrom (nilssab) wrote :

I have the same problem in 14.04 when accessing through chroot to repair a uefi bootloader.

Installed is 14.04, bootloader was overwritten by Win 8 bios update utility.
Ubuntu 14.04 LiveCD is used to boot, and installed root and boot partitions are mounted to chroot into them to reinstall grub-efi
Bug seems to be caused by grub-probe not working when installed / is on btrfs. It works without problem in the installed 14.04 environment, but fails when done through a chroot

Revision history for this message
Nils Sabelstrom (nilssab) wrote :

worked when mounting the default @ subvolume, as opposed to mounting sdxy and chrooting into /mnt/@/ maybe the problem is having @ in the path?

Revision history for this message
Azyl (dj-azyl) wrote :

Hi All,

In my case the issue was caused due to the fact that i have used a btrfs filesystem for my root partition and as Nils mentioned if you just mount the /dev/sdx to mnt and then mount --bind all the nedeed parts, chroot and try to update grub or grub-install the comands will both fail as you need to mount the default subvolume bellow i described how i managed to do that:

I recomend that you

In case of btrfs mount the drive to a temp dir then find the ID of the btrfs subvolumes or snapshots with

 btrfs subvolume list / where / is the path to a temp directory where you have mounted the /dev/sdx btrfs filesystem

and in order to mount the desired subvolumne issue mount /dev/sda6 -o subvolid=ID /mnt

where ID is the ID returned by btrfs subvolume list /path_to_temp_mount_folder

After that you can continue asn normal with the grub rescue :P:

sudo mount --bind /dev /mnt/dev && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys && sudo mount --bind /dev/pts /mnt/dev/pts && sudo cp /etc/resolv.conf /mnt/etc/resolv.conf && sudo chroot /mnt

update-grub or grub-install /dev/sdax

Hope this help other as the previos comment gaved me a nice hint to solve my issue.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Phillip Susi (psusi)
affects: update-manager → ubuntu
Changed in ubuntu:
status: New → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

Since this very old bug was about upgrading from hardy to lucid, and hardy is long since end of life, I'm going to close this now.

no longer affects: ubuntu
Changed in grub2 (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
kostyarin (k-i-r) wrote :

The bug is still present.

# update-grub -v
grub-mkconfig (GRUB) 2.02~beta2-36ubuntu3.2

After chroot

# update-grub
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

Ubuntu: kubuntu-16.04.1-desktop-amd64

Filesystem:
/dev/sda <- grub installed here
/dev/sda5 <- /boot (btrfs)
/dev/sda6 <- / (btrfs with @ subvolume)
/dev/sda7 <- /home (btrfs with @home subvolume)

I've installed Kubuntu from ISO image to this filesystem. I didn't create subvolumes the installer did that.

After installation I've entered chroot using this commands:

sudo mount -v -t btrfs /dev/sda6 /mnt -O noatime,nodiratime,subvol=@
sudo mount -v -t btrfs /dev/sda5 /mnt/@/boot -O noatime,nodiratime
sudo mount -v -t btrfs /dev/sda7 /mnt/@/home -O noatime,nodiratime,subvol=@home
for i in sys proc dev dev/pts; do sudo mount -v --bind /$i /mnt/@/$i; done
sudo chroot /mnt/@

The stupid thing is @ directory after /mnt. I really don't know how to avoid it. I thing it's root of all problems.

Ok, after chroot I've edit /etc/grub.d/40_custom to add ISO image from another partition (/dev/sda7) but update-grub fails:

# update-grub
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

More than that I've used some monkey path from internet that force grub-probe to return 0. But the system is in unusable state anyway.

Firstly I've got "sparse file not allowed error". Solve it by commenting out of this line

if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi

in /etc/grub.d/00_header file.

Secondly I've got "device not found 'root'". It seems that linux commandline options is wrong.

Take a look

root@kubuntu:/# cat /boot/grub/grub.cfg | grep vmlinuz
        linux /vmlinuz-4.4.0-31-generic root=/dev/sda1 ro quiet splash $vt_handoff
                linux /vmlinuz-4.4.0-31-generic root=/dev/sda1 ro quiet splash $vt_handoff
                linux /vmlinuz-4.4.0-31-generic root=/dev/sda1 ro recovery nomodeset
        linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash

As you can see `root=/dev/sda1` instead of /dev/sda6. But nothing changes if I change it manually to /dev/sda6 or UUID=blah. I've also tryied UUID=blah + rootflags=subvol=@. Nothing workrs.

I think that all of this problems has a single root. And, actually, it's critical.

Changed in grub2 (Ubuntu):
status: Invalid → New
Revision history for this message
kostyarin (k-i-r) wrote :

Hah.

Sorry for panic. False alarm.

The magic commands that solve everything are

sudo mount -v --bind /mnt/@/ /mnt
sudo mount -v --bind /mnt/home/@home /mnt/home # optional

So, I've been little confused with btrfs subvolumes. Actually the above message is a bug in
kubuntu installer.

Changed in grub2 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.