[solved] cant remove linux-image-extra-4.13.0-45-generic

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
DylanBorn
Level 1
Level 1
Posts: 3
Joined: Fri Jul 20, 2018 2:11 pm

[solved] cant remove linux-image-extra-4.13.0-45-generic

Post by DylanBorn » Fri Jul 20, 2018 2:24 pm

Hi Guys

sorry if this was asked before and answered i cant find a reference to it in the forum.
i am new to mint moved from windows and recently discovered how to remove old kernels (via update manager), my problem is since i removed the old kernels, one of witch (linux-image-extra-4.13.0-45-generic) failed i can no longer install any apps via software manager or via apt-get install on terminal.

there is an operation failed message, details below.
installArchives() failed: (Reading database ...
(Reading database ... 5%%
(Reading database ... 10%%
(Reading database ... 15%%
(Reading database ... 20%%
(Reading database ... 25%%
(Reading database ... 30%%
(Reading database ... 35%%
(Reading database ... 40%%
(Reading database ... 45%%
(Reading database ... 50%%
(Reading database ... 55%%
(Reading database ... 60%%
(Reading database ... 65%%
(Reading database ... 70%%
(Reading database ... 75%%
(Reading database ... 80%%
(Reading database ... 85%%
(Reading database ... 90%%
(Reading database ... 95%%
(Reading database ... 100%%
(Reading database ... 348658 files and directories currently installed.)
Removing linux-image-extra-4.13.0-45-generic (4.13.0-45.50~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.13.0-45-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
Error! echo
Your kernel headers for kernel 4.13.0-45-generic cannot be found at
/lib/modules/4.13.0-45-generic/build or /lib/modules/4.13.0-45-generic/source.
Error! echo
Your kernel headers for kernel 4.13.0-45-generic cannot be found at
/lib/modules/4.13.0-45-generic/build or /lib/modules/4.13.0-45-generic/source.
Error! echo
Your kernel headers for kernel 4.13.0-45-generic cannot be found at
/lib/modules/4.13.0-45-generic/build or /lib/modules/4.13.0-45-generic/source.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-45-generic
WARNING: missing /lib/modules/4.13.0-45-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.13.0-45-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
Warning: No support for locale: en_ZA.utf8
depmod: WARNING: could not open /var/tmp/mkinitramfs_V6icXF/lib/modules/4.13.0-45-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_V6icXF/lib/modules/4.13.0-45-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
run-parts: executing /etc/kernel/postinst.d/zz-runlilo 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
Fatal: open /boot/vmlinuz-4.13.0-45-generic: No such file or directory
run-parts: /etc/kernel/postinst.d/zz-runlilo exited with return code 1
dpkg: error processing package linux-image-extra-4.13.0-45-generic (--remove):
installed linux-image-extra-4.13.0-45-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.13.0-45-generic
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Last edited by DylanBorn on Fri Jul 20, 2018 4:02 pm, edited 1 time in total.

DAMIEN1307
Level 6
Level 6
Posts: 1071
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico

Re: cant remove linux-image-extra-4.13.0-45-generic

Post by DAMIEN1307 » Fri Jul 20, 2018 3:08 pm

Kernel Cleanup after Deletion...

do these one at a time, dont worry if the first dpkg -l says error etc...just means nothing is there is all...

sudo apt autoremove

dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

dpkg -l | grep '^rc' | awk '{print $2}' | xargs sudo apt-get purge

dpkg --get-selections | grep linux-headers && dpkg --get-selections | grep linux-image

then reboot a couple of times...DAMIEN
ORDO AB CHAO

DylanBorn
Level 1
Level 1
Posts: 3
Joined: Fri Jul 20, 2018 2:11 pm

Re: cant remove linux-image-extra-4.13.0-45-generic

Post by DylanBorn » Fri Jul 20, 2018 3:17 pm

Thanks for the reply

ran the commands one by one and re-booted twice, didn't seem to help.

User avatar
Flemur
Level 16
Level 16
Posts: 6105
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: cant remove linux-image-extra-4.13.0-45-generic

Post by Flemur » Fri Jul 20, 2018 3:29 pm

DylanBorn wrote:
Fri Jul 20, 2018 3:17 pm
ran the commands one by one and re-booted twice, didn't seem to help.
It looks like the apt system thinks it's installed but the files are missing.

You might try reinstalling it (thru synaptic, search for '4.13.0-45' on the slow search, rt-click->reinstall), then purging it.

Unfortunately a 'kernel' is usually 3,4 or nowadays sometimes 5 packages, but searching on the version number has worked for me - if you see nemo or whatever with the same version, don't delete it. Click the 'S' in the left-most column of the package list to put the installed ones at the top.

But I (Mint 19) don't have that kernel available, so you might not either.

So if that doesn't work, try these:
http://www.iasptk.com/ubuntu-fix-broken ... -solution/

Basically:
After trying
sudo apt-get update –fix-missing

and
sudo dpkg –configure -a

and
sudo apt-get install -f

the problem of a broken package still exist the solution is to edit the dpkg status file manually.
$ sudo nano /var/lib/dpkg/status (you can use vim or gedit instead of nano)
Edit: I just now noticed that a kernel version number is written differently in different places, which is a big no-no:
4.15.0.29.31 in mintupdate and
4.15.0-29 and
4.15.0-29.31 in synaptic:
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

DylanBorn
Level 1
Level 1
Posts: 3
Joined: Fri Jul 20, 2018 2:11 pm

Re: cant remove linux-image-extra-4.13.0-45-generic

Post by DylanBorn » Fri Jul 20, 2018 4:02 pm

Thanks Flemur, the commands all gave errors so i went to the final fix, i managed to find 2 entries in the status file and removed them, rebooted and now i am once again able to install apps from software manager, thanks for the assistance :-P

Post Reply

Return to “Installation & Boot”