Ubuntu – A huge apt log file from failed upgrade – what went wrong & how to fix it

12.04aptloggingupgrade

When attempting to upgrade from the 12.04 to a newer LTS it seemed to hang for ages (a good day or two) on "preparing for upgrade" and then the whole system started to suffer. Eventually I rebooted and found that starting was not going to happen due to the HDD being full. It turned out that the upgrade folder had a file called apt.log which was 166GB in size.

I removed it which fixed the not booting problem.

Clearly this is something not working correctly but more importantly (from my perspective): How can I make sure that this does not happen again and, therefore, actually upgrade.

Update

One of the side effects of this failure was aptd ate all my CPU: Help: “aptd” is maxing out my CPU? I have that under control now but I still do not know what went wrong.

Best Answer

Apparently there might have been too many kernels in /boot solving this problem (as documented in my answer here: how do I "rebuild" or "repair" APTD?) appears to have gotten to the bottom of things.