dpkg pre-removal exit status 1 for linux-modules-nvidia-390-5.8.0-59-generic
I tried sudo apt update
, sudo apt upgrade
, and here's the problem.
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-modules-nvidia-390-5.8.0-59-generic : Depends: nvidia-kernel-common-390 (<=390.143-1) but 390.157-0ubuntu0.20.04.1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Then I followed the instructions. sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
linux-modules-nvidia-390-5.8.0-59-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 32.8 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 292270 files and directories currently installed.)
Removing linux-modules-nvidia-390-5.8.0-59-generic (5.8.0-59.66~20.04.1) ...
/var/lib/dpkg/info/linux-modules-nvidia-390-5.8.0-59-generic.prerm: 14: cd: can'
t cd to /lib/modules/5.8.0-59-generic/kernel/nvidia-390/bits
dpkg: error processing package linux-modules-nvidia-390-5.8.0-59-generic (--remo
ve):
installed linux-modules-nvidia-390-5.8.0-59-generic package pre-removal script
subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
linux-modules-nvidia-390-5.8.0-59-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
I've also tried this. sudo dpkg -P linux-modules-nvidia-390-5.8.0-59-generic
(Reading database ... 292270 files and directories currently installed.)
Removing linux-modules-nvidia-390-5.8.0-59-generic (5.8.0-59.66~20.04.1) ...
/var/lib/dpkg/info/linux-modules-nvidia-390-5.8.0-59-generic.prerm: 14: cd: can't cd to /lib/modules/5.8.0-59-generic/kernel/nvidia-390/bits
dpkg: error processing package linux-modules-nvidia-390-5.8.0-59-generic (--purge):
installed linux-modules-nvidia-390-5.8.0-59-generic package pre-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-modules-nvidia-390-5.8.0-59-generic
I've also tried these (with sudo) and they don't work.
apt autoremove
apt autoclean
sudo dpkg --force-all -P linux-modules-nvidia-390-5.8.0-59-generic
apt autoremove -f
apt --fix-broken install
sudo apt full-upgrade
I also tried the GUI updater.
(translate: not all update can be installed)
(translate: apt index broken)
PS: I am not sure if this is related. This happened alongside. Screen glitches after an apt update
UPDATE:
It seemed that the package concerned has been removed by someone (livepatch maybe?) but it wasn't unregistered in dpkg/apt directory.
Is there a way to update dpkg/apt directory so it can be marked as not installed?