Detecting the init system in use

Jonathon Fernyhough jonathon at manjaro.org
Wed Dec 13 18:12:27 UTC 2017


On 13/12/17 17:57, Robie Basak wrote:
> 2) Come up with and agree on some other universal way for testing for
> systemd and make that work everywhere. Then we can SRU that test to MAAS
> in Trusty, and fix any other packages in Trusty affected by the
> behaviour change of the original test.

Possibly too simplistic, but,

On a 14.04 system:

$ file /sbin/init
/sbin/init: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=7a4c688d009fc1f06ffc692f5f42ab09e68582b2, stripped

On a 16.04 system:

$ file /sbin/init
/sbin/init: symbolic link to /lib/systemd/systemd


Other "pure-systemd" systems (e.g. Arch) use a symlink similar to 16.04
so this should work with later Ubuntu releases too:

$ file /sbin/init
/sbin/init: symbolic link to ../lib/systemd/systemd


J

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20171213/603abe0d/attachment.sig>


More information about the ubuntu-devel mailing list