2

Whenever I install any new kernel (or kernel is upgraded) then there are lot of errors.

The error I am getting after I do

sudo apt -f install

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-headers-4.18.0-17-generic (4.18.0-17.18) ...
/etc/kernel/header_postinst.d/dkms:
Error! Could not locate dkms.conf file.
File:  does not exist.
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 4
dpkg: error processing package linux-headers-4.18.0-17-generic (--configure):
 installed linux-headers-4.18.0-17-generic package post-installation script subprocess returned error exit status 1
Setting up linux-image-4.18.0-17-generic (4.18.0-17.18) ...
dpkg: dependency problems prevent configuration of linux-headers-generic:
 linux-headers-generic depends on linux-headers-4.18.0-17-generic; however:
  Package linux-headers-4.18.0-17-generic is not configured yet.

dpkg: error processing package linux-headers-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-headers-generic (= 4.18.0.17.18); however:
  Package linux-headers-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic:
 linux-signed-generic depends on linux-generic; however:
  Package linux-generic is not configured yet.

dpkg: error processing package linux-signed-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                           No apport report written because the error message indicates its a followup error from a previous failure.
                                                      No apport report written because MaxReports is reached already
                                     Processing triggers for linux-image-4.18.0-17-generic (4.18.0-17.18) ...
/etc/kernel/postinst.d/dkms:
Error! Could not locate dkms.conf file.
File:  does not exist.
run-parts: /etc/kernel/postinst.d/dkms exited with return code 4
dpkg: error processing package linux-image-4.18.0-17-generic (--configure):
 installed linux-image-4.18.0-17-generic package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-headers-4.18.0-17-generic
 linux-headers-generic
 linux-generic
 linux-signed-generic
 linux-image-4.18.0-17-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried everything as posted in other questions

apt-get -f install

apt-get autoremove

apt-get remove linux-image-4.18.0-17-generic

I also used dpkg and ukuu to remove the package linux-image-4.18.0-17-generic but nothing worked

Here is output of various commands I tried

sudo dpkg --configure -a

Setting up linux-image-4.18.0-17-generic (4.18.0-17.18) ...
dpkg: dependency problems prevent configuration of linux-headers-generic:
 linux-headers-generic depends on linux-headers-4.18.0-17-generic; however:
  Package linux-headers-4.18.0-17-generic is not configured yet.

dpkg: error processing package linux-headers-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-headers-generic (= 4.18.0.17.18); however:
  Package linux-headers-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic:
 linux-signed-generic depends on linux-generic; however:
  Package linux-generic is not configured yet.

dpkg: error processing package linux-signed-generic (--configure):
 dependency problems - leaving unconfigured
Processing triggers for linux-image-4.18.0-17-generic (4.18.0-17.18) ...
/etc/kernel/postinst.d/dkms:
Error! Could not locate dkms.conf file.
File:  does not exist.
run-parts: /etc/kernel/postinst.d/dkms exited with return code 4
dpkg: error processing package linux-image-4.18.0-17-generic (--configure):
 installed linux-image-4.18.0-17-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-headers-generic
 linux-generic
 linux-signed-generic
 linux-image-4.18.0-17-generic

sudo dpkg --purge linux-headers-4.18.0-17-generic

dpkg: dependency problems prevent removal of linux-headers-4.18.0-17-generic:
 linux-headers-generic depends on linux-headers-4.18.0-17-generic.

dpkg: error processing package linux-headers-4.18.0-17-generic (--purge):
 dependency problems - not removing
Errors were encountered while processing:
 linux-headers-4.18.0-17-generic

Extra info

I cannot remove 4.18.0-17 and I tried nearly everything on internet and all answers on askubuntu says the same thing which is not working for me. I also have a bunch of dkms modules installed on my system but I am pretty sure this happened due to wine because this is the only extra thing I installed apart from chrome and dkms modules and I used ubuntu normally before this error happened.

3
  • I don't see you taking the help of the following link askubuntu.com/questions/227258/…
    – Tintin
    Mar 26, 2019 at 17:19
  • @Tintin I didn't included everything that I tried since there are so many and this one also did not worked for me
    – knoftrix
    Mar 26, 2019 at 20:05
  • I have got the exact same problem. Nothing works.. Apr 5, 2019 at 17:09

1 Answer 1

3

Looking at this : Can't remove kernels "run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1", I came up with a solution.

Try renaming the grub script so it is bypassed. It isn't a long term solution but you may be able to run your updates.

sudo mv /etc/kernel/postrm.d/zz-update-grub /etc/kernel/postrm.d/zz-update-grub.bad

Then update

sudo apt update && sudo apt full-upgrade

You can have a list of your installed kernels with following command:

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

In the output of the aforementioned command, note that "ii" means installed, "rc" means removed and "rH" means half removed, corrupted or the like.

You should always look which kernel is currently in use (uname -r) and never ever remove this one !!

Then you can remove your problematic kernel (here linux-image-4.18.0-17-generic):

sudo apt remove --purge linux-image-4.18.0-17-generic

And finally put grub script back into place.

sudo mv /etc/kernel/postrm.d/zz-update-grub.bad /etc/kernel/postrm.d/zz-update-grub
1
  • 1
    See this answer for the meaning of the two letters of the first column, in the output of dpkg -l
    – galath
    Sep 13, 2019 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.