SYSTEMD-MACHINED(8)

okay bestie, welcome to the SYSTEMD-MACHINED.SERVICE(8) manual page โ€” the one all about systemd-machined.service and /usr/lib/systemd/systemd-machined. grab a strawberry ๐Ÿ“ and let's get into it.

โœจ NAME โœจ

systemd-machined.service, systemd-machined โ€” the virtual machine and container registration manager. that's the whole name vibe: it manages registration for VMs and containers, periodt. ๐Ÿ’…

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

systemd-machined.service

/usr/lib/systemd/systemd-machined

๐ŸŒธ DESCRIPTION ๐ŸŒธ

systemd-machined is a system service that keeps track of locally running virtual machines and containers. no cap. ๐Ÿฆ‹

it's useful for registering and keeping track of both OS containers โ€” containers that share the host kernel but run a full init system of their own and behave in most regards like a full virtual operating system rather than just one virtualized app โ€” and full virtual machines โ€” virtualized hardware running normal operating systems and possibly different kernels. both icons, honestly. โœจ

systemd-machined should not be used for registering/keeping track of application sandbox containers. a โ€œmachineโ€ here is supposed to be an abstract term covering both OS containers and full virtual machines, but not application sandboxes. ๐Ÿซถ

machines registered with machined are exposed in various ways in the system. for example:

  • tools like ps(1) will show to which machine a specific process belongs in a column of its own, and so will gnome-system-monitor[1] or systemd-cgls(1). ๐Ÿ”
  • systemd's various tools (systemctl(1), journalctl(1), loginctl(1), hostnamectl(1), timedatectl(1), localectl(1), machinectl(1), ...) support the -M switch to operate on local containers instead of the host system. ๐ŸŒ€
  • systemctl list-machines will show the system state of all local containers, connecting to the container's init system for that. ๐Ÿ‘€
  • systemctl's --recursive switch has the effect of not only showing the locally running services, but recursively showing the services of all registered containers. ๐Ÿช†
  • the machinectl command provides access to a number of useful operations on registered containers, such as introspecting them, rebooting, shutting them down, and getting a login prompt on them. ๐Ÿ”
  • the sd-bus(3) library exposes the sd_bus_open_system_machine(3) call to connect to the system bus of any registered container. ๐ŸšŒ
  • the nss-mymachines(8) module makes sure all registered containers can be resolved via normal glibc gethostbyname(3) or getaddrinfo(3) calls. ๐ŸŒ

see systemd-nspawn(1) for some examples on how to run containers with OS tools. ๐Ÿงš

if you are interested in writing a VM or container manager that makes use of machined, please have a look at Writing Virtual Machine or Container Managers[2]. also see the New Control Group Interfaces[3]. ๐Ÿ“

the daemon provides both a C library interface (which is shared with systemd-logind.service(8)) as well as a D-Bus interface and a Varlink interface. the library interface may be used to introspect and watch the state of virtual machines/containers. the bus interface provides the same but in addition may also be used to register or terminate machines. the Varlink interface may be used to register machines with optional extensions, e.g. with an SSH key / address; it can be queried with varlinkctl introspect /run/systemd/machine/io.systemd.Machine io.systemd.Machine. for more information please consult sd-login(3) and org.freedesktop.machine1(5) and org.freedesktop.LogControl1(5). ๐Ÿ›ฐ๏ธ

a small companion daemon systemd-importd.service(8) is also available, which implements importing, exporting, and downloading of container and VM images. ๐Ÿ“ฆ

for each container registered with systemd-machined.service that employs user namespacing, users/groups are synthesized for the used UIDs/GIDs. these are made available to the system using the User/Group Record Lookup API via Varlink[4], and thus may be resolved with userdbctl(1) or the usual glibc NSS calls. ๐Ÿ‘ฅ

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

go peek at: systemd(1), machinectl(1), systemd-nspawn(1), nss-mymachines(8), systemd.special(7), org.freedesktop.machine1(5), ssh(1). ๐Ÿ’œ

๐ŸŒˆ NOTES ๐ŸŒˆ

  1. gnome-system-monitor โ€” https://help.gnome.org/users/gnome-system-monitor/
  2. Writing Virtual Machine or Container Managers โ€” https://systemd.io/WRITING_VM_AND_CONTAINER_MANAGERS
  3. New Control Group Interfaces โ€” https://systemd.io/CONTROL_GROUP_INTERFACE
  4. User/Group Record Lookup API via Varlink โ€” https://systemd.io/USER_GROUP_API

that's the tea โ˜•: systemd 261.3 is the version, SYSTEMD-MACHINED.SERVICE(8) is the manual, and the footer didn't show a date so i'm not making one up โ€” periodt. ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from