[systemd-devel] next available VT for a service

Valentin Popa valentin.popa at intel.com
Mon Jun 16 07:20:41 PDT 2014


Hi all,
I want to start a service on the next available tty (let's call it 
%next_available_tty). In my case, this service handles weston-launch, 
but it could be any that requires a virtual terminal to run.
Let's say some of the TTYs are already taken (by getty at tty1.service, 
etc) and I don't know which ; I would like to spawn a new user session 
that contains my new service on a spare tty. The service unit should 
look like this:

[Service]
ExecStart=/usr/bin/weston-launch -some_parameter
StandardInput=tty
StandardOutput=journal
StandardError=journal
TTYPath=/dev/%next_available_tty # this is hardcoded for the moment

Weston must run from a virtual terminal.
To launch the session, I use: 
https://github.com/sofar/user-session-units which checks for available 
seats, then creates a PAM session on tty1.

Without   %next_available_tty  I cannot get rid of these hard-codings 
and I need to know which tty will be available before the system boots 
("reserve" it).

Does anyone know if such "feature" can be accepted in systemd. If not, 
maybe it can be done in another way. If yes, any pointers to start from?



More information about the systemd-devel mailing list