Linux distro using Systemd with systemd-container package installed.
$ curl -LO https://raw.githubusercontent.com/tokland/arch-bootstrap/master/arch-bootstrap.sh
$ sudo install -m 755 arch-bootstrap.sh /usr/local/bin/arch-bootstrap
You can use other names apart from dev
.
# arch-boostrap /var/lib/machines/dev
enter machine with systemd-nspawn
# systemd-nspawn -D /var/lib/machines/dev
In the machine, set a root password and add pts/0
to /etc/securetty
to allow root login on any tt.
# passwd
# echo "pts/0" >> /etc/securetty
# exit
Edit /etc/systemd/nspawn/dev.nspawn
and paste the following
[Service]
ExecStart=
ExecStart=/usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --machine=%i
[Files]
# Example bind, you can have multiple of this
# Bind=/home/user
# enable x11 for GUI apps
# BindReadOnly=/tmp/.X11-unix
Reload daemon
systemctl daemon-reload
All should be done now. Start the machine with machinectl
.
# machinectl start dev
If you want to have the machine start automatically
# machinectl enable dev
# machinectl login dev
You should be able to login with your previously set root password and have a functional arch linux container.
Grant non-root user read access to the container filesystem
edit /usr/lib/tmpfiles.d/systemd-nspawn.conf
and change to 0755
on the line Q /var/lib/machines 0700 - - -