10

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. :-)

3 Answers 3

12

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.

4
  • 2
    This does solve the problem, thank you very much! Jun 7, 2016 at 17:38
  • 1
    DANGER you might not want to run such rm -r commands ... at the very least, back up what you remove. And also this solution is missing update-initramfs -u which is often important for fixng boot issues.
    – Peter
    Apr 4, 2018 at 11:16
  • 2
    I found this question while looking for a solution w.r.t. the message dpkg: error processing package grub-pc (--configure) which I was getting when running apt upgrade. Doing only apt-get purge grub-pc grub-common; apt-get install grub-pc grub-common; update-grub solved the problem. Mar 27, 2020 at 13:36
  • This also fixed a problem for me on 20.10 where ubuntu just decided it didn't want to boot anymore :-( Jan 7, 2021 at 14:15
1

these grub errors have been ongoing for many years and even now on 20.04 ... just run these

sudo apt-get update
sudo apt-get --fix-broken install -y
sudo apt-get -f install -y 
sudo  apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq
sudo apt-get autoremove -yq
sudo apt-get autoclean -y

if output of above shows some flareup then just rerun all of above again and you will be good to go

1
  • Hi Scott, could you please help, I am also facing the same issue with my 20.04. I did what you mentioned but I keep on getting: Errors were encountered while processing: grub-pc linux-image-5.4.0-52-generic linux-image-5.4.0-51-generic E: Sub-process /usr/bin/dpkg returned an error code (1). Please help.
    – nkhl
    Nov 13, 2020 at 4:25
0

The easiest way to use Boot-Repair is to create a disk containing the tool (eg Boot-Repair-Disk, a disk starting Boot-Repair automatically), and boot on it.

I personally prefer using the Boot-Repair disk ISO

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .