Systemd

From FedoraProject

Revision as of 21:10, 8 February 2011 by Sundaram (Talk | contribs)

Jump to: navigation, search

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.

Contents

What is the status of systemd in Fedora?

Fedora 14 featured it is a technology preview. It is the default in Fedora 15 and has replaced Upstart.

Has all legacy System V init files been converted to systemd service files or equivalent?

Many of the core services have been converted but not all of them yet. The transition will happen over several releases. systemd is fully compatible with the legacy init scripts

What is the tool to manage services with systemd?

systemctl is the primary tool to use. It combines the functionality of both service and chkconfig into a single tool that you can use for instance to enable/disable services permanently or only for the current session.

systemctl - list all running services etc

systemctl disable foo.service - Disables a service to not start during bootup systemctl enable foo.serice - Enables a service to be started on bootup

systemctl start foo.service - Activates a service immediately systemctl stop foo.service - Deactivates a service immediately systemctl restart foo.service - Restarts a service systemctl status foo.service - Shows status of a service including whether it is running or not

Refer to man systemctl for more details. systemd-cgls lists the running process in a tree format. It can recursively show the content of any given control group. Refer to man systemd-cgls for more details.

How do I change the runlevel?

systemd has the concept of targets which is a more flexible replacement for runlevels in sysvinit.

Run level 3 is emulated by multi-user.target. Run level 5 is emulated by graphical.target. runlevel3.target is a symbolic link to multi-user.target and runlevel5.target is a symbolic link to graphical.target

You can switch to 'runlevel 3' by running

 systemctl isolate multi-user.target (or) systemctl isolate runlevel3.target 

You can switch to 'runlevel 5' by running

 systemctl isolate graphical.target (or) systemctl isolate runlevel5.target 

How do I change the default runlevel?

Switch to runlevel 3 by default

 ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 

Switch to runlevel 5 by default

 ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target 

systemd does not use /etc/inittab file.

How do I know the current run level?

runlevel command still works with systemd. You can continue using that however runlevels is a legacy concept in systemd and is emulated via 'targets' and multiple targets can be active at the same time. So the equivalent in systemd terms is

 systemctl list-units --type=target 

Does service command work with systemd?

Yes. It has been modified to call systemctl automatically when dealing with systemd service files. So either of the following commaands does the same thing

 service NetworkManager stop 

(or)

 systemctl stop NetworkManager.service 

Does chkconfig command work with systemd?

chkconfig has not been modified to call systemctl yet however that is the plan. systemctl however automatically calls chkconfig when dealing with a traditional sysv init file

Does system-config-services work with systemd?

system-config-services does not understand systemd service files yet. It needs to be updated or replaced

How do I change the number of gettys running by default ?

To add another getty:

Simply place another symlink for instantiating another getty in the getty.target.wants/ directory:

ln -sf /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty9.service
systemctl daemon-reload
systemctl start getty@tty9.service

To remove a getty:

Simply remove the getty symlinks you want to get rid of in the getty.target.wants/ directory:

rm /etc/systemd/system/getty.target.wants/getty@tty5.service /etc/systemd/system/getty.target.wants/getty@tty6.service
systemctl daemon-reload
systemctl stop getty@tty5.service getty@tty6.service

systemd does not use /etc/inittab file.

= References =h