[PATCH] weston: Don't exit just because tty is in gfx mode already

Pekka Paalanen ppaalanen at gmail.com
Fri May 20 08:30:53 UTC 2016

On Mon, 16 May 2016 15:25:52 -0700
Florian Hänel <florian.haenel at heeen.de> wrote:

> From: =?UTF-8?q?Florian=20H=C3=A4nel?= <florian.haenel at lge.com>
> If weston crashed (or during development) it can leave the tty
> in graphics mode, which would prevent it from ever coming up again.
> Another compositor running should be handled by upstart/systemd
> and the tty in graphics mode does not prevent us from using it.


can you explain more how you figure that to work?

A supported use case is to start weston with weston-launch, and without
any systemd, upstart, logind, or any other manager running. What else
would be preventing Weston from launching in case a display server was
already running and active? (*)

Setting DRM master failure probably comes too late as the display
servers have already started fighting, and then Weston attempts to undo
the VT setup while the other display server is still running. How could
that not end up in an even bigger mess?

How is it even possible to leave the VT in graphics mode? If
weston crashed, then weston-launch or logind (as launcher-logind.c does
not seem to touch the VT) will restore the VT.

(PS. never do 'killall -9 weston', that's a pretty guaranteed way to
make your VT unusable as it kills both weston and weston-launch before
either can restore. Logind might save you, though, I suppose.)

> A informational log message for debugging purposes should be enough.
> ---
>   src/launcher-util.c | 1 -
>   1 file changed, 1 deletion(-)
> diff --git a/src/launcher-util.c b/src/launcher-util.c
> index e89710b..a98ff74 100644
> --- a/src/launcher-util.c
> +++ b/src/launcher-util.c
> @@ -319,7 +319,6 @@ setup_tty(struct weston_launcher *launcher, int tty)
>       if (kd_mode != KD_TEXT) {
>           weston_log("%s is already in graphics mode, "
>                  "is another display server running?\n", tty_device);
> -        goto err_close;
>       }
>       ioctl(launcher->tty, VT_ACTIVATE, minor(buf.st_rdev));

I do not think this patch applies, there is no such code in
launcher-util.c anymore.

Looks like this hunk is now in launcher-direct.c. Ok, so you are
running weston as root, without weston-launch. Is there any reason you
cannot use weston-launch? Having a separate process to restore the VT
is a good idea, even if you run as root.

OTOH, seeing that this only applies to the case of running weston
directly as root and without any session manager service or
weston-launch, maybe it's ok to drop the sanity check and let the user
shoot his foot if he wants to?

The very least this patch needs to be rebased for master, and explain
more why this change is needed and what the effects are, also if there
really is another display server already running.

(*) Btw. now that I look at weston-launch.c, it is not doing the kd_mode
check at all, is it? Makes me wonder if it should - was it just

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160520/72e89c69/attachment.sig>

More information about the wayland-devel mailing list