[systemd-devel] Rethinking getty and fast user switching

Colin Guthrie gmane at colin.guthr.ie
Tue Feb 21 04:40:31 PST 2012

'Twas brillig, and Jan Engelhardt at 21/02/12 12:15 did gyre and gimble:
> On Tuesday 2012-02-21 13:02, Colin Guthrie wrote:
>>> Take f.i.: vt1 X, vt2 X, vt3 X, vt4 text, vt5 X, vt6 text, vt7 X, vt8
>>> text, vt9 text, vt10 text, vt11 X. Logical? Absolutely (w.r.t. some
>>> pattern). To you? Probably absolutely not. (Solution: VT numbers
>>> which are prime get an X server, non-primes get text.)
>> [...] It's more or less a first come,
>> first served basis just now. So you'd have to spend some time after boot
>> starting Xs and swithing VTs at the right time to configure your perfect
>> primes layout.
> Why so? Static configurations are one of the easiest.
>  /etc/systemd/system/getty.target.wants/getty at tty4.service -> getty at .service
>  /etc/systemd/system/somethingelse/xorg at tty1.service -> myxorg at .service
>  etc.
> myxorg.service:
> [Unit]
> BindTo=dev-%i.device
> [Service]
> ExecStart=myX %I
> /usr/bin/myX:
> tty="$1"; shift;
> exec X vt${tty#tty} "$@"

Well that's pretty similar to what I'm proposing in the first place with
the exception that myX is called "appropriate-login-agent" and does the

tty="$1"; shift;
bin="/sbin/agetty $tty 38400"
systemctl is-active graphical.target 2>&1 >/dev/null && bin="X vt${tty#tty}"
exec $bin "$@"

Or something like that.... (it would probably run prefdm rather than X
directly and that would require that the dm itself would take the tty
argument and pass it on to the X it starts etc. and fail if this is not
possible for some bizarre reason yada yada - hence the changes required
to gdm I mentioned earlier). I don't think I'm being super crazy here...
tho' maybe I'm still missing something?

Of course I'm not sure that calling systemctl within a unit is generally
a good idea or not or if there is a nicer way to get the current target.
But this was basically all I was asking in this mail - is this the best
way to do it?, is there a neater way?, is it sensible? would other
distro people want this to be how things work by default? etc.

Obviously users can configure their own systems the way they want with
static setups etc, but I'm interested in having sensible defaults.

To be honest, this is more discussion that I was expecting for a
relatively simple suggestion, but meh, it's all part of the fun :)



Colin Guthrie

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

More information about the systemd-devel mailing list