Ubuntu – Kernel update on a USB stick installation fails with grub-probe error


I'm diagnosing some hardware issues using a USB stick installation of Ubuntu 11.10.

The USB stick was set up with the 11.10 image and the pendrivelinux.com method as recommended from the Ubuntu website. The USB stick is 8 GB.

My notebook allows me to boot from USB directly, so the HDD still has a Micro$oft-style boot structure (Windows 7).

After playing with the O/S a bit (and learning that my HDD has 15000 reallocated sectors) the update manager prompted me to install some updates. Everything updated correctly except for the kernel update (

There seems to be a grub error:

ubuntu@ubuntu:/dev$ sudo apt-get install
Reading package lists... Done  
Building dependency tree   
Reading state information... Done  
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.  
3 not fully installed or removed.  
After this operation, 0 B of additional disk space will be used.  
Setting up linux-image-3.0.0-14-generic (3.0.0-14.23) ...  
Running depmod.  
update-initramfs: deferring update (hook will be called later)  
Examining /etc/kernel/postinst.d.  
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
update-initramfs: Generating /boot/initrd.img-3.0.0-14-generic  
cryptsetup: WARNING: failed to detect canonical device of overlayfs  
cryptsetup: WARNING: could not determine root device from /etc/fstab  
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.0.0-14-generic /boot/vmlinuz-3.0.0-14-generic  
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).  
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1

which persists any time I try to repeat the installation. Fortunately, the system is always left in a bootable state despite the failure.

Do I have to take some special steps to update the kernel? Do I have a subtle installation issue that I need to manually address to get past this?

At least one other has had the same issue on an older version of the O/S. I will provide the output of mount (as was requested in the previous question) when I get access to the laptop again.

Edit: the results of mount:

/cow on / type overlayfs (rw)   
proc on /proc type proc (rw,noexec,nosuid,nodev  
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)  
fusectl on /sys/fs/fuse/connections type fusectl (rw)  
udev on /dev type devtmpfs (rw,mode=0755)  
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)  
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)  
/dev/sdb1 on /cdrom type vfat  (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)  
/dev/loop0 on /rofs type squashfs (ro,noatime)  
none on /sys/kernel/debug type debugfs (rw)  
none on /sys/kernel/security type securityfs (rw)  
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)  
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)  
none on /run/shm type tmpfs (rw,nosuid,nodev)  
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)  
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)

Edit #2: I've determined that the pendrivelinux.com flash drive utility may be playing a role in this. The USB stick containing my Ubuntu distribution gets formatted as FAT32, and the boot loader that's being installed is not actually GRUB but SYSLINUX, as per the boot_info_script script.

It makes sense that grub-probe can't figure out what to do considering that grub is not involved whatsoever in the boot process.

(This leads me to wonder why doesn't apt-get check for a grub bootloader as a dependency before attempting a kernel update?)

I suppose the next step is to try and overwrite SYSLINUX with GRUB and try to get the stick bootable that way, then see if updates work.

My first stab at this led to an unbootable system – grub was loading, I could load the kernel OK but couldn't figure out what to mount as root. I had to wipe and reinstall on the flash drive to get going again.

Best Answer

I see that you fixed your problem (using Windows 7... not really a solution but anyway). I found a solution. I'm posting it here, for other users that may come across the problem.

I found how to fix this. The line that breaks the installation is:

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.0.0-15-generic /boot/vmlinuz-3.0.0-15-generic

(The kernel version may be different on your installation)

Edit the problematic file to comment the line that update Grub. It's a very small file so it's not too difficult.

NOTE: If you want to backup the file first (it's usually a wise idea), copy it in an other directory (/root is a good one, /tmp is not since it wont survive a reboot). If you make a backup in the same folder (/etc/kernel/postinst.d/), it will be call as well, and it will fail.

Edit /etc/kernel/postinst.d/zz-update-grub to comment out line 15.


        exec update-grub


#       exec update-grub

Run the configuration script:

sudo dpkg --configure -a

You should see a lot of debugging, and NOT the error line at the end.

To be sure, re-run the configuration. It should end immediately without any logs:

sudo dpkg --configure -a

Now, you can restore the zz-update-grub file, just in case you want to install an other kernel later and grub start to work with overlayfs.