I've created a Rubygem to help with removing old kernels that have built up over years and are eating disk space. (My laptop had 19 kernels on it alone, and on a small SSD...)
I want to use apt-get or dpkg as the uninstaller since some people will not have aptitude installed and I do not want users of the gem to have to install anything.
The problem comes when some users do use
aptitude for other things. Scenario:
- User uses my gem which successfully
apt-get purge's the kernel packages.
- User starts
aptitudein interactive mode for any reason,
- User presses the 'g' key (Download/Install/Remove Pkgs) immediately without marking any changes, -->
aptitudere-downloads and re-installs the packages that
Currently, the gem uses
apt-get purge <packages> to purge the kernel packages. (Seen here.)
I also tried with
dpkg --purge <packages>, but the result is the same, aptitude still wants to reinstall them.
I've read through the entire
aptitude manual and googled many things, no dice.
Maybe I could programmatically manage
aptitude's marked/unmarked packages list if I could find where it is (although I'd prefer a cleaner solution.) I assume it's not
/var/lib/dpkg/status or else there would be no disparity?
dpkg-query shows the package
Not and the
desired state as
deKernel$ dpkg-query -l linux-image-3.2.0-39-generic Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-==========================================-==========================================-==================================================================================================== un linux-image-3.2.0-39-generic <none> (no description available) deKernel$
It's possible to go into aptitude and manually un-mark those kernel packages and the problem disappears, however this is obviously quite impractical.