8

I was trying to install a new Ubuntu 12.04 installation next to my old 10.10 installation, and I've run into a problem. My computer seems to have a finicky BIOS, and wants a boot partition less than 40 GB in size. So, when I installed 10.10, I split the system into /boot on /dev/sda1 and / on /dev/sda6.

When I installed 12.04 LTS, I totally forgot about it, and now I need to reinstall GRUB. But, I seem to be getting an error.

mint@mint ~ $ sudo grub-install --root-directory=/mnt /dev/sda
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
Installation finished. No error reported.

I'm running this from a Linux Mint live USB device that I had lying around, the GRUB version is the same as the one Ubuntu 12.04 uses, I think.

So, is there something I'm missing, or would it be a better idea to just restart the Ubuntu installation?

8

I encountered the cannot find a device for /boot (is /dev mounted?) error message in a VM I was working on. I have no idea if my solution will apply to you, or to anyone else.

My VM was failing to boot. Therefore, I booted into a rescue environment. The rescue environment was probably running on read-only media that was mounted on /. As you can see below, I mounted the disk containing my broken desired host installation on /mnt.

I surmised that grub-install expects to run inside the host OS filesystem, and, furthermore, grub-install expects to be able to see the mount of the root filesystem for that host.

So the trick was to first chroot into the host OS, and then re-mount the host OS on /.

I did the following (which I am typing from memory, so it is possible there are errors).

# mount /dev/sdaN /mnt
# mount --rbind /dev  /mnt/dev
# mount --rbind /proc /mnt/proc
# mount --rbind /sys  /mnt/sys
# chroot /mnt bash
# mount /dev/sdaN /
# grub-install /dev/sdaN

I was then able to reboot the VM successfully. My host OS was Ubuntu 18.04, and the rescue environment was a version of Debian with a 4.x kernel.

1
  • 1
    grub-install can only work with the drive, not the partition, so use grub-install /dev/sda not /dev/sdaN – ZomoXYZ Feb 13 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.