The officially official Devuan Forum!

You are not logged in.

#1 2020-06-04 14:16:31

criminalscum
Member
Registered: 2020-06-04
Posts: 5  

Why apt still links to libsystemd0?

Hi.

So i wanted to look into apt source code to see why it links to libsystemd0 at runtime instead of having an option to detect systemd presence at compile time. I mean, it should't matter if it's detected at runtime or compile time, if systemd absence is detected at runtime, then it can't use it anyway, right? So when we're compiling apt we should be able to tell it beforehand that systemd isn't going to be there. This "runtime detection" of systemd to me seemed sketchy anyway.

To my surprise i've found define called `HAVE_SYSTEMD` already present in source code and since i don't have systemd installed on my system, after i compiled apt from source, apt-get doesn't link to libsystemd0 anymore.

I'm just asking, i'm not pushing anyone to make any changes, i just want to know why is it so, okay? From what i'm seeing in Git log, this define was added in 2019.

Does it link to libsystemd0 because apt in Devuan is build from older source code or is that because apt in Devuan is built on Debian that has systemd? Any plans to rebuild it w/o libsystemd0? This file seems to be installed by libelogind0 and i can't remove libelogind0 without removing apt.

I mean, i probably can rebuild it from source and install instead of upstream apt, and i probably should do that at some point, but replacing apt with custom build doesn't sound as a safe option to me, so i wanted to ask first.

Any ideas?

Offline

#2 2020-06-04 14:57:22

HevyDevy
Member
Registered: 2019-09-06
Posts: 263  

Re: Why apt still links to libsystemd0?

Hmm that is odd, i dont have libsystemd0 on my system but do have libelogind0.



:~$ apt depends libelogind0
libelogind0
  Depends: libc6 (>= 2.28)
  Depends: libcap2 (>= 1:2.10)
  Conflicts: libsystemd0
  Replaces: libsystemd0
    libelogind0

I run a pretty slimmed down system though, it has dbus and systemd disabled ( i believe) via apt preferences.
/etc/apt/preferences.d/nodbus

Package: dbus
Pin: release n=beowulf-security
Pin-Priority: -1


Package: dbus
Pin: release n=beowulf
Pin-Priority: -1

/etc/apt/preferences.d/nosystemd

Package: systemd
Pin: release n=beowulf
Pin-Priority: -1

When all the trees have been cut down, when all the animals have been hunted, when all the waters are polluted, when all the air is unsafe to breathe, only then will you discover you cannot eat money.
~ Cree Prophecy

Offline

#3 2020-06-04 15:10:48

criminalscum
Member
Registered: 2020-06-04
Posts: 5  

Re: Why apt still links to libsystemd0?

It's installed by libelogind0.

$ ldd $(which apt) | grep -i systemd
$ dpkg -S /usr/lib/x86_64-linux-gnu/libsystemd.so.0

Offline

#4 2020-06-04 15:15:07

HevyDevy
Member
Registered: 2019-09-06
Posts: 263  

Re: Why apt still links to libsystemd0?

criminalscum wrote:

It's installed by libelogind0.

$ ldd $(which apt) | grep -i systemd
$ dpkg -S /usr/lib/x86_64-linux-gnu/libsystemd.so.0

I see, i didnt have the correct commands for apt.

I dont think there is any way of getting around this as devuan is a fork of debian. I believe it would require a rewrite of the code and a massive downgrade of binaries in the repos.

This is why i like to play around with pure unix like openbsd and netbsd.

Last edited by HevyDevy (2020-06-04 15:17:24)


When all the trees have been cut down, when all the animals have been hunted, when all the waters are polluted, when all the air is unsafe to breathe, only then will you discover you cannot eat money.
~ Cree Prophecy

Offline

#5 2020-06-04 15:31:50

anticapitalista
Member
Registered: 2018-06-10
Posts: 12  

Re: Why apt still links to libsystemd0?

Isn't it a symbolic link to libelogind.so.0?

Offline

#6 2020-06-04 15:38:21

criminalscum
Member
Registered: 2020-06-04
Posts: 5  

Re: Why apt still links to libsystemd0?

HevyDevy wrote:

I dont think there is any way of getting around this as devuan is a fork of debian. I believe it would require a rewrite of the code and a massive downgrade of binaries in the repos.

No, it appears to be just a matter of recompiling apt with `HAVE_SYSTEMD` unset. It is unset when systemd isn't present. I have compiled apt from source code on Devuan (Beowulf) and apt doesn't link to libsystemd0 anymore.

You can try it yourself, source code is here: https://github.com/Debian/apt

You will need `triehash` somewhere in your path, utility itself is here: https://github.com/julian-klode/triehash, then `ln -sf /path/triehash.pl /otherpath/bin/triehash` and `/otherpath/bin` has to be in $PATH so cmake can see it when configuring apt build. The rest of the packages needed for build can be installed from Devuan repos.

Offline

#7 2020-06-04 15:41:24

golinux
Administrator
Registered: 2016-11-25
Posts: 1,951  

Re: Why apt still links to libsystemd0?

This problem is fixed in Chimaera and will be also in the Beowulf point release (coming soon) iirc

Offline

#8 2020-06-04 16:04:12

criminalscum
Member
Registered: 2020-06-04
Posts: 5  

Re: Why apt still links to libsystemd0?

Nice. Thank you.

Offline

#9 2020-06-04 22:14:15

pcalvert
Member
Registered: 2017-05-15
Posts: 75  

Re: Why apt still links to libsystemd0?

anticapitalista wrote:

Isn't it a symbolic link to libelogind.so.0?

Yes, you are correct.

Phil


“Property is the fruit of labor; property is desirable; it is a positive good
in the world. That some should be rich shows that others may become
rich, and hence is just encouragement to industry and enterprise.”
— Abraham Lincoln

Offline

#10 2020-06-04 22:24:22

pcalvert
Member
Registered: 2017-05-15
Posts: 75  

Re: Why apt still links to libsystemd0?

criminalscum wrote:

It's installed by libelogind0.

$ ldd $(which apt) | grep -i systemd
$ dpkg -S /usr/lib/x86_64-linux-gnu/libsystemd.so.0

That's not a problem. It's essentially a "fake" systemd component -- libelogind0 put that there because some software expects libsystemd0 to be present. The software "thinks" it's "talking" to libsystemd0, but it's really "talking" to libelogind0.


Phil


“Property is the fruit of labor; property is desirable; it is a positive good
in the world. That some should be rich shows that others may become
rich, and hence is just encouragement to industry and enterprise.”
— Abraham Lincoln

Offline

#11 2020-06-04 22:42:33

bgstack15
Member
Registered: 2018-02-04
Posts: 154  

Re: Why apt still links to libsystemd0?

I am concerned that apt has been modified to use systemd. Would anyone well-versed in the subject try to explain it to me? I will also at some point to try to look at the source, but if anybody could summarize, that would help everyone else out!


This space intentionally left blank.

Offline

#12 2020-06-04 23:07:41

pcalvert
Member
Registered: 2017-05-15
Posts: 75  

Re: Why apt still links to libsystemd0?

criminalscum wrote:

Does it link to libsystemd0 because apt in Devuan is build from older source code or is that because apt in Devuan is built on Debian that has systemd?

The apt package in Devuan comes directly from Debian; it is an unmodified Debian package.

Phil


“Property is the fruit of labor; property is desirable; it is a positive good
in the world. That some should be rich shows that others may become
rich, and hence is just encouragement to industry and enterprise.”
— Abraham Lincoln

Offline

#13 2020-06-05 00:13:38

sgage
Member
Registered: 2016-12-01
Posts: 230  

Re: Why apt still links to libsystemd0?

bgstack15 wrote:

I am concerned that apt has been modified to use systemd. Would anyone well-versed in the subject try to explain it to me? I will also at some point to try to look at the source, but if anybody could summarize, that would help everyone else out!

Apt has not been modified to use systemd. I have no trace of sysemd on my computer (running beowulf), not even libsystemd0, and apt works just fine. I really don't know what else to say.

Offline

#14 2020-06-05 09:50:33

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 761  
Website

Re: Why apt still links to libsystemd0?

bgstack15 wrote:

Would anyone well-versed in the subject try to explain it to me?

Not sure about "well versed" but I can tell you that the apt binary is linked to /lib/x86_64-linux-gnu/libsystemd.so.0 during compilation — this is because GNU/Linux uses dynamic linking.

In Devuan's case /lib/x86_64-linux-gnu/libsystemd.so.0 is symlinked to /usr/lib/x86_64-linux-gnu/libelogind.so.0 so at no point is systemd invoked in any way.

EDIT: better link.

Last edited by Head_on_a_Stick (2020-06-05 09:52:25)


"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher." — Antoine de Saint-Exupéry

Offline

#15 2020-06-05 12:17:52

bgstack15
Member
Registered: 2018-02-04
Posts: 154  

Re: Why apt still links to libsystemd0?

@Head_on_a_Stick, thank you! I know the term dynamic linking, but that page has more information than I'll be able to absorb for a long, long time! But specifically, would you know any of the motivations of the apt maintainers who made the choice to link apt to libsystemd0?


This space intentionally left blank.

Offline

#16 2020-06-05 16:37:29

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 761  
Website

Re: Why apt still links to libsystemd0?

bgstack15 wrote:

would you know any of the motivations of the apt maintainers who made the choice to link apt to libsystemd0?

No but I would hazard a guess that it is related to the systemd timers now supplied with the package (or perhaps the new sandboxing feature).


"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher." — Antoine de Saint-Exupéry

Offline

#17 2020-06-05 17:17:46

criminalscum
Member
Registered: 2020-06-04
Posts: 5  

Re: Why apt still links to libsystemd0?

Head_on_a_Stick wrote:
bgstack15 wrote:

would you know any of the motivations of the apt maintainers who made the choice to link apt to libsystemd0?

No but I would hazard a guess that it is related to the systemd timers now supplied with the package (or perhaps the new sandboxing feature).

They are attempting (not necessarily successfully) to prevent shutdowns/reboots while package manager is running, but that code depends on systemd-logind (or maybe elogind) and doesn't work if, for example, dbus isn't running or something else went wrong. Also i don't know how elogind is going to prevent shutdown/reboot if init system isn't systemd.

The code is here: https://github.com/Debian/apt/blob/cb60 … l.cc#L3444

Another thing they do with systemd is that they track if package manager was invoked in interactive mode/shell or not and include that info into HTTP requests to repo servers. That code is also completely depends on systemd and won't work if you are not running systemd.

https://github.com/Debian/apt/blob/cb60 … tp.cc#L981

Besides that i didn't find any more systemd call in apt.

Offline

#18 2020-06-05 17:21:28

larsH
Member
Registered: 2020-05-05
Posts: 81  

Re: Why apt still links to libsystemd0?

Hi

Devuan is based on Debian. The goal of Devuan is to be free of systemd in order to let people decide which init system to use. That is why libsystemd0 is an empty package. The other goal is to keep things simple (it means not to maintain to many packages). It is in the mind of the developers of apt (which of course is from debian and ubuntu) that the decisions of what apt should depend upon is taking place. I am sure you can find more information on debians apt-devel mailing list. It will be a lot of work with no practical benefit to remove the empty systemd0 package. If it easy to do without removing a lot of packages I am sure it was already done.

I hope this answer was helpfull

Have a nice day
Lars H

Online

#19 2020-06-05 18:11:16

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 761  
Website

Re: Why apt still links to libsystemd0?

criminalscum wrote:

They are attempting (not necessarily successfully) to prevent shutdowns/reboots while package manager is running

Ah, interesting. Thanks!

criminalscum wrote:

i don't know how elogind is going to prevent shutdown/reboot if init system isn't systemd

It probably won't. AFAIUI the developers have made the decision to stub out most of the (unwanted) extra functionality offered by systemd.


"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher." — Antoine de Saint-Exupéry

Offline

Board footer