1

I tried to install systemd-container on brand new ubuntu 20.04 but I have following message:

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.

But it's not obvious how to fix it because when I try, getting this

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.

And so one till 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.

And at this point, we got a circle.

EDIT: found that I can

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

And it's working but I got dependency errors all the time.

Is there any better workaround?

EDIT 2:

apt-cache output

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

EDIT 3:

Quick way to reproduce error on 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.

Best

  • Sounds like your apt system has dependancy issues can occur for a number of reasons..

    Start with a apt update

    – Simon Banks Mar 22 '21 at 10:17
  • Followed by a

    apt-get update --fix-missing

    – Simon Banks Mar 22 '21 at 10:18
  • All packages are updated, problem occurs because ubuntu 20 comes with newer wersion of systemd that is required. See package-link – Adam Krawczyk Mar 22 '21 at 10:22
  • It's not because everytime I install something or upgrade I got following message You might want to run 'apt --fix-broken install' to correct these (unmet dependecies) – Adam Krawczyk Mar 22 '21 at 12:25
  • @N0rbert Thank you for posting this, but the problem is different. I got the correct repositories and apt tries to download the correct package version but this correct version is not matching the system installed packages - you can see on the package-link I've sent before that package version is the newest from the ubuntu repo. Even though it's the newest installed systemd is newer than needed and can't be downgraded. – Adam Krawczyk Mar 23 '21 at 09:01
  • 1
    Please show the output of apt-cache policy systemd systemd-container . The correct version of both is 245.4-4ubuntu3.5. – N0rbert Mar 23 '21 at 12:24
  • @ElderGeek It's not the case of correcting problems, I posted edit 3 for understand core of problem. – Adam Krawczyk Mar 24 '21 at 08:02
  • @AdamKrawczyk My apologies if I misinterpreted your post. Pleas edit in the output of dpkg -l | grep ^..r – Elder Geek Mar 24 '21 at 11:40
  • No problem @ElderGeek I'm thankful for your activity. Unfortunately no package is matching regex dpkg -l | grep ^..r. – Adam Krawczyk Mar 24 '21 at 12:59
  • @AdamKrawczyk please [edit] and add the output of grep /etc/apt/sources.list focal and the output of ls -a /etc/apt/sources.list.d – Elder Geek Mar 27 '21 at 13:28

1 Answers1

1

After reviewing your edits, I did some digging and below is the relevant part of what I found in the Packages.gz file at http://pl.archive.ubuntu.com/ubuntu/dists/focal/main/binary-amd64/ by tracing your output from your apt-cache output. As mentioned by N0rbert in the comments, It appears that the repository you are using has out of date versions of the packages that you require as seen below. You can find the up to date versions in the focal-updates repository here. I highly recommend you replace the pl.archive.ubuntu.com repository that you are using with the default repository from the Main server or the US archive both of which appear to be up to date. See this answer. There's a great related Q&A regarding the different sources here.

Package: systemd
Architecture: amd64
Version: 245.4-4ubuntu3
Multi-Arch: foreign
Priority: important
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
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 <ubuntu-devel-discuss@lists.ubuntu.com> Original-Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org> 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

Elder Geek
  • 36,023
  • 25
  • 98
  • 183