Score:3

Upgrade from 16.04 to 18.04 has broken systemd

ca flag

After upgrading from 16.04 to 18.04 right at the end it gave the following message:

The upgrade has completed but there were errors during the upgrade 
process. 

To continue please press [ENTER]

pressed [ENTER]

Now when I do apt update / apt upgrade I get the following message:

The following packages have unmet dependencies:
 systemd : Depends: libsystemd0 (= 229-4ubuntu21.31) but 237-3ubuntu10.48 is installed

Looking in : https://packages.ubuntu.com/bionic/libs/ It shows the following for libsystemd0 for 18.04 anyway. So I'm not sure why the system believes the dependency should be 229-4ubuntu21.31.

libsystemd0 (237-3ubuntu10.38 [amd64, i386], 237-3ubuntu10 [arm64, armhf, ppc64el, s390x]) [security]
    systemd utility library

At the end of apt upgrade it also says:

You might want to run 'apt-get -f install' to correct these.

When I run this I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  cgmanager libargon2-0 libcryptsetup12 libgd3 libip4tc0 libjson-c3 libkadm5clnt-mit9 libluajit-5.1-2 libluajit-5.1-common libvpx3 libxpm4 nginx-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  upstart
Suggested packages:
  graphviz upstart-monitor
The following packages will be REMOVED:
  init libpam-systemd systemd systemd-shim systemd-sysv ubuntu-standard
The following NEW packages will be installed:
  upstart
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  init systemd-sysv (due to init)
0 upgraded, 1 newly installed, 6 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/392 kB of archives.
After this operation, 18.1 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'

Clearly something quite horrible has happened.

I'm a bit out of my depth here and would appreciate some guidance/next steps.

Thanks


Adding : Output as requested by NOrbert

nexargi@server-02:~$ apt-cache policy systemd libsystemd0 init systemd-sysv
systemd:
  Installed: 229-4ubuntu21.31
  Candidate: 229-4ubuntu21.31
  Version table:
 *** 229-4ubuntu21.31 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     229-4ubuntu21.27 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     229-4ubuntu4 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
libsystemd0:
  Installed: 237-3ubuntu10.48
  Candidate: 237-3ubuntu10.48
  Version table:
 *** 237-3ubuntu10.48 100
        100 /var/lib/dpkg/status
     229-4ubuntu21.31 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     229-4ubuntu21.27 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     229-4ubuntu4 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
init:
  Installed: 1.29ubuntu4
  Candidate: 1.29ubuntu4
  Version table:
 *** 1.29ubuntu4 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.29ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
systemd-sysv:
  Installed: 229-4ubuntu21.31
  Candidate: 229-4ubuntu21.31
  Version table:
 *** 229-4ubuntu21.31 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     229-4ubuntu21.27 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     229-4ubuntu4 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Edited to include links to Pastebin as requested by NOrbert: @NOrbert please note that these were taken immediately after 16.04 was restored. i.e. They represent 16.04 state BEFORE any release-upgrade.

grep -r ^deb /etc/apt --include=*.list https://pastebin.com/85qJeYws

apt-cache policy https://pastebin.com/q8S47v1e

dpkg -l https://pastebin.com/Zp999iuF

Nmath avatar
ng flag
You may need to reinstall since you waited a bit too long to assume a successful upgrade. 16.04 went EOL in April.
ca flag
Looking through xenial's (16.04) packages on Launchpad it requires libsystemd0 (229-4ubuntu21.31). So although the upgrade did happen from 16.04 to 18.04 for some reason a part of systemd still seems to be stuck as xenial.
Nmath avatar
ng flag
The problem seems to be that dependencies are broken because you have a newer version installed than was required when the upgrade path was still valid. You could try to force an older version, but it's only going to cause more problems. This looks like "dependency hell"
ca flag
@Nmath you say: 'he problem seems to be that dependencies are broken because you have a newer version installed than was required when the upgrade path was still valid' What exactly do you mean by 'when the upgrade path was still valid'? If it was valid then then surely it must still be valid now?
Nmath avatar
ng flag
When 16.04 went EOL April 30, 2021 at which point support ended. This included the end of support for the upgrade path from 16.04 to 18.04. Ubuntu LTS releases are supported for 5 years and it is strongly encouraged to upgrade to a supported release before the software is no longer supported. At that point, the upgrade path has been available for three years. It is possible from the errors you are getting is that the currently installed package versions on your system aren't supported.
Nmath avatar
ng flag
[Questions about how to upgrade from an old, unsupported release are on topic](https://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-an-old-unsupported-release) so maybe this problem can be dissected further without going depper into dependency hell. But in most cases like this, it's better to just install the desired version, especially since you have encountered a road block.
N0rbert avatar
zw flag
Upgrade is still possible, @Nmath, do not confuse OP. Purvez, please add the output of `apt-cache policy systemd libsystemd0 init systemd-sysv` command to the question.
ca flag
@N0rbert thanks very much for your assistance. I've updated the question with the output that you requested.
Nmath avatar
ng flag
@N0rbert Of course it's *probably* still possible, but how many hours has OP spent on this at this point, and is it really the best path, when setting up a new installation takes all of 30 minutes?
ca flag
@Nmath you are missing the point here. Yes building a new empty server is easy. However then installing ALL the s/w needed to run the apps on the server is where the nightmare lies. I would much prefer to upgrade than try and recreate all the different bits of the s/w stack on a clean empty server.
Nmath avatar
ng flag
Where are your backups? Nothing takes as long to set up as you've already spent here trying to fix problem(s) that were avoidable with proper backups/documentation and timely system maintenance.
ca flag
@Nmath what sort of backups are you suggesting would allow an existing set of apps to be uploaded on to a brand new server with an UPGRADED operating system version. You must live in cloud cuckoo land.
Nmath avatar
ng flag
The majority of server applications and databases have user friendly backup and restore functions. For those that don't, there are config files. If it is cuckoo to advise that you should keep good backups and keep your software updated before it falls out of support, then I don't have anything else that could suggest to help you.
Score:0
zw flag

You have newer version of libsystemd0 from maybe somewhere. For its downgrade use command below:

sudo apt-get install libsystemd0=229-4ubuntu21.31

and then install upgrades to 16.04 LTS by

sudo apt-get update
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get dist-upgrade # to get newer dependencies

To have a good tool for future possible problems install Aptitude by

sudo apt-get install aptitude

Then reboot and launch system upgrade procedure to 18.04 LTS as usual.

ca flag
@NOrbert thanks for the info. However the system is currently upgraded to 18.04 although bits of systemd appear to be stuck on 16.04. Currently when I log in to the server this is what I see: <see next comment>
ca flag
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.4.0-210-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. New release '20.04.2 LTS' available. Run 'do-release-upgrade' to upgrade to it.
N0rbert avatar
zw flag
Then I can't understand it. You have provided info in last edit https://askubuntu.com/posts/1347966/revisions which clearly states that you have *xenial* (16.04 LTS) repositories on *server-02* host.
ca flag
@NOrbert. Yes that's the bit that I'm not understanding either. I have the ability to revert back to 16.04 again. I think I'll do that and then try the full upgrade process again. Perhaps I did something wrong the first time. In any case thanks very much for your input and willingness to help.
ca flag
@NOrbert I reverted back to 16.04 and ran through the whole process again...with unfortunately same results. I'm trying to find if there is a log for do-release-upgrade so that I can see what is going wrong. Please would you be able to tell me the location of such a log?
N0rbert avatar
zw flag
Such logs are usually located at `/var/log/dist-upgrade/`.
ca flag
@NOrbert I did look there but there were only logs from 2017 when I upgraded from 14.04 to 16.04. It occurs to me that 16.04 whilst appearing to be working may not be in a fully stable state. If I restore back to 16.04 what should I be running to catch any broken packages. Would it be apt install -f ? Alternately is there a way of checking for the stability of 16.04?
N0rbert avatar
zw flag
It is difficult to understand why it happens. I ran many upgrades from 16.04 to 18.04 without critical issues. You have to determine the origin of installed packages. Commands like `aptitude search ~o` may shed some light on the situation. Also you can share the output of `grep -r ^deb /etc/apt --include=*.list`, `apt-cache policy` and `dpkg -l` to pastebin for further analysis.
ca flag
@NOrbert I have included links to pastebin for the 3 outputs within the body of the question at the end. Would it help to move the discussion to chat as is being suggested by the system? I've never used chat before at askubuntu so not sure whether it's the right thing to do.
N0rbert avatar
zw flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/126883/discussion-between-n0rbert-and-purvez).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.