I want to install libsystemd
headers, but I can't.
output of apt-cache policy systemd
:
# apt-cache policy systemd
systemd:
Installed: 229-4ubuntu13
Candidate: 229-4ubuntu13
Version table:
*** 229-4ubuntu13 100
100 /var/lib/dpkg/status
229-4ubuntu4 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Here is the output of apt-cache policy libsystemd0
:
# apt-cache policy libsystemd0
libsystemd0:
Installed: 229-4ubuntu13
Candidate: 229-4ubuntu13
Version table:
*** 229-4ubuntu13 100
100 /var/lib/dpkg/status
229-4ubuntu4 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Here is what happens when I do apt-get install libsystemd-dev
:
# apt-get install libsystemd0 libsystemd-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsystemd0 is already the newest version (229-4ubuntu13).
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:
libsystemd-dev : Depends: libsystemd0 (= 229-4ubuntu4) but 229-4ubuntu13 is to be installed
E: Unable to correct problems, you have held broken packages.
Ouput of grep "^deb " /etc/apt/sources.list
# grep "^deb " /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb http://download.virtualbox.org/virtualbox/debian xenial contrib
Your source file is incomplete, get a backup from it:
then open it using nano:
Add these lines into it:
Then run:
after that try installing your desired package.
If you still got problem then first try upgrading your system:
or fixing dependencies, if there is any:
I have no idea how you got version 229-4ubuntu13 of the systemd libraries with these package sources. The only version in Xenial "release" is 229-4ubuntu4. There are newer versions in "security" (229-4ubuntu10) and "updates" (229-4ubuntu17) which don't match yours either.
You can either roll back to the packages in the "release" repository or enable the "updates" repository and upgrade the packages on your system.
Roll back
If you know all the systemd packages installed on your system you can use the following command:
If you don't know them you can use the following command to parse package descriptions and the list of installed packages to select and install them for you:
Upgrade
Enable the "updates" repository.
Open Software Properties, navigate to the Updates tab and enable the checkbox for Recommended updates.
Update the package list and perform a system upgrade:
For me I manually searched for libsystemd in apt cache using
sudo apt search libsystemd
which returned libsystemd-dev which is libsystemd development files, libsystemd0 which are utility libraries for systemd and lua-systemd which are system bindings for lua. I then installed them usingsudo apt install libsystemd0 libsystemd-dev
. I didn't include lua-systemd since I don't really understand why or if I needed it. After that I did not get the same error I was getting ( "Unable to find a matching distribution for libsystemd and libsystemd-dev") when I ranpip3 install -r requirements.txt
Hope this helps someone.