How do I clear the apt-get remove list?
5,176
Solution 1
I was able to solve the issue by removing the entries in /var/lib/dpkg/status
which had a status of half-installed.
Solution 2
Run the following commands and please post any errors:
EDIT
sudo apt-get clean
sudo rm /var/cache/apt/archives/partial/*
sudo dpkg --clear-selections
sudo apt-get install --reinstall linux-image-extra-3.13.0-61-generic linux-image-3.13.0-61-generic
EDIT#2
Okay, for the error (E: /usr/share/initramfs-tools/hooks/fixrtc
), first try setting this file as executable and retry the installation:
sudo chmod -x /usr/share/initramfs-tools/hooks/fixrtc
sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall linux-image-extra-3.13.0-61-generic linux-image-3.13.0-61-generic
Related videos on Youtube
Author by
Brian Gradin
Updated on September 18, 2022Comments
-
Brian Gradin almost 2 years
apt-get upgrade
shows that a package is supposed to be removed:gradinafrica@host:~$ sudo apt-get upgrade [sudo] password for gradinafrica: Reading package lists... Done Building dependency tree... Done Calculating upgrade... Done The following packages will be REMOVED: linux-image-extra-3.13.0-61-generic 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 152 MB disk space will be freed. Do you want to continue? [Y/n] n Abort.
This package is never removed, and I don't think it needs to be. How can I get
apt-get
to stop trying to remove it?EDIT:
Output of
sudo apt-get -y upgrade
:Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be REMOVED: linux-image-extra-3.13.0-61-generic 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 152 MB disk space will be freed. (Reading database ... 35514 files and directories currently installed.) Removing linux-image-extra-3.13.0-61-generic (3.13.0-61.100) ... depmod: FATAL: could not load /boot/System.map-3.13.0-61-generic: No such file or directory run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic update-initramfs: Generating /boot/initrd.img-3.13.0-61-generic grep: /boot/config-3.13.0-61-generic: No such file or directory WARNING: missing /lib/modules/3.13.0-61-generic Device driver support needs thus be built-in linux image! depmod: ERROR: could not open directory /lib/modules/3.13.0-61-generic: No such file or directory depmod: FATAL: could not search modules: No such file or directory E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 1. update-initramfs: failed for /boot/initrd.img-3.13.0-61-generic with 1. run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 dpkg: error processing package linux-image-extra-3.13.0-61-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-image-extra-3.13.0-61-generic E: Sub-process /usr/bin/dpkg returned an error code (1)
EDIT 2:
Downloaded the 64-bit package for linux-image-3.13.0-61-generic and tried to install it using
sudo dpkg -i linux-image-3.13.0-61-generic_3.13.0-61.100_amd64.deb
:(Reading database ... 40337 files and directories currently installed.) Preparing to unpack linux-image-3.13.0-61-generic_3.13.0-61.100_amd64.deb ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.) debconf: falling back to frontend: Readline Done. Unpacking linux-image-3.13.0-61-generic (3.13.0-61.100) over (3.13.0-61.100) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic Setting up linux-image-3.13.0-61-generic (3.13.0-61.100) ... Running depmod. update-initramfs: deferring update (hook will be called later) The link /initrd.img is a dangling linkto /boot/initrd.img-3.13.0-61-generic vmlinuz(/boot/vmlinuz-3.13.0-61-generic ) points to /boot/vmlinuz-3.13.0-61-generic (/boot/vmlinuz-3.13.0-61-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-3.13.0-61-generic.postinst line 491. Examining /etc/kernel/postinst.d. run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic update-initramfs: Generating /boot/initrd.img-3.13.0-61-generic E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 1. update-initramfs: failed for /boot/initrd.img-3.13.0-61-generic with 1. run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.13.0-61-generic.postinst line 1025. dpkg: error processing package linux-image-3.13.0-61-generic (--install): subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: linux-image-3.13.0-61-generic
-
mchid almost 9 yearsplease select Y and post the subsequent errors so we can see exactly why it's not uninstalling or installing, thanks!
-
Brian Gradin almost 9 yearsAdded those details to the post
-
Brian Gradin almost 9 yearsTried to install the package it keeps failing on using the technique which solved my other post, but got nowhere. I posted the output above.
-
-
Bacon almost 9 yearsThe OP wants to know if they can be hidden from the apt-get upgrade output
-
mchid almost 9 yearsjust thought I'd mention a circumstance where they would be removed
-
Bacon almost 9 yearsYou should include that in your answer then :-)
-
mchid almost 9 yearsi don't think it will help here because the output shows 0 not upgraded, although i did consider it because a kernel version like the one shown would definitely be something a dist-upgrade would try to uninstall if something like linux-image-generic is upgraded.
-
jarno over 8 yearsMaybe the packages are still half-installed there, but package management does not know about it anymore. Usually it is better to
apt-get install --reinstall
the half-installed packages and after successful installation,apt-get purge
for the packages to remove them completely. -
jarno over 8 years
sudo dpkg --clear-selections
might be dangerous.man dpkg
tells: "Set the requested state of every non-essential package to deinstall (since dpkg 1.13.18). This is intended to be used immediately before --set-selections, to deinstall any packages not in list given to --set-selections." I suppose runningsudo apt-get dselect-upgrade
after if will remove many packages, that you probably don't want to happen.