Systemd
systemd
journalctl
/etc/systemd/journald.conf
journalctl -u SERVICE
- previous boots dmesg log
journalctl -k -b -1
- coredumpctl
sysctl
net.ipv4.icmp_echo_ignore_all = 1
in /etc/sysctl.conf
or /etc/sysctl.d/90-override.conf
to disable icmp
systemctl
- services
edit
doesn't require daemon-reload
- hooks within services like
ExecStartPost/ExecStopPost
- list
systemctl list-unit-files
- list failed
systemctl list-units --state failed
- deps
systemctl list-dependencies --reverse
- mask with
systemctl mask swap.target
- remote management with ssh
systemctl --host=user@somesuchhost.com status SERVICE.unit
- restart interval with
RestartSec=5
- cron like with a
service.timer
containing a schedule like OnCalendar=Sunday *-*-* 4:00:00
and a service with the Type=oneshot
timedatectl
- systemd-timesyncd
timedatectl set-ntp true
set-local-rtc
to set hardware clock to localtime instead of UTC
NetworkManager
/usr/lib/NetworkManager/conf.d/20-connectivity.conf
pings out
- conflicts with
systemd-networkd
- configure for dnsmasq with
[main] dns=dnsmasq
resolvectl
- dns cache
- issue with long running process? Several weeks of uptime and lockup of dns request despite ping working…
resolvectl statistics
and resolvectl status
/etc/systemd/resolved.conf
- enable
systemd-resolved
and start
DNSStubListener
listens on 127.0.0.53 127.0.0.1.54 for udp/tcp port 53
ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
- alternatively configure NetworkManager with
[main] dns=systemd-resolved
- for local dnsmasq set to no, add dnsmasq/localhost to DNS servers
- may require
bind-interfaces
for dnsmasq config (binds 127.0.0.1 port 53)
misc
systemd-analyze blame
for boot times
systemd-analyze security my-service.unit
for sec settings
systemctl --user status
for services in $HOME/.config/systemd/user/
systemctl set-default
or isolate
with runlevels/targets rescue
, multi-user
and graphical
- rate limited restart will disable units with
Restart=on-failure
without StartLimitIntervalSec=0