[systemd-devel] getty : how to run getty on every ttyX
Daniel P. Berrange
berrange at redhat.com
Fri Dec 13 07:12:03 PST 2013
On Fri, Dec 13, 2013 at 04:06:56PM +0100, Lennart Poettering wrote:
> On Fri, 13.12.13 16:34, Gao feng (gaofeng at cn.fujitsu.com) wrote:
>
> > >> As we know, systemd only forks getty on ttyX when we press ctrl + alt + FX.
> > >> I whould like to let systemd forks server gettys on all of tty deivces by default.
> > >> this is very useful in container environment, since we can't use ctrl+alt+FX
> > >> to trigger getty in container.
> > >
> > > ...do containers even have such devices?
> > >
> >
> > pts device ;)
>
> This will not work. Unlike VT ttys which exist continously and
> perpetuously on a system ptys only exist when an application allocates
> them, like for example xterm or ssh. However, for them its xterm's or
> ssh's job to spawn a shall as backend.
>
> > > Anyway, just enable more instances of getty at .service for all devices you need, just like getty at tty1.service is started by default.
> > >
> > > The autostart that you mention is part of logind and all it does is just start the same services via systemd, no magic.
> > >
> >
> > getty at tty1.service under /etc/systemd/system/getty.target.wants/ is linked to /usr/lib/systemd/system/getty at .service,
> > so I create getty at tty2.service which links to /usr/lib/systemd/system/getty at .service too. is this right?
> >
> > In libvirt lxc, the ttyX actually is pts devices.
> >
> > [root at localhost getty.target.wants]# ll
> > total 0
> > lrwxrwxrwx 1 root root 38 Dec 13 02:49 getty at tty1.service -> /usr/lib/systemd/system/getty at .service
> > lrwxrwxrwx 1 root root 38 Dec 13 03:22 getty at tty2.service -> /usr/lib/systemd/system/getty at .service
> >
> > seems like in my container, agetty listens on /dev/console, not tty1 or tty2
> > /sbin/agetty --noclear --keep-baud console 115200 38400 9600
> >
> > it seems getty-generator does the extra job.
>
> /dev/tty1, /dev/tty2, ... make no sense in containers as there is no
> virtual console.
For each <console> device that you list in the container configuration
with libvirt, it will allocate a /dev/pts/NNN device, and add a symlink
from /dev/ttyN to the /dev/pts/NNN slave. What we'd like is for guest
OS to be able to setup agetty processes on any <console> device libvirt
has configured for the container automatically.
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 ?
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