Repair a Damaged Package System after Ubuntu Dist-Upgrade

Happy new year.

My blog runs on a VM at Hetzner with an Ubuntu LTS system. That means 5 years of support… I was running trusty from 2014, so there should be support until 2019. But not every open source software has given you this promise, just the Ubuntanians. So, support for Owncloud run out last year and I thought that the days between years are a good time to switch to a new version.

Hence, I did two dist-upgrades after another from trusty to xenial and from xenial to the current LTS version bionic (every 2 years a new LTS version is coming out). The first upgrade was “successful” with a lot of need for adaption in the configurations afterwards. Then after everything worked again, I did another upgrade, which failed because of this issue.

You do not want your system showing you such a message during do-release-update.

That is, I had to fix a distro upgrade that failed in between… challenge accepted 🤓.

Of course, I had a backup, but my feelings said, that this issue will follow me again and again, if I just retry the upgrade. The solution in the page mentioned above did work. After that I checked, whether the upgrade seemed good so far:

lsb_release -a
cat /etc/issue
cat -n /etc/apt/sources.list

The answers said to me: you are bionic captain. So, I followed the advice of Bashing-om:

sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get -f install
sudo dpkg --configure -a

Everything seemed to run well… but. There was one package kept back although I did a dist-upgrade: phpmyadmin. You perhaps know this behavior from apt, if you have kernel updates. Then you just say sudo apt install <packages hold back> and everybody is happy…

But this time it said:

$ sudo apt install phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
phpmyadmin : Depends: php
             Recommends: php-bz2
E: Unable to correct problems, you have held broken packages.

I tried to install php. It said, that it has to install php-7.2, but it won’t. The funny thing was, that php-7.2 has already been installed!

Long Story Short: The Issue

During upgrade, the system deactivates your additional repositories (PPAs) and does not reactivate them afterwards. I thought, that this is no problem, since I added the repository for packages (e.g. php-7.2), that haven’t been available in trusty, but are in xenial and bionic. So, I did not reactivate the PPAs. Unfortunately, the packages installed from that PPA misbehaved now.

What I did to Solve this Issue

I reactivated the additional sources of the PPAs in /etc/apt/sources.list.d/ (by removing the comment character). I updated and upgraded the system and did a dist-upgrade. Then I removed the PPAs via the corresponding command (as described here):

sudo add-apt-repository --remove ppa:PPA_REPOSITORY_NAME/PPA-NAME

Last but not least, I commented out the additional sources in the sources.list.d-files and did an sudo apt update.

Now, everything works like a charm again… Exciting 🤓.

Leave a Reply

Your email address will not be published.