Following a spate of total freezes on my Acer B116 after upgrading to Ubuntu 16.04, I read this post and decided to upgrade the kernel to 4.7-RC3 using these instructions.
However, there were errors when installing. I tried to then uninstall the kernel using the instruction (from the previous link):
$ sudo apt-get remove 'linux-headers-4.7*' 'linux-image-4.7*'
From the terminal, the error messages are:
/usr/sbin/grub-probe: error: failed to get canonical path of `aufs'. run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.7.0-040700rc3-generic.postrm line 328. dpkg: error processing package linux-image-4.7.0-040700rc3-generic (--remove): subprocess installed post-removal script returned error exit status 1 Removing linux-headers-4.7.0-040700rc3-generic (4.7.0-040700rc3.201606121131) ... Removing linux-headers-4.7.0-040700rc3 (4.7.0-040700rc3.201606121131) ... Errors were encountered while processing: linux-image-4.7.0-040700rc3-generic E: Sub-process /usr/bin/dpkg returned an error code (1)
I've also tried to remove the kernel image via Synaptic Package Manager but similar error messages occur.
Advice on how to remove the kernel image would be greatly appreciated. For the record, I now know that installing this kernel is not the solution, and I don't want it installed.
The instructions fail to mention that you can't delete your running kernel (suicide) which is possibly what you are trying to do. Please reboot, hit shift repeatedly and when you manage to get the GRUB menu select
Advanced Options for Ubuntu
and then move down with the arrow keys to select an older kernel to boot.
Once booted check
uname -r to see the running kernel, to be sure you are NOT running the kernel you want to delete. Hopefully it will output something like
4.4.0-31-generic Do not delete the running kernel
You can then try the same
apt-get remove commands as before
If you have problems with that, you can delete the kernel manually instead of using
apt-get (one more time, please make sure you don't delete the running kernel)
To delete kernel
linux-image-4.7.0-040700rc3-generic and all of its files you can use the unique release string. Do
to update the database for the
locate command. Now we can find all the files belonging to the kernel with this command, and delete them with
locate -b -e 4.7.0-040700rc3-generic | xargs -p sudo rm -r
locate find only existing files and
-b avoids listing all the files in all the matching directories.
xargs interactive so it will ask for confirmation before executing
sudo rm -r (which deletes all the files and the directories and all the files in the directories) on the found files.
This command throws an error because it tries to delete the same files multiple times, but this doesn't matter, we only need to delete them once :)