meta data for this page
This is an old revision of the document!
start/ stop
systemctl daemon-reload
systemctl start servicename
info/status
# systemctl get-default
multi-user.target
systemd-analyze critical-chain
systemctl --failed
DefaultDependencies
Value for unit DefaultDependencies is set to yes by default. it will add following dependencies:
- Conflicts=shutdown.target to stop service during shutdown
- Conflicts=umount.target to umount mounts durign shutdown
- Requires=basic.target and After=basic.target
emergency mode
Prevent services from running
If services are defined with DefaultDependencies=no, they will be started unconditionally even in emergency mode, wchich can be wrong.
If mount fails
local-fs.target is configured to go to OnFailure=emergency.target. File /etc/fstab is parsed by systemd-fstab-generator to generate .mount units, which are Required.
To let mounts fail without switching to emergency mode, special attribute are introduced to fstab. http://www.freedesktop.org/software/systemd/man/systemd.mount.html
Debug
Kernel commandline:
systemd.unit=emergency
systemd.log_level=debug systemd.log_target=console console=ttyS0,38400
Start service when MMC card is inserted
Create directory “dev-mmcblk0.device.wants” and put symlink to service inside it. List of devices:
systemctl --all --full -t device
Unit Types
- .service plain service - for running daemons
- .socket socket listeners - like inetd
- .device
- .path filesystem triggers (when file is changed)
- .mount
- .automount
- .swap
- .target
- .timer
- .snapshot
- .slice
- .scope
[Unit]
- Requisite - similar to require, but if not met, service will be not started (fail immediately). Usefull to perform action when removable device is inserted.
- Requisite=!local-fs.target
- BindsTo - similar to require, but also declares to stop unit when other units dissapers (aslo nice for removable devices handling)
- After - start service after other services are started completely.
[Service]
- Nice=-20
- IOSchedulingClass=0
- IOSchedulingPriority=0
- StandardOutput=tty |none | journal+console