nikal
Posts: 7
Joined: Sat Mar 29, 2014 2:51 pm

Systemd installed and running but not as PID 1

Thu Oct 13, 2016 1:48 pm

Hi,

I have recently upgraded my rpi3 to jessie and and along with it I decided to use the so much hyped systemd. I did all the necessary steps and it seems that my system is running now with systemd BUT the PID 1 still belongs to sysvinit

Code: Select all

root@rpi:~# pidof /sbin/init && echo "sysvinit" || echo "other"
1109 1106 1
sysvinit
What's wrong ? Can anyone help me ?

Thanks in advance for your time

FlexibleSigmoid
Posts: 61
Joined: Sun Jul 03, 2016 1:33 am

Re: Systemd installed and running but not as PID 1

Thu Oct 13, 2016 10:33 pm

Sure that code is right? Seems to me that you are always going to `echo "sysvinit"`. (You're saying IF pidof returns true then echo "sysvinit" else echo "other". `pidof /sbin/init` is always going to return 0 as it's exit value.)

Edit: Try

Code: Select all

stat /sbin/init
You may just find that its a link to /lib/systemd/systemd

User avatar
DougieLawson
Posts: 39183
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Systemd installed and running but not as PID 1

Sat Oct 15, 2016 12:49 pm

It is a link to /lib/systemd/systemd

Why not use pidof /lib/systemd/systemd (since there's a second task running that). That won't exist on an ancient Wheezy system running sysvinit.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Raspberry Pi OS”