2

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
0x90
  • 543

3 Answers3

1

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 using sudo 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 ran pip3 install -r requirements.txt Hope this helps someone.

1

Your source file is incomplete, get a backup from it:

sudo cp /etc/apt/sources.list{,.my-bk}

then open it using nano:

sudo nano /etc/apt/sources.list

Add these lines into it:

deb http://archive.ubuntu.com/ubuntu/ xenial main universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main universe multiverse
deb http://download.virtualbox.org/virtualbox/debian xenial contrib

Then run:

sudo apt update

after that try installing your desired package.

If you still got problem then first try upgrading your system:

sudo apt dist-upgrade

or fixing dependencies, if there is any:

sudo apt install -f
Ravexina
  • 57,256
1

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:

    sudo apt-get install {<PACKAGE>,<PACKAGE>,...}=229-4ubuntu4
    
  • 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:

    apt-cache showsrc systemd |
    sed -nre '/^Package-List:/,/^\S/{s/^ (\S+) .*$/\1/p;}' | sort -u |
    xargs dpkg-query -Wf '${Status;1} ${Package}\n' 2>&- |
    sed -nre 's/^i (\S+)$/\1=229-4ubuntu4/p' |
    xargs sudo apt install
    

Upgrade

  1. Enable the "updates" repository.

    Open Software Properties, navigate to the Updates tab and enable the checkbox for Recommended updates.

    software properties screenshot

  2. Update the package list and perform a system upgrade:

    sudo apt update && sudo apt full-upgrade
    
David Foerster
  • 36,890
  • 56
  • 97
  • 151