3

I know that my Linux installation comes with one of the service manager implementations. It could be either Systemd, Upstart, or any of the others.

So, my question is how can I find out which one of those is installed on my Linux system?

Thanks.

UPDATE

Here are some ps/grep commands from my system searching for systemd and upstart, and their outputs:

$ ps aux | grep systemd
root       341  0.0  0.0  52244  3836 ?        Ss   15:54   0:00 /lib/systemd/systemd-udevd --daemon
root       588  0.0  0.0  43452  3200 ?        Ss   15:54   0:00 /lib/systemd/systemd-logind
root      1889  0.0  0.0  17520  1840 ?        S    15:54   0:00 /lib/systemd/systemd-localed
user123      2348  0.0  0.0  15948  2236 pts/1    S+   15:56   0:00 grep --color=auto systemd
$ ps aux | grep upstart
root       329  0.0  0.0  19744  2308 ?        S    15:54   0:00 upstart-udev-bridge --daemon
root       763  0.0  0.0  15808  2168 ?        S    15:54   0:00 upstart-file-bridge --daemon
root       770  0.0  0.0  15528  1984 ?        S    15:54   0:00 upstart-socket-bridge --daemon
user123      1525  0.0  0.0  22304  2336 ?        Ss   15:54   0:00 upstart-event-bridge
user123      1553  0.0  0.0  22368  1828 ?        S    15:54   0:00 upstart-dbus-bridge --daemon --session --user --bus-name session
user123      1560  0.0  0.0  30784   280 ?        S    15:54   0:00 upstart-file-bridge --daemon --user
user123      1562  0.0  0.0  22312   216 ?        S    15:54   0:00 upstart-dbus-bridge --daemon --system --user --bus-name system
user123      2350  0.0  0.0  15948  2280 pts/1    S+   15:56   0:00 grep --color=auto upstart

2 Answers2

3

Easiest way is to work out what OS and see what it runs by default. init systems are not trivial to change.

On a completely unknown system I'd suggest using use a mix of ps and grep to check for common processes related to each init system and see..

I don't have a system that uses the 'classic' init script system so I have no way to check.

On a modern fedora or ubuntu box - you can use ps aux | grep systemd, which should emit lines like usr/lib/systemd/systemd. It also stores configuration files in etc/systemd/

You would also use systemctl to handle services

On an upstart based system you can do ps aux | grep upstart and find a few upstart related processes.

Upstart uses the service command and it stores config files in /etc/init/ just like a classic init file. It uses its own format, saved as .conf files - though some of these are classic init files.

You do often use sysv style init scripts alongside more modern ones, but I don't have any systems using purely that to check on those. If you're writing a init script for an unknown system, this is typically a safe bet, though you lose out on the shiny things that newer init systems add.

Journeyman Geek
  • 133,878
0

On Debian based linux distributions :

$ dpkg -S $(which init)
systemd-sysv: /sbin/init

On Redhat based linux distributions :

$ rpm -qf $(which init)
upstart-0.6.5-16.el6.x86_64

to be completed...

SebMa
  • 2,035