Been trying to understand and play around with systemd-nspawn because I'd like to run a Debian Testing install for myself without enabling the testing repos on my main Debian stable system.
I wrote this shell script to help set up Debootstrap process:
#!/bin/sh
dirpath="$1"
if [ -z "$dirpath" ]; then
dirpath="debian-testing-devel"
elif ! [ -d "$dirpath" ]; then
mkdir -p "$dirpath"
fi
echo "NOTICE: You must run `debootstrap` as a root user! Requesting sudo privilage..."
sudo debootstrap --include="dbus,systemd-container" testing "$dirpath" "https://deb.debian.org/debian"
echo "Debootstrap has finished!"
echo "You may log in to your system by using: systemd-nspawn -D ${dirpath} -U --machine debian-testing-devel"
echo "Make sure to set a secure root password!"
Something like that, basically. I named it "debian-testing-devel". Then I quickly learned that machinectl
can only access things in "/var/lib/machines/", so I moved my created directory there. Anyway...
Then I logged in with systemd-nspawn -D /var/lib/machines/debian-testing-devel/ -U --machine debian-testing-devel
, and set up my password, and had to add "pts/0" and "pts/1" to "/etc/securetty" so I could login as root.
When I tried to login with machinectl login debian-testing-devel
, I got "Failed to get login PTY: Protocol error"
So I logged into the container with systemd-nspawn
again, found out that the package install was broken for some reason with dbus
, so I ran apt -f install
, which seemed to fix it... kinda. Another source Online claimed that I had to also install systemd
in the container itself, not just DBus, to get rid of the protocol error, so I tried that!
And finally, when I try to run machinectl login debian-testing-devel
again, I still get stuck at "Failed to get login PTY: ..." this time it says, Failed to get login PTY: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
.
So I'm really not sure what to do next. Trying to search for this problem Online isn't bringing up too many results, and I'm not sure what's going on. It's been getting a little frustrating to try to learn this stuff and get it working when... nothing I try to do seems to work...
Any help is appreciated!