在 Ubuntu 上进行大规模更新后出现 dpkg 错误

Car*_*tte 0 ubuntu apt systemd

我正在更新一台以前有点废弃的机器,需要对其软件包进行大量更新。该机器是 Ubuntu,在进行 apt 更新/升级后,出现以下错误:

carpette@carpette:~$ sudo apt clean
carpette@carpette:~$ sudo apt autoremove
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     libpam-systemd : Depends: systemd (= 232-19)
     plymouth : Depends: systemd (>= 232-8~)
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
carpette@carpette:~$ sudo apt --fix-broken install
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Correcting dependencies... Done
    The following additional packages will be installed:
      systemd
    Suggested packages:
      systemd-ui systemd-container
    The following NEW packages will be installed:
      systemd
    0 upgraded, 1 newly installed, 0 to remove and 461 not upgraded.
    56 not fully installed or removed.
    Need to get 2466 kB of archives.
    After this operation, 9564 kB of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Get:1 http://http.us.debian.org/debian testing/main amd64 systemd amd64 232-19 [2466 kB]
    Fetched 2466 kB in 1s (2170 kB/s) 
    (Reading database ... 61585 files and directories currently installed.)
    Preparing to unpack .../systemd_232-19_amd64.deb ...
    Unpacking systemd (232-19) ...
    dpkg: error processing archive /var/cache/apt/archives/systemd_232-19_amd64.deb (--unpack):
     trying to overwrite '/bin/loginctl', which is also in package systemd-services 204-5ubuntu20.24
    dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    Errors were encountered while processing:
     /var/cache/apt/archives/systemd_232-19_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

如您所见,仍有很多软件包需要更新,但我坚持使用这个systemd软件包。我真的不想安装它,我不知道是否有必要获取它,我只想更新机器,以便将其更新为最新版本。

本机目前运行apache2守护进程,mysql,用于多个小型网站。我可以在维护期间关闭它们(如果不是太长的话)

实际上,这是机器的描述:

carpette@carpette:~$ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=14.04
    DISTRIB_CODENAME=trusty
    DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"
Run Code Online (Sandbox Code Playgroud)

use*_*ser 5

正如Stephen Kitt在评论中提到的,您似乎试图将系统从 Ubuntu 14.04 升级到 Debian 测试版。那是行不通的。线索就在你的 shell 输出的这一行中:

    Get:1 http://http.us.debian.org/debian testing/main amd64 systemd amd64 232-19 [2466 kB]
Run Code Online (Sandbox Code Playgroud)

看到http.us.debian.org那里了吗?那不是 Ubuntu 存储库位置。systemd是系统的绝对核心包之一。无论你试图做什么,这都是一个明显的迹象,表明你所做的事情是错误的。

我的猜测是您在 Ubuntu 系统的包管理器配置中添加了一个 Debian 存储库,然后尝试隐式或显式执行“升级”。

您的系统目前很可能处于 Debian 和 Ubuntu 之间的某种混合状态。我敢猜测,如果关闭或重新启动,它不太可能重新启动,至少在没有大修的情况下不会。

虽然 Ubuntu 和 Debian 都使用 Linux 内核,并且都使用类似的软件包,但不支持将系统从一个就地升级到另一个系统(我犹豫是否称之为升级)。此时您最好的选择是从该系统中获取重要文件并迁移到安装了您首选 Linux 发行版的新系统。

这是可能的,改变包管理器配置恢复到Ubuntu的安装和执行apt-get dist-upgrade可能将系统恢复到可用状态,但再这样做也可能只是使事情变得更糟。Debian 测试目前不仅可能发布比任何当前 Ubuntu 版本(更不用说 14.04)更新的软件包版本,而且软件包版本升级也可能完成了诸如重写配置文件之类的事情。我并不是说这不可能就地修复,但我说它几乎肯定会比它的价值要麻烦得多。而且,无意冒犯,但如果你落入这个陷阱,我怀疑你是否能够在没有重大影响的牵手。在这种情况下,呼叫直升机救援是更好的选择。