从 16.04 升级到 18.04 导致 systemd 损坏

从 16.04 升级到 18.04 导致 systemd 损坏

从 16.04 升级到 18.04 后,最后出现以下消息:

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

To continue please press [ENTER]

按下 [ENTER]

现在,当我执行 apt update / apt upgrade 时,我收到以下消息:

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

正在尋找:https://packages.ubuntu.com/bionic/libs/ 无论如何,它显示 18.04 版 libsystemd0 的以下内容。所以我不确定为什么系统认为依赖项应该是 229-4ubuntu21.31。

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

在 apt upgrade 的最后还显示:

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

当我运行这个时我得到:

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!'

显然发生了一些非常可怕的事情。

我在这里有点力不从心,希望得到一些指导/后续步骤。

谢谢


添加:按 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

按照 NOrbert 的要求,进行了编辑以包含指向 Pastebin 的链接:@NOrbert 请注意,这些是在 16.04 恢复后立即获取的。即,它们代表任何版本升级之前的 16.04 状态。

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

apt-cache 策略 https://pastebin.com/q8S47v1e

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

答案1

您有libsystemd0来自的较新版本也许在某处. 要降级,请使用以下命令:

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

然后安装升级到 16.04 LTS

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

为了有好的工具来解决将来可能出现的问题,请安装 Aptitude

sudo apt-get install aptitude

然后重新启动并像往常一样启动系统升级程序至 18.04 LTS。

相关内容