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
Start with a apt update
– Simon Banks Mar 22 '21 at 10:17apt-get update --fix-missing
– Simon Banks Mar 22 '21 at 10:18You might want to run 'apt --fix-broken install' to correct these
(unmet dependecies) – Adam Krawczyk Mar 22 '21 at 12:25apt-cache policy systemd systemd-container
. The correct version of both is 245.4-4ubuntu3.5. – N0rbert Mar 23 '21 at 12:24dpkg -l | grep ^..r
– Elder Geek Mar 24 '21 at 11:40dpkg -l | grep ^..r
. – Adam Krawczyk Mar 24 '21 at 12:59grep /etc/apt/sources.list focal
and the output ofls -a /etc/apt/sources.list.d
– Elder Geek Mar 27 '21 at 13:28