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

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

我正在更新一台之前有点废弃的机器,需要对其软件包进行大规模更新。该机器是 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)

正如你所看到的,还有很多软件包需要更新,但我坚持使用这个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"

答案1

作为斯蒂芬·基特评论中提到,您似乎尝试将系统从 Ubuntu 14.04 升级到 Debian 测试。那是行不通的。线索就在 shell 输出的这一行中:

    Get:1 http://http.us.debian.org/debian testing/main amd64 systemd amd64 232-19 [2466 kB]

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

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

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

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

它是可能的将包管理器配置更改回 Ubuntu 设置并执行apt-get dist-upgrade可能会使系统恢复到可用状态,但再次这样做也可能会让事情变得更糟。 Debian 测试目前不仅可能会发布比任何当前 Ubuntu 版本(更不用说 14.04)更新的软件包版本,而且软件包版本升级也可能会进行诸如重写配置文件之类的操作。我并不是说这不可能就地修复,但我几乎可以肯定,这会带来比其价值更多的麻烦。而且,无意冒犯,但如果你掉进了这个陷阱,我怀疑你是否能够在不使用任何东西的情况下摆脱它。重要的手持。在这种情况下,呼叫直升机救援是更好的选择。

相关内容