Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
    • Ubuntu
    • LTSP
    • HowTo
    • BASH
    • Backtrack
    • CUPS
    • CentOS
    • Debian
    • FreeNX
    • GRML
    • Gnome
    • Grub
    • IpFire
    • Kernel
    • Linux Lite
    • SSH
    • UEFI
    • dban
    • logrotate
    • parted
    • proxy
    • systemd
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid
  • systemd

journalctl
http://www.panticz.de/journalctl

Services

# list services
service  --status-all
systemctl list-units --type service --state running,failed

# enable service
systemctl enable service_name
sudo systemctl enable --now service_name

# disable service
systemctl disable service_name

systemctl status mariadb.service

journalctl -f
systemd-analyze verify 

systemd-analyze critical-chain
systemctl list-units
systemctl list-unit-files --type=service

# override / edit job
systemctl edit cron.service
# systemd/system/cron.service.d/override.conf

# list reboots
journalctl --list-boots

# list dhcp client logs
sudo journalctl --since "7 days ago" -u dnsmasq-dhcp
sudo journalctl --since "7 days ago" | grep -i dhcp

# suspend system
sleep 10m && systemctl suspend

# Fix slow SSH login
systemctl restart systemd-logind

# restart user service
systemctl --user restart pulseaudio.service

# list all service names
systemctl list-units -t service --state active --no-pager --full --plain --no-legend "ceph*" | awk '/ceph-/ {print $1}'

Example
[embed_url: https://raw.githubusercontent.com/panticz/preseed/master/late_command.service]

# test
[Unit]
After=getty.target

[Service]
TTYPath=/dev/tty1

# test
journalctl -xn
systemctl list-unit-files --all

Disable systemd-resolved service

sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved

# disable systemd-resolve
sed -i 's/DNSStubListener=*/DNSStubListener=no/g' /etc/systemd/resolved.conf
service systemd-resolved stop

# /etc/NetworkManager/NetworkManager.conf:
[main]
dns=default

rm /etc/resolv.conf
sudo systemctl restart NetworkManager

Time synchronization / NTP
https://feeding.cloud.geek.nz/posts/time-synchronization-with-ntp-and-systemd/

apt install -y systemd-timesyncd

# cat /etc/systemd/timesyncd.conf
...
[Time]
NTP=ntp.ubuntu.com
FallbackNTP=ntp2.ubuntu.com
...

# apt purge ntp ntpdate
timedatectl set-ntp true
sudo systemctl restart systemd-timesyncd
timedatectl status
sudo journalctl -u systemd-timesyncd -f

# show contab log
sudo systemctl status crond

Timeserver / sync

sudo apt install -y tzdata
https://www.tecmint.com/set-time-timezone-and-synchronize-time-using-timedatectl-command/
# status
timedatectl  status
# disable
timedatectl set-ntp 0
# enable
timedatectl set-ntp true
timedatectl set-timezone "Europe/Berlin"
#timedatectl set-timezone "Europe/Zurich"
timedatectl set-time 14:14:30
timedatectl set-time 20181120
timedatectl set-time '18:00:00 2018-11-22'
timedatectl set-local-rtc 1

# sync time
systemctl restart systemd-timesyncd
timedatectl status

Status

systemctl is-active application.service
systemctl is-enabled application.service
systemctl is-failed application.service

Reload systemd configuration

systemctl daemon-reload

# list failed services
systemctl list-units --failed
journalctl -xe

Restart service on failure

...
[Service]
RestartSec=30s
Restart=on-failure

Restart another service (if running) on start

[Service]
...
ExecStartPost=/bin/systemctl try-restart wildfly.service

sudo systemctl edit apache2.service

systemd timers example with rsnapshot
http://mark.stosberg.com/blog/tech/rsnapshot-and-systemd/

systemctl cat flanneld.service

Extend service

systemctl edit sshd.service
# cat /etc/systemd/systemsshd.service.d/override.conf
[Service]
StandardOutput=tty
ExecStartPre=/bin/ping -c 30 bifrost

Debug stack

systemctl list-units | grep stack
journalctl -u devstack@q-agt.service

List names from running services

systemctl list-units --type=service --state=running | awk '/.*\.service/ {print $1}'

# stop running services
systemctl list-units --type=service --state=running | awk '/.*\.service/ {print $1}' | grep -Ev "systemd|unbound|ssh|dbus|getty|network|rsyslog|uuid" | xargs systemctl stop

Links
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
https://wiki.ubuntuusers.de/systemd/
https://wiki.ubuntuusers.de/systemd/Service_Units/
http://www.freedesktop.org/software/systemd/man/systemd.service.html
https://wiki.archlinux.org/index.php/Systemd_FAQ
https://wiki.ubuntu.com/SystemdForUpstartUsers
http://www.freedesktop.org/software/systemd/man/systemd.special.html
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung