Ubuntu 20.04 LTS Failed to Install linux-image-5.4.0-89-generic
The error log of apt -f install
suggests that there are errors with the post-installation script of the following packages:
linux-image-5.4.0-89-generic
wireguard-dkms
-
linux-modules-extra-5.4.0-89-generic
(dependency issues)
This generally means that one or another command from the post-installation (shell-script) failed due to issues with the configuration files.
METHOD #1: First, try force overwriting the files:
sudo dpkg -i --force-overwrite var/cache/apt/archives/linux-image*
sudo dpkg -i --force-overwrite var/cache/apt/archives/wireguard-dkms*
sudo dpkg -i --force-overwrite var/cache/apt/archives/linux-module*
sudo apt --fix-broken install
Meaning:-
-
Here, the
--force-overwrite
argument will forcedpkg
to place the files regardless of the errors. The error message seems to normal and not destructive, you can run the commands without any fear. -
In the last command the
--fix-broken
argument will reconfigure/reprocess the error packages.
If this didn't work then you need to remove the post-installation script of the packages:
sudo rm /var/lib/dpkg/info/linux-image-5.4.0-89-generic.postinst
sudo rm /var/lib/dpkg/info/wireguard-dkms.postinst
sudo rm /var/lib/dpkg/info/linux-modules-extra-5.4.0-89-generic.postinst
Then run a force-install:
sudo apt --fix-broken install
Then run an autoremove:
sudo apt autoremove && sudo apt clean
Meaning:-
- The post-installation script of the package consists of commands to be run after the installation is complete to tell other applications about the installation of the package. Removing that will not do any harm as running
--fix-broken
install already ran the post-installation script.
After running the commands mentioned above, make sure to run these commands:
sudo apt update && sudo apt upgrade && sudo apt autoremove && sudo apt clean && sudo apt autoclean && sudo apt --fix-broken install