Ubuntu – 14.04 Upgrade triggers grub-pc failure

bootdual-bootgrub2upgrade

My problem begins with an upgrade from Ubuntu 12.04 LTS to 14.02 LTS. As part of this I received several error messages about not being able to remove old kernels.

When first booting into 14.02, I checked everything was ok by running sudo apt-get autoremove, the same errors appeared.

Following a guide online, I ran the following:

sudo apt-get purge grub-common
sudo apt-get install grub-pc

The first operation succeeded, removing grub from my pc. The second operation failed with the following:

Creating config file /etc/default/grub with new version
Installing for i386-pc platform.
Installation finished. No error reported.
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-54-generic
Found initrd image: /boot/initrd.img-3.13.0-54-generic
Found linux image: /boot/vmlinuz-3.13.0-44-generic
Found initrd image: /boot/initrd.img-3.13.0-44-generic
Found linux image: /boot/vmlinuz-3.13.0-40-generic
Found initrd image: /boot/initrd.img-3.13.0-40-generic
Adding boot menu entry for EFI firmware configuration
cat: /video.lst: No such file or directory
/usr/sbin/grub-probe: error: failed to get canonical path of `'.
No path or device is specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.
dpkg: error processing package grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 64
Errors were encountered while processing:
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried numerous fixes for this, most of which are documented here. I created a LiveCD before removing grub-common, so I have access to my old partition and can mount and chroot into it.

But when running update-grub the same error appears, I also cannot run dpkg --configure -a without this occurring.

I used boot-repair to get a boot summary for my machine, which is a 2 HDD rig with dual boot on the first drive (/dev/sda). With Windows on /dev/sda1 and my Ubuntu partition (also boot) on /dev/sda2.

Please help me fix this and I promise I won't touch my Ubuntu install ever again. 🙂

Best Answer

  • I "elegantly solved" my problem by using the following:

    sudo apt-get purge grub-pc grub-common
    sudo rm -r /etc/grub.d/
    sudo apt-get install grub-pc grub-common
    sudo grub-install /dev/sda
    sudo update-grub
    

    Deleting the /etc/grub.d/ directory seemed to have gotten rid of whatever 12.04 files I had lurking, allowing 14.04 to get on with installing grub!

    Although I would of course recommend making a backup of anything that you are about to delete.