Ubuntu – How to “rebuild” or “repair” APTD

aptupgrade

How do I "rebuild" or "repair" aptd?

I don't mean up the various utilities to rebuild and reconfigure which has not solved my problem suggesting that something more fundamental is damaged. I am looking for a totally fresh and clean replace/rebuild with all old cache etc cleaned out as not knowing what I need to fix I am hoping this more aggressive approach will simply wash away the fault.

If aptd came on a disk as int he old days I would uninstall and reinstall at this stage. As it is (as far as I know) the process for doing that I don't know what to do.

Background

The problem I am trying to solve with this question may have been triggered during the upgrade process itself.

A huge apt log file from failed upgrade – what went wrong & how do I fix it?

I figured out how to shut down aptd and apt-get and get my CPU back but this does not address the underlying problem that aptd is actually damaged. I think if I can do this that the problem will be addressed.

Help: “aptd” is maxing out my CPU?

I should point out that the most complicated thing I compiled and ran a make file for was no more complex than "hello world". I may need baby steps.

Best Answer

The answer (that I needed) appeared to be that maybe aptd was fine but the /boot area was a bit too full - fixing this was the "repair" that was needed. I discovered this quite by accident while browsing related questions (and their related questions).

However what I originally thought was that APTD was corrupted and needed to be purged and rebuilt. It's a whole other debate as to if this is even an answer to the wider question that I asked.

What I did

Removed the old config files which, according to an answer here (My /boot partition hit 100% and now I can't upgrade. Can't remove old kernels to make room) is safe to do.

I also tried sudo dpkg -r linux-image-2.* which just seemed to be recursive and broken in some way that was beyond me. Killed it with control+C.

Switched to synaptic package manager and uninstalled a few older kernels. Then tried to get the out of date packages to update. It has been awhile since apt-get has been able to do anything so I felt this was something that needed to be done ASAP.

This had the effect of locking up synaptic and I had to terminate it it with killall -9.

Then a comment on my question about this (Is it safe to remove old vmlinuz.* files from /boot) led me to How do I remove old kernel versions to clean up the boot menu? and this command:

sudo apt-get remove --purge $(dpkg -l 'linux-image-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')

This cleaned up just shy of 3MB of disk space.

I then ran sudo apt-get upgrade which started the upgrade of 1260 packages. Needing about a Gig of archives.

Then I waited.

The next day I came back to it to see that it was waiting for me to respond to a prompt regarding gnome config. I chose the default option.

That completed successfully. I then did a clean, update and clean (because I am a newbi) and did sudo apt-get upgrade again and installed 3 more upgrades.

TL;DR: I think I needed to remove old kernels... that seemed to work.