Bootstrap FreeKB - Linux Fundamentals - Understanding init, sysvinit, upstart, and systemd
Linux Fundamentals - Understanding init, sysvinit, upstart, and systemd

Updated:   |  Linux Fundamentals articles

Some of the most popular Linux system initialization daemons are:

  • init
  • systemd
  • upstart 

 

The system initialization daemon will use PID 1. In this example, systemd has PID 1.

[john.doe@server1 ]# ps -e
 PID  TTY        TIME  CMD
   1  ?      00:00:02  systemd
   2  ?      00:00:00  kthreadd
   3  ?      00:00:01  ksoftirqd/0
   . . .

 


service vs. systemctl

Probably the most obvious different between init and systemd is that init uses the services command to start, stop, and restart services, and systemd uses the systemctl command to start, stop, and restart services. For example, to restart the httpd service on an init system, the following command would be used.

[user1@server1 ]# service httpd restart

 

To restart the httpd service on an init sytem, the following command would be used.

[user1@server1 ]# systemctl restart httpd

 


chkconfig vs. systemctl

Another noteworthy difference is that init uses the chkconfig command to configure a service to be enabled or disabled on boot, and systemd uses the systemctl command. For example, to ensure the httpd service is turned on on an init system, the following command would be used:

[user1@server1 ]# chkconfig httpd on

 

To enable the httpd service on a systemd system, the following command would be used.

[user1@server1 ]# systemctl enable httpd

 


Runlevel vs. systemctl

Another important different is that init uses the /etc/inittab file to set the runlevel of the system.

With systemd, you use the following command to determine if the system is in text-only mode or graphical mode.

multi-user.target is text-only.

[root@server1]# systemctl get-default
multi-user.target

 

graphical.target is graphical mode.

[root@server1]# systemctl get-default
graphical.target

 

The following command can be used to set the runlevel to either multi-user.target or graphical.target.

[root@server1]# systemctl set-default multi-user.target
[root@server1]# systemctl set-default graphical.target



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 277a2f in the box below so that we can be sure you are a human.