We use systemctl
to manage systemd services and it's tempted to think that it's for systemd service only. Unfortunately, that is not the case, because at least, it's also capable of managing systemd socket.
Now, you may wonder what systemd socket is. Long story short, systemd socket is a machanism for inter-process communication. If you are working with KVM-QEMU VMs on Fedora Linux, you may be familiar with libvirtd.service
. (For installation and commonly used commands, refer to my previous blogs.) It's a systemd service which supports VM management. After shutdown all VMs on our laptop, we may want to stop it. However, we will notice that a simple stop command cannot clean up all related resources.
$ sudo systemctl stop libvirtd
Stopping 'libvirtd.service', but its triggering units are still active:
libvirtd-admin.socket, libvirtd.socket, libvirtd-ro.socket
$ systemctl status libvirtd-admin.socket libvirtd.socket libvirtd-ro.socket
● libvirtd-admin.socket - libvirt legacy monolithic daemon admin socket
Loaded: loaded (/usr/lib/systemd/system/libvirtd-admin.socket; disabled; preset: disabled)
Active: active (listening) since Wed 2025-02-05 18:23:19 CST; 4min 29s ago
...
● libvirtd.socket - libvirt legacy monolithic daemon socket
Loaded: loaded (/usr/lib/systemd/system/libvirtd.socket; disabled; preset: disabled)
Active: active (listening) since Wed 2025-02-05 18:23:19 CST; 4min 29s ago
...
● libvirtd-ro.socket - libvirt legacy monolithic daemon read-only socket
Loaded: loaded (/usr/lib/systemd/system/libvirtd-ro.socket; disabled; preset: disabled)
Active: active (listening) since Wed 2025-02-05 18:23:19 CST; 4min 29s ago
...
We can check the status of these sockets through systemctl
. Unsurprisingly, we can also stop them through systemctl
.
$ sudo systemctl stop libvirtd-admin.socket libvirtd.socket libvirtd-ro.socket
$ systemctl status libvirtd-admin.socket libvirtd.socket libvirtd-ro.socket
○ libvirtd-admin.socket - libvirt legacy monolithic daemon admin socket
Loaded: loaded (/usr/lib/systemd/system/libvirtd-admin.socket; disabled; preset: disabled)
Active: inactive (dead) since Wed 2025-02-05 18:31:09 CST; 3s ago
...
○ libvirtd.socket - libvirt legacy monolithic daemon socket
Loaded: loaded (/usr/lib/systemd/system/libvirtd.socket; disabled; preset: disabled)
Active: inactive (dead) since Wed 2025-02-05 18:31:09 CST; 3s ago
...
○ libvirtd-ro.socket - libvirt legacy monolithic daemon read-only socket
Loaded: loaded (/usr/lib/systemd/system/libvirtd-ro.socket; disabled; preset: disabled)
Active: inactive (dead) since Wed 2025-02-05 18:31:09 CST; 3s ago
...
Comments NOTHING