Problems Upgrading Ubuntu Server LTS

I’ve been doing some housekeeping and updating some of my Ubuntu servers from 16.04 to 18.04. At first the upgrade progresses fine, but then near the end, it stops when it’s trying to clean up old packages:

Searching for obsolete software
reading state information... 54%
=== Command detached from window (Mon Jun 1 12:00:00 2020) ===
=== Command terminated with exit status 1 (Mon Jun 1 12:00:10 2020) ===

Looking at the logs in /var/log/dist-upgrade/apt.log there were all sorts of errors about broken packages.

I also noticed that during the earlier stages of the upgrade there were numerous messages saying:

No candidate ver: <perl-modules>

So I rolled back to my pre-upgrade snapshot and started googling for checking installed packages. All the answers seemed to revolve around running the command “apt check” which always said everything was OK.

The best I could find was the command:

# dpkg -l | grep -v '^ii

which revealed a list of packages (which looked similar to both the “No candidate ver” messages and the broken packages messages in /var/log/dist-upgrade/apt.log.

Asking a friendly unix guru suggested that these packages, whilst not being installed, were still in the configuration and hadn’t been purged.

The clue about purging packages led me to and the command:

# apt purge `dpkg --list | grep ^rc | awk '{ print $2; }'`

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: