Systemd
From DWIKI
Documentation
- Useful systemd commands
- http://www.freedesktop.org/wiki/Software/systemd/
- https://wiki.ubuntu.com/systemd
- Creating systemd service
- https://wiki.ubuntu.com/SystemdForUpstartUsers
- How To Use Systemctl to Manage Systemd Services and Units
- How to switch from NetworkManager to systemd-networkd on Linux
- https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
- Predictable Network Interface Names
- [https://blog.darknedgy.net/technology/2020/05/02/0/index.html#tech-critique
- Systemd service tutorial
- https://www.freedesktop.org/wiki/Software/systemd/dbus/ Systemd and dbus
- Single user/emergency
Locations
/etc/systemd /usr/lib/systemd/ /lib/systemd
HOWTO
Timers
man systemd.timer
List active timers
systemctl list-timers
List all timers
systemctl list-timers --all
Create timer
systemctl enable fstrim.timer
Auto restart crashed services
systemctl edit elasticsearch.service
add:
[Service] Restart=always
then
systemctl daemon-reload systemctl restart elasticsearch.service
FAQ
Fix journal size
journalctl --vacuum-time=10d
or
journalctl --vacuum-size=1G
Journal settings
/etc/systemd/journald.conf
SystemMaxUse=1G
and then
systemctl restart systemd-journald.service
Analyze boot processes
systemd-analyze blame
Systemd and DNS
resolvectl status
Failed to get global data: Unit dbus-org.freedesktop.resolve1.service not found.
Means systemd-resolved is not running
Restart:
systemctl restart systemd-resolved
Add nameserver
Sacrifice a chicken
Flush caches
systemd-resolve --flush-caches
All status
systemctl status -a
syslog spam
list available services
systemctl list-unit-files
or
systemctl list-units
normal interface names
net.ifnames=0
Show failed services
systemctl --failed
systemd: Started Session
Change loglevel to notice in /etc/systemd/system.conf
systemctl daemon-reexec
Status
Active: inactive (dead)
parameter ActiveState would return inactive
SubState returns dead