How can I run update-grub on a chroot filesystem

32,423

oops... my bad. It's as simple as mounting dev.

Strangely enough I tried this at about 1am last night and that didn't work. This morning it did, so I'm not sure what was different.

To get a full environment just

sudo chroot /media/flash-drive
mount proc
mount sys
mount dev

And in case you have a separate boot partition

mount boot

After doing that I was able to see my devices in /dev

And update-grub actually works. Now to figure out why it's not booting... that's another problem.

Share:
32,423

Related videos on Youtube

hookenz
Author by

hookenz

Updated on September 18, 2022

Comments

  • hookenz
    hookenz over 1 year

    I've been building a live Ubuntu server (10.04 LTS) to run off a thumb drive and it's nearly there.

    However, I've gotten stuck at one step.

    I need to run update-grub but it's complaining about:

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

    My fstab file contains:

    # filesystem   mount point     type    options                 dump    pass
    UUID=76d2077e-9726-4f95-abab-323cb426b099       /               ext2    defaults                0       0
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    sys             /sys            sysfs   defaults                0       0
    
  • Randall Whitman
    Randall Whitman almost 7 years
    In 12.04, I had to mount udev rather than dev.
  • xpt
    xpt almost 4 years
    I was misled by Randall's comment as to mount udev rather than dev, but it turns out that it is still dev (of type udev) that needs to be mounted, as of today for Ubuntu 20.04 LTS.