to list what processes will be start on boot. As seen below:
[root@localhost ~]# chkconfig
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
iprdump 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprinit 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprupdate 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
tomcat 0:off 1:off 2:off 3:off 4:off 5:off 6:off
That's odd, something has changed. For your information, sysV has been replaced in favor of systemd and today we are going to learn what is systemd is. So what is systemd ?
systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux cgroups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. It can work as a drop-in replacement for sysvinit.
That is a very lengthy definition. If you are still not so sure, perhaps take a moment to watch a video here.
![](http://noflex.org/wp-content/uploads/2014/09/Linux_kernel_unified_hierarchy_cgroups_and_systemd.svg_-1024x640.png)
Because there are a lot of documentations in the google to explain what is systemd in details, but this article will target busy people who need the solution right now. As such, if you want more details solutions, you should google or read a few helpful links below.
- http://en.wikipedia.org/wiki/Systemd
- https://fedoraproject.org/wiki/Systemd
- https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
- https://www.linux.com/learn/tutorials/527639-managing-services-on-linux-with-systemd
So why replace sysV with systemd? What have been improved?
Lennart Poettering and Kay Sievers, the software engineers who initially developed systemd,[1] sought to surpass the efficiency of the init daemon in several ways. They wanted to improve the software framework for expressing dependencies; to allow more processing to be done concurrently or in parallel during system booting; and to reduce the computational overhead of the shell.
Systemd's initialization instructions for each daemon are recorded in a declarative configuration file rather than a shell script. For inter-process communication, systemd makes Unix domain sockets and D-Bus available to the running daemons. Systemd is also capable of aggressive parallelization.
There are several tools to manage systemd.
- systemctl:
used to introspect and control the state of the systemd system and service manager - systemd-cgls:
recursively shows the contents of the selected Linux control group hierarchy in a tree - systemadm:
a graphical frontend for the systemd system and service manager that allows introspection and control of systemd. Part of the systemd-gtk package. This is an early version and needs more work. Do not use it for now unless you are a developer.
Below are a table to summarize what you usually done in chkconfig and in systemd, what command you can use as a replacement.
Sysvinit Command | Systemd Command | Notes |
---|---|---|
service frobozz start | systemctl start frobozz.service | Used to start a service (not reboot persistent) |
service frobozz stop | systemctl stop frobozz.service | Used to stop a service (not reboot persistent) |
service frobozz restart | systemctl restart frobozz.service | Used to stop and then start a service |
service frobozz reload | systemctl reload frobozz.service | When supported, reloads the config file without interrupting pending operations. |
service frobozz condrestart | systemctl condrestart frobozz.service | Restarts if the service is already running. |
service frobozz status | systemctl status frobozz.service | Tells whether a service is currently running. |
ls /etc/rc.d/init.d/ | systemctl list-unit-files -- type=service (preferred)ls /lib/systemd/system/*.service /etc/systemd/system/*.service | Used to list the services that can be started or stopped Used to list all the services and other units |
chkconfig frobozz on | systemctl enable frobozz.service | Turn the service on, for start at next boot, or other trigger. |
chkconfig frobozz off | systemctl disable frobozz.service | Turn the service off for the next reboot, or any other trigger. |
chkconfig frobozz | systemctl is-enabled frobozz.service | Used to check whether a service is configured to start or not in the current environment. |
chkconfig -- list | systemctl list-unit-files -- type=service(preferred)ls /etc/systemd/system/*.wants/ | Print a table of services that lists which runlevels each is configured on or off |
chkconfig frobozz -- list | ls /etc/systemd/system/*.wants/frobozz.service | Used to list what levels this service is configured on or off |
chkconfig frobozz -- add | systemctl daemon-reload | Used when you create a new service file or modify any configuration |
Runlevels/targets
Systemd has a concept of targets which serve a similar purpose as runlevels but act a little different. Each target is named instead of numbered and is intended to serve a specific purpose.
Sysvinit Runlevel | Systemd Target | Notes |
---|---|---|
0 | runlevel0.target, poweroff.target | Halt the system. |
1, s, single | runlevel1.target, rescue.target | Single user mode. |
2, 4 | runlevel2.target, runlevel4.target, multi-user.target | User-defined/Site-specific runlevels. By default, identical to 3. |
3 | runlevel3.target, multi-user.target | Multi-user, non-graphical. Users can usually login via multiple consoles or via the network. |
5 | runlevel5.target, graphical.target | Multi-user, graphical. Usually has all the services of runlevel 3 plus a graphical login. |
6 | runlevel6.target, reboot.target | Reboot |
emergency | emergency.target | Emergency shell |
Below are a summarize the command you will (hopefully) use.
- systemctl isolate multi-user.target
To change the target/runlevel, to switch to runlevel 3 - systemctl set-default <name of target>.target
graphical.target is the default. You might want multi-user.target for the equivalent of non graphical (runlevel 3) from sysv init. - systemctl get-default
to show the currentl target/runlevel
Note, there are several changes you should keep in mind.
* systemd does not use /etc/inittab file.
* change number of gettys in /etc/systemd/logind.conf
* unit files are now store in /usr/lib/systemd/system/
That's it, I hope you get a basic understanding and will be able to start using systemd.