<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 10, 2013 at 8:41 AM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On Wed, 28.08.13 13:12, Michael Marineau (<a href="mailto:michael.marineau@coreos.com">michael.marineau@coreos.com</a>) wrote:<br>

<br>
> This enables a getty on active kernel consoles even when they are not<br>
> the last one specified on the kernel command line and mapped to<br>
> /dev/console. Now the order "console=ttyS0 console=tty0" works in<br>
> addition to "console=tty0 console=ttyS0".<br>
<br>
</div>Hmm, so when we added the generator initially we though about this and<br>
came to the conclusion that it might be risky to spawn gettys on all<br>
configured console outputs and we should limit the magic logic to the<br>
primary console only. The kernel already makes a distinction between the<br>
primary console, and all others (the latter only receive logs, but you<br>
cannot read from them via /dev/console iirc), and so we propagated that<br>
distinction into systemd, too.<br>
<br>
I can totally see that this is confusing though, as nobody remembers the<br>
right ordering...<br></blockquote><div><br></div><div>And in my case there isn't a truly correct ordering either because I'm creating filesystem images that need to boot on a wide variety of platforms including QEMU which gives the user a VGA console most of the time but a serial console when using the -nographic option. The bootloader doesn't know the difference.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Kay, do you have an opinion about this?<br>
<div class=""><div class="h5"><br>
> ---<br>
>  src/getty-generator/getty-generator.c | 37 ++++++++++++++++++++++-------------<br>
>  1 file changed, 23 insertions(+), 14 deletions(-)<br>
><br>
> diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c<br>
> index 4b7a60a..6c93806 100644<br>
> --- a/src/getty-generator/getty-generator.c<br>
> +++ b/src/getty-generator/getty-generator.c<br>
> @@ -122,33 +122,42 @@ int main(int argc, char *argv[]) {<br>
>          }<br>
><br>
>          if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {<br>
> -                const char *tty;<br>
> -<br>
> -                tty = strrchr(active, ' ');<br>
> -                if (tty)<br>
> -                        tty ++;<br>
> -                else<br>
> -                        tty = active;<br>
> -<br>
> -                /* Automatically add in a serial getty on the kernel<br>
> -                 * console */<br>
> -                if (isempty(tty) || tty_is_vc(tty))<br>
> -                        free(active);<br>
> -                else {<br>
> +                char *w, *state;<br>
> +                size_t l;<br>
> +<br>
> +                /* Automatically add in a serial getty on all active<br>
> +                 * kernel consoles */<br>
> +                FOREACH_WORD(w, l, active, state) {<br>
> +                        char *tty;<br>
>                          int k;<br>
><br>
> +                        tty = strndup(w, l);<br>
> +                        if (!tty) {<br>
> +                            log_oom();<br>
> +                            free(active);<br>
> +                            r = EXIT_FAILURE;<br>
> +                            goto finish;<br>
> +                        }<br>
> +<br>
> +                        if (isempty(tty) || tty_is_vc(tty)) {<br>
> +                                free(tty);<br>
> +                                continue;<br>
> +                        }<br>
> +<br>
>                          /* We assume that gettys on virtual terminals are<br>
>                           * started via manual configuration and do this magic<br>
>                           * only for non-VC terminals. */<br>
><br>
>                          k = add_serial_getty(tty);<br>
> -                        free(active);<br>
><br>
>                          if (k < 0) {<br>
> +                                free(tty);<br>
> +                                free(active);<br>
>                                  r = EXIT_FAILURE;<br>
>                                  goto finish;<br>
>                          }<br>
>                  }<br>
> +                free(active);<br>
>          }<br>
><br>
>          /* Automatically add in a serial getty on the first<br>
<br>
<br>
</div></div><span class=""><font color="#888888">Lennart<br>
<br>
--<br>
Lennart Poettering - Red Hat, Inc.<br>
</font></span></blockquote></div><br></div></div>