You are not logged in.
I set up a container with systemd-nspawn:
$ sudo mkdir -p /var/lib/containers/test1 && sudo pacstrap -K -c /var/lib/containers/test1 base
[...]
$ sudo systemd-nspawn -D /var/lib/containers/test1/
░ Spawning container test1 on /var/lib/containers/test1.
░ Press Ctrl-] three times within 1s to kill container.
[root@test1 ~]# passwd
New password:
Retype new password:
passwd: password updated successfully
[root@test1 ~]#
logout
Container test1 exited successfully.
$ sudo systemd-nspawn -b -D /var/lib/containers/test1/
░ Spawning container test1 on /var/lib/containers/test1.
░ Press Ctrl-] three times within 1s to kill container.
systemd 257.8-2-arch running in system mode (+PAM +AUDIT -SELINUX -APPARMOR -IMA +IPE +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBCRYPTSETUP_PLUGINS +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +BTF +XKBCOMMON +UTMP -SYSVINIT +LIBARCHIVE)
Detected virtualization systemd-nspawn.
Detected architecture x86-64.
Welcome to Arch Linux!
[boot messages...]
test1 login: root
Password:
[root@test1 ~]#
logout
Arch Linux 6.15.9-hardened1-1-hardened (pts/0)
test1 login:
<kill with 3x ctrl-]>
Container test1 terminated by signal KILL.
$ sudo machinectl start test1
Machine image 'test1' does not exist.
$ sudo machinectl list
No machines.
$ sudo machinectl list-images
No images.
As you can see, I can successfully boot and use the container with systemd-nspawn, but machinectl doesn't see the machine. I guessed the "test1" name from the message I got from nspawn: "Spawning container test1 on /var/lib/containers/test1"
What am I missing?
Thanks,
gm
Last edited by gattu_marrudu (2025-08-11 21:17:37)
Offline
What am I missing?
man machinectl search: 'FILES AND DIRECTORIES'
You've added an s.
Last edited by NuSkool (2025-08-11 21:14:01)
Scripts I Use : https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics
Offline
Ugh. I missed that section. For some reason, I thought that machinectl would get the machine names registered somewhere when they get created.
I moved the directories to /var/lib/machines and I can see them now.
Thanks.
Offline
According to the man page, "For compatibility reasons, the directory /var/lib/container/ is searched, too.".
Path '/var/lib/container/' should work as well, but not '/var/lib/containers/'.
My containers I want 'machinectl' access to are under /var/lib/machines/.
Last edited by NuSkool (2025-08-11 21:33:01)
Scripts I Use : https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics
Offline