无法安装 systemd-container ubuntu 20.04

无法安装 systemd-container ubuntu 20.04

我尝试在全新的 ubuntu 20.04 上安装 systemd-container 但出现以下消息:

sudo apt-get install systemd-container
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 systemd-container : Depends: systemd (= 245.4-4ubuntu3)
E: Unable to correct problems, you have held broken packages.

但如何解决这个问题并不明显,因为当我尝试时,得到这个

sudo apt install systemd=245.4-4ubuntu3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 policykit-1 : Depends: libpam-systemd but it is not going to be installed
 systemd : Depends: libsystemd0 (= 245.4-4ubuntu3) but 245.4-4ubuntu3.2 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

直到 libpam-systemd

sudo apt install libpam-systemd=245.4-4ubuntu3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpam-systemd : Depends: systemd (= 245.4-4ubuntu3)
E: Unable to correct problems, you have held broken packages.

此时,我们得到了一个圆圈。

编辑:发现我可以

$ sudo apt download systemd-container 
$ sudo dpkg --force-all -i systemd-container_245.4-4ubuntu3_amd64.deb 

它可以运行,但我总是收到依赖性错误。

有没有更好的解决方法?

编辑2:

apt-cache 输出

apt-cache policy systemd systemd-container
systemd:
  Installed: 245.4-4ubuntu3.2
  Candidate: 245.4-4ubuntu3.2
  Version table:
 *** 245.4-4ubuntu3.2 100
        100 /var/lib/dpkg/status
     245.4-4ubuntu3 500
        500 http://pl.archive.ubuntu.com/ubuntu focal/main amd64 Packages
systemd-container:
  Installed: (none)
  Candidate: 245.4-4ubuntu3
  Version table:
     245.4-4ubuntu3 500
        500 http://pl.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

编辑3:

在 ubuntu 20.04 上快速重现错误的方法:

adam@adam:~/$ systemd-nspawn

Command 'systemd-nspawn' not found, but can be installed with:

sudo apt install systemd-container

adam@adam:~/$ sudo apt install systemd-container
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 systemd-container : Depends: systemd (= 245.4-4ubuntu3)
E: Unable to correct problems, you have held broken packages.

最好的

答案1

在查看您的编辑后,我进行了一些挖掘,以下是我在 Packages.gz 文件中发现的相关部分http://pl.archive.ubuntu.com/ubuntu/dists/focal/main/binary-amd64/通过跟踪 apt-cache 的输出。正如所提到的诺伯特在评论中,您使用的存储库似乎包含您需要的软件包的过时版本,如下所示。您可以在 focal-updates 存储库中找到最新版本这里。我强烈建议您将使用的 pl.archive.ubuntu.com 存储库替换为主服务器或美国档案库中的默认存储库,这两个存储库似乎都是最新的。请参阅这个答案。关于不同来源的问答非常精彩这里。

Package: systemd
Architecture: amd64
Version: 245.4-4ubuntu3
Multi-Arch: foreign
Priority: important
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian systemd Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 15084
Pre-Depends: libblkid1 (>= 2.24), libc6 (>= 2.30), libgcrypt20 (>= 1.8.0), liblz4-1 (>= 0.0~r122), liblzma5 (>= 5.1.1alpha+20120614), libselinux1 (>= 2.1.9)
Depends: libacl1 (>= 2.2.23), libapparmor1 (>= 2.9.0-3+exp2), libaudit1 (>= 1:2.2.1), libcap2 (>= 1:2.24-9~), libcrypt1 (>= 1:4.4.0), libcryptsetup12 (>= 2:2.0.1), libgnutls30 (>= 3.6.12), libgpg-error0 (>= 1.14), libidn2-0 (>= 2.0.0), libip4tc2 (>= 1.8.3), libkmod2 (>= 5~), liblz4-1 (>= 0.0~r130), libmount1 (>= 2.30), libpam0g (>= 0.99.7.1), libpcre2-8-0 (>= 10.22), libseccomp2 (>= 2.4.1), libsystemd0 (= 245.4-4ubuntu3), systemd-timesyncd | time-daemon, util-linux (>= 2.27.1), mount (>= 2.26), adduser
Recommends: dbus, networkd-dispatcher
Suggests: systemd-container, policykit-1
Conflicts: consolekit, libpam-ck-connector, systemd-shim, upstart
Breaks: python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18), systemd-shim (<< 10-4~)
Filename: pool/main/s/systemd/systemd_245.4-4ubuntu3_amd64.deb
Size: 3795776
MD5sum: 2529c1980daa1f26dab931b1b739f196
SHA1: 29a79ae4edee4964ac34ddba0fd0a47c2c4a49d0
SHA256: f081921d83e6378aee0576a1e3f1339a35c9302c46fc501b087cd762145597d8
Homepage: https://www.freedesktop.org/wiki/Software/systemd
Description: system and service manager
Task: minimal, ubuntu-core
Description-md5: 19399579cbc0c47a303288bf15eadcd4

Package: systemd-container
Architecture: amd64
Version: 245.4-4ubuntu3
Multi-Arch: foreign
Priority: optional
Section: admin
Source: systemd
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian systemd Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1191
Depends: libacl1 (>= 2.2.23), libbz2-1.0, libc6 (>= 2.28), libcurl3-gnutls (>= 7.16.3), libgcrypt20 (>= 1.8.0), liblzma5 (>= 5.1.1alpha+20120614), libseccomp2 (>= 2.3.1), libselinux1 (>= 2.1.9), systemd (= 245.4-4ubuntu3), zlib1g (>= 1:1.1.4), dbus
Recommends: libnss-mymachines
Filename: pool/main/s/systemd/systemd-container_245.4-4ubuntu3_amd64.deb
Size: 317240
MD5sum: f67b429ff0cf3fb51bfdd18c2785b445
SHA1: 0eb815d5050e8c25c635f33870d72b5ae9357dbb
SHA256: 54ce1e0c2d1ea5d43db6f5a02b9f5b3731d9e1c2c653ee2c835aae89b899a664
Homepage: https://www.freedesktop.org/wiki/Software/systemd
Description: systemd container/nspawn tools
Description-md5: 06057fffc2ba14e4be80360a092a18b4

相关内容