Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 653672

Summary: sys-apps/sysvinit-2.89-r1 spawns extra non-configured agetty on console tty
Product: Gentoo Linux Reporter: Daniel Dawson <danielcdawson>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Daniel Dawson 2018-04-21 09:09:08 UTC
This version is spawning an extra agetty on whatever tty is specified as console on the kernel command line, making it unusable due to the two instances clashing over input. After some investigation, I found the following in the source, in src/init.c line 1349 (function check_kernel_console()):

        if (!strncmp(dev, "tty", 3))
                strncpy(id, dev+3, sizeof(id));
        else
                strncpy(id, dev, sizeof(id));

        for(old = newFamily; old; old = old->next) {
                if (!strcmp(old->id, id)) {
                        dup = 1;
                }
        }
        if (!dup) {
...
                sprintf(ch->process, "/sbin/agetty -L -s 115200,38400,9600 %s vt102", dev);
...

IIUC, this is searching through the inittab rules, trying to find any whose id matches the value of the "console" parameter (or the part after "tty" if that's present), previously copied to dev. If it doesn't find any, then it adds an extra rule—one not specified in inittab—that launches the command seen at the end.

I assume this is meant as some sort of failsafe. The question is, why is it requiring inittab to follow the tradition of gettys being launched on tty{1,2,3,...} in rules with ids "1", "2", "3", etc. (especially when the man page essentially calls it outdated)? Gentoo's own default inittab certainly doesn't, guaranteeing a problem unless the admin happens to like that tradition enough to edit inittab. For that matter, why is it caring about the id at all, beyond it being a mere identifier? And why is it assuming a serial console? This all seems very questionable to me.