[systemd-devel] getty : how to run getty on every ttyX

Daniel P. Berrange berrange at redhat.com
Mon Dec 16 04:03:10 PST 2013


On Fri, Dec 13, 2013 at 05:20:19PM +0100, Lennart Poettering wrote:
> On Fri, 13.12.13 16:15, Lennart Poettering (lennart at poettering.net) wrote:
> 
> > > We had discussed this back at Linux Plumbers last year, and at the time
> > > you had suggested that rather than create /dev/ttyN symlinks we should
> > > instead do something like  /dev/containerttyN instead, and set a
> > > 'container_tty' variable containing a list of all those device names
> > > so that systemd can discover them sensibly. We never got around to
> > > doing this from the libvirt side, and AFAIK systemd hasn't done anything
> > > on its side either. So is this still a suitable way forward ?
> > 
> > Yeah, I am pretty sure that's what we should do. I figure I should hack
> > that up. I'll work on it now.
> 
> Committed. "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. 
> 
> Example:
> 
> "container_ttys=pts/5 pts/8 pts/15"
> 
> when pass to PID 1 will spawn three additional gettys on ptys 5, 8 and
> 15.
> 
> Note that this *really* only supports ptys, not any other kinds of ttys,
> sinc for those we require propery device enumeration and notification
> and we don't have those in containers... I still chose to name this
> $container_ttys rather than $container_ptys, so that maybe one day we
> can extend it should devices like this ever get virtualized.
> 
> This will be in systemd 209.

I've tested this with libvirt and it worked except for one small edge
case.

Say libvirt creates 3 consoles /dev/pts/0, /dev/pts/1 and /dev/pts/2.
Now we set  container_ttys="pts/0 pts/1 pts/2" Systemd starts up 3
agetty processes - one of each of these.

The /dev/console device, however, is also a link to /dev/pts/0
and so systemd starts up a agetty process for that too.

Now we have 2 agetty processes fighting over /dev/pts/0 which ends
in tears

Is this something that systemd should detect & cope with, or should we
document that the 'container_ttys' env *must exclude* any tty associated
with the /dev/console device ?

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


More information about the systemd-devel mailing list