5

I am running a server that has been recently upgraded-in-place to 18.04 / Bionic, from 16.04 / Xenial.

During the upgrade, when it came time to ask me if I wanted to remove the obsolete packages, I didn't get a chance to state my intent either way, because when I went to look at the list - and I was keying directly into the server, not using SSH - the keyboard and my state in the upgrade process decided to have a divorce. I couldn't get back to any kind of menu and so I just rebooted and hoped 18.04 would come up. It looked like it did (and it proclaims "Welcome to Ubuntu 18.04.5 LTS" when you sign into it), and as far as the things the server needs to do to earn its keep, it is still doing them. But apt is still looking for Xenial updates instead of Bionic updates.

(I previously asked the question Apt upgrade error: distro-info-data breaks distro-info about distro-info-data breaking distro-info, but it seems like that was just a symptom of this much larger problem.)

Running grep "^deb\ " -r /etc/apt/ --include=*.list produces:

/etc/apt/sources.list.d/certbot-ubuntu-certbot-xenial.list:deb http://ppa.launchpad.net/certbot/certbot/ubuntu xenial main
/etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.list:deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial main restricted
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial universe
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial-updates universe
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial multiverse
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
/etc/apt/sources.list:deb http://ca.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security main restricted
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security multiverse

What can I put into apt to make it look to the Bionic repositories instead of the Xenial ones?

1 Answers1

5

Basically, I followed the answer given here: https://askubuntu.com/a/1230743/870100

Just replaced 'xenial' with 'bionic' inside the 3 files, did the apt update / upgrade / dist-upgrade / autoremove / autoclean cycle, then rebooted, and miraculously everything worked. Even the php is now on the proper 18.04 packages, even though I didn't bother changing the list filenames for certbot or ondrej.

sudo sed -i "s/xenial/bionic/" /etc/apt/sources.list.d/certbot-ubuntu-xenial.list
sudo sed -i "s/xenial/bionic/" /etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.list
sudo sed -i "s/xenial/bionic/" /etc/apt/sources.list
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo shutdown -r now

Hopefully won't have to revisit this in two years when it's time to move to Focal. I had half a mind to go Xenial -> Bionic -> Focal in rapid succession but I now think it makes much more sense to actually work out the kinks in the following LTS first before introducing further complications by going to the next one after.

  • This generally worked for me. I had a couple of different files in /etc/apt/sources.list.d and didn't run sed on them. I deleted them instead and re-added the PPAs for them, since I wasn't sure if their contents would still be meaningful when modified. – Eric Hu Oct 13 '21 at 08:52