I am trying to examine the output from pstree
command. But for some reason it always starts from something called as systemd
as opposed to it being init. I have checked to see the process ID's of both init and systemd using ps aux
command and init has a PID of 1, while systemd has some other PID. So why isn't init being shown in my pstree's output? Is there an option that I need to give?
Also I did read about systemd vs init controversy, but ubuntu 16.04 LTS still uses init to start everything right?
Update as to why different PIDs?
It turns out that different PIDs that I thought were part of my ignorance. The init had a PID 1, whereas systemd wasn't the thing that I was talking about. Instead when I ran ps aux|grep systemd
, I found PIDs for /lib/systemd/systemd-*
, where *
means some extra characters. So what I was talking about was not systemd, but some other processes that were extensions(is it the correct word?) of systemd I guess.
Some of the examples for that *
are as follows
/lib/systemd/systemd-journald
/lib/systemd/systemd-udevd
/lib/systemd/systemd-timesyncd
Best Answer
Since 15.04, init on Ubuntu is systemd. It is possible to use Upstart, but the default is systemd. For example,
/sbin/init
will be a link to/lib/systemd/systemd
./sbin/{shutdown,reboot,telinit,halt,runlevel,poweroff}
are links to/sbin/systemctl
. Even in 16.04, Upstart was used as a session init, so you might see Upstart as the parent process or an ancestor process in your graphical login (though it seems to have changed in 16.10).The other processes you see are systemd components; they're developed and distributed along with systemd but many are not essential to running systemd as init. Many components can be replaced or disabled. To quote the systemd homepage:
And this blog post from one of the creators of systemd (Lennart Poettering):