You are not logged in.
When I try to access a shell or run a command in a systemd-nspawn container with machinectl, it terminates immediately without any output or interaction.
# machinectl shell pia
Connected to machine pia. Press ^] three times within 1s to exit session.
Connection to machine pia terminated.
# machinectl shell pia /bin/ls
Connected to machine pia. Press ^] three times within 1s to exit session.
Connection to machine pia terminated.
I am able to open a shell to my host "machine"
# machinectl shell
Connected to the local host. Press ^] three times within 1s to exit session.
[root ~]# exit
logout
Connection to the local host terminated.
I can also run commands on the systemd-nspawn machine using systemd-run
# systemd-run -t -M pia /bin/ls
Running as unit: run-u12.service
Press ^] three times within 1s to disconnect TTY.
bin dev home lib64 opt root sbin sys usr
boot etc lib mnt proc run srv tmp var
machinectl does see the machine:
# machinectl status pia
pia(e3d6392c3c504b728153445b4290fbb1)
Since: Sun 2018-05-13 18:04:54 PDT; 21h ago
Leader: 30835 (systemd)
Service: systemd-nspawn; class container
Root: /var/lib/machines/pia
Iface: ve-pia
OS: Arch Linux
UID Shift: 827326464
Unit: systemd-nspawn@pia.service
├─payload
│ ├─init.scope
│ │ └─30835 /usr/lib/systemd/systemd
│ └─system.slice
│ ├─console-getty.service
│ │ └─30865 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 vt220
│ ├─dbus.service
│ │ └─30864 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
│ ├─lvm2-lvmetad.service
│ │ └─30857 /usr/bin/lvmetad -f
│ ├─systemd-journald.service
│ │ └─30856 /usr/lib/systemd/systemd-journald
│ └─systemd-logind.service
│ └─30862 /usr/lib/systemd/systemd-logind
└─supervisor
└─30832 /usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth -U --settings=override --machine=pia
# machinectl show pia
Name=pia
Id=e3d6392c3c504b728153445b4290fbb1
Timestamp=Sun 2018-05-13 18:04:54 PDT
TimestampMonotonic=172078217556
Service=systemd-nspawn
Unit=systemd-nspawn@pia.service
Leader=30835
Class=container
RootDirectory=/var/lib/machines/pia
State=running
I can get by with systemd-run but it seems odd that machinectl shell isn't working. Please let me know if you can point me in the right direction.
Last edited by emphire (2018-05-15 05:15:32)
Offline
Turns out that recently systemd-nspawn uses --private-users by default if you're using a .spawn file. I had to set a root password and allow the permissions to get updated.
Offline