[arch-general] Linux container with systemd-nspawn

arnaud gaboury arnaud.gaboury at gmail.com
Thu Feb 20 05:02:36 EST 2014

Hi all,

I run systemd-git

I manage a arch container using systemd-nspawn facilities.

I am still strugling with the tty story on the container. The
container is running and
$ machinectl status dahlia
output is correct.

This output thus puzzles me:
gabx at hortensia ➤➤ systemd/system % sudo loginctl -M dahlia
   SESSION        UID USER             SEAT
         1       1000 gab              seat0
        c1          0 root             seat0
        c2       1000 gab              seat0
        c3       1000 gab              seat0
        c4       1000 gab              seat0
        c5       1000 gab              seat0
        c6       1000 gab              seat0
        c7       1000 gab              seat0
        c8       1000 gab              seat0

Now reading machinectl man page, I shall be able to open a terminal
session to the container.
gabx at hortensia ➤➤ ~ # machinectl login dahlia
Failed to start getty service: Unit container-getty at 0.service failed
to load: No such file or directory.

On the host, I
# cp /usr/lib/systemd/system/container-getty at .service to
/etc/systemd/system/. I am not sure it is needed.

>From the systemd mailing list :

"systemd-getty-generator" will now look for $container_ttys
set as an environment variable for PID 1. If that is set it will split
the string up on whitespaces and start a getty on all ptys
referenced. Note that this only supports ptys, not any other ttys.


"container_ttys=pts/5 pts/8 pts/15"

and about systemd 209 :

  * If the $container_ttys environment variable is set,
          getty-generator will automatically spawn a getty for each
          listed tty. This is useful for container managers to request
          login gettys to be spawned on as many ttys as needed.

Where shall I write such environment variable ? /etc/systemd/system.conf ?
Is part of the job done inside the container (it is running systemd 208-11) ?

Thank you for help

More information about the arch-general mailing list