1

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
  • 535
  • 2
  • What's happens when you run sudo apt remove libsystemd0? if it does not remove other packages, remove it then install it again like: sudo apt install libsystemd0=229-4ubuntu4. after that try installing libsystemd-dev using sudo apt install libsystemd-dev – Ravexina Apr 28 '17 at 18:46
  • Here is another thing, I think your sources.list got some issues, add the output of grep "^deb " /etc/apt/sources.list to your question before testing above command. – Ravexina Apr 28 '17 at 18:53
  • 1
    Did you run those commands ? If so and the error persists then it is a problem of dependencies and you will either need to re-write the package info or file a bug report. – Panther Apr 28 '17 at 19:00
  • @bodhi.zazen, yes I did. It didn't help – 0x90 Apr 28 '17 at 19:01
  • 1
    Then it is a problem with packaging and you will need to file a bug report against the -dev package – Panther Apr 28 '17 at 19:03
  • @0x90 Have you tried what I suggest? I guess it will fixes your issue ... – Ravexina Apr 28 '17 at 20:49
  • @Ravexina not yet, but it sounds right, though a bit risky. I don't want to upgrade distribution – 0x90 Apr 28 '17 at 20:49
  • @0x90 It does not upgrade your Ubuntu, it just updates you packages to last version to get the last bug fixes and security patches. that is what you should always do. at the end you still are running Ubuntu xenial 16.04. – Ravexina Apr 28 '17 at 21:28

3 Answers3

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
  • 55,668
  • 25
  • 164
  • 183
  • It is a dependency problem not a repository problem. See "http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages" – Panther Apr 28 '17 at 19:02
  • Check it's repositories, it does not have xenial-updates – Ravexina Apr 28 '17 at 19:04
  • @bodhi.zazen So it shouldn't work on my system too right? (I'm running xenial too), but my system is update and it works fine. his source is outdated. – Ravexina Apr 28 '17 at 19:10
  • IMO You should not need to enable the updates repository to fix problems in main. Although this might work, should file a bug report against the package in main. – Panther Apr 28 '17 at 19:12
  • So isn't release-update there to fix the Main issues? (PS: the other day I was reading your PDF on fstab, thanks. it was a good resource) – Ravexina Apr 28 '17 at 19:13
  • And as I know, release (xenial in this case) always is frozen after release date all updates and bug fixs will go on xenial-update they will not be applied in xenial. – Ravexina Apr 28 '17 at 19:14
  • Yes and no. Packages have a life cycle and main is the most stable. New updates are tested before they are added to main. – Panther Apr 28 '17 at 19:14
  • See https://help.ubuntu.com/community/Repositories , the primary repos are main, universe, multiverse, and restricted. The additional repos make packages available earlier , without as much testing, before they hit the primary repos. See https://help.ubuntu.com/community/Repositories#A_Quick.2C_Tongue-in-cheek_Description_of_the_Ubuntu_Repositories . So you may get packages earlier, but with bugs. At any rate, the package in main should not have this problem. – Panther Apr 28 '17 at 19:20
  • Glad you liked the fstab pdf. I have additional stuff on my website if you so desire. – Panther Apr 28 '17 at 19:20
  • I'm actually talking about this sections: xenial, xenial-updates and xenial-security. from my knowledge xenial is frozen so if there is a bug in any component of xenial say main or universe it will be applied at main component but in xenial-updates and OP does not have it enabled. I don't know if I'm wrong :/ – Ravexina Apr 28 '17 at 19:24
  • Yep got it from your website, bunch of cool stuff was there ;) will read them too :) – Ravexina Apr 28 '17 at 19:25
  • As I understand the process, updated packages are first placed in xenial-{security,updates} and after sufficient testing eventually placed in main. In general I have no problem with the security repo, but the updates repo has a slight chance of introducing both bugs as well as bug fixes, but I do not know the exact details of how packages move between the repos. – Panther Apr 28 '17 at 19:28
  • Mines comes from here. and from here it says release (in our case xenial) : during the development cycle, this is the only pocket that is used. Once the development version is released, the release pocket is frozen and does not change. – Ravexina Apr 28 '17 at 19:31
  • See https://wiki.ubuntu.com/StableReleaseUpdates and https://wiki.ubuntu.com/SecurityTeam/UpdateProcedures – Panther Apr 28 '17 at 19:36
  • I couldn't find anything related to packages being updated in main repository (release) or how procedure moves the packages between say xenial and `xenial-updates. – Ravexina Apr 28 '17 at 19:47
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,264
  • 56
  • 94
  • 147
0

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.