OPNsense Forum

Archive => 19.1 Legacy Series => Topic started by: kursu on February 25, 2019, 07:47:59 pm

Title: USB console hangs right after SSH keys are shown before login promt
Post by: kursu on February 25, 2019, 07:47:59 pm
Setting "-S115200 -h" into boot.conf seems to be a workaround, however it gets replaced every reboot. Wrong uart flags or how to
make -h persistant?

dmesg:
Code: [Select]
root@bifrost:/boot # dmesg | grep uart
uart0: <16550 or compatible> at port 0x3f8 irq 4 on isa0
uart1: <16550 or compatible> at port 0x2f8 irq 3 flags 0x10 on isa0
uart1: console (115200,n,8,1)

/etc/ttys:
Code: [Select]
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none                            unknown off secure
#
ttyv0   "/usr/libexec/getty Pc"         xterm   off secure
# Virtual terminals
ttyv1   "/usr/libexec/getty Pc"         xterm   off secure
ttyv2   "/usr/libexec/getty Pc"         xterm   off secure
ttyv3   "/usr/libexec/getty Pc"         xterm   off secure
ttyv4   "/usr/libexec/getty Pc"         xterm   off secure
ttyv5   "/usr/libexec/getty Pc"         xterm   off secure
ttyv6   "/usr/libexec/getty Pc"         xterm   off secure
ttyv7   "/usr/libexec/getty Pc"         xterm   off secure
ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyU0   "/usr/libexec/getty std.115200" vt100   onifconsole secure
ttyU1   "/usr/libexec/getty std.115200" vt100   onifconsole secure
ttyU2   "/usr/libexec/getty std.115200" vt100   onifconsole secure
ttyU3   "/usr/libexec/getty std.115200" vt100   onifconsole secure
# Dumb console
dcons   "/usr/libexec/getty std.9600"   vt100   off secure

Code: [Select]
root@bifrost:/boot # cat loader.conf.local
comconsole_port="0x2F8"
comconsole_speed="115200"
hint.uart.0.flags=0x0
hint.uart.1.flags=0x10

Title: Re: USB console hangs right after SSH keys are shown before login promt
Post by: olgeni on February 26, 2019, 01:06:04 pm
In System / Settings / Administration there's a "USB-based serial" option - did you try that? (not sure what it does exactly at the system level but sounds related)

I have a physical serial here so I can't test the USB right now. You could use ssh access to check if getty is actually being spawned on the correct USB tty - seems like it's not.
Title: Re: USB console hangs right after SSH keys are shown before login promt
Post by: kursu on February 26, 2019, 03:25:46 pm
Yes, USB Serial box is checked, it added the following to /etc/ttys :

Code: [Select]
ttyU0   "/usr/libexec/getty std.115200" vt100   onifconsole secure
ttyU1   "/usr/libexec/getty std.115200" vt100   onifconsole secure
ttyU2   "/usr/libexec/getty std.115200" vt100   onifconsole secure
ttyU3   "/usr/libexec/getty std.115200" vt100   onifconsole secure

Code: [Select]
root@bifrost:/ # ls /dev | grep ttyu
ttyu0
ttyu0.init
ttyu0.lock
ttyu1
ttyu1.init
ttyu1.lock

There you said something....  devices is named lower-case in /dev (ttyu0,ttyu1) and in /etc/ttys (ttyU0 ttyU1).

system.inc
Code: [Select]
   /* serial terminals */
        foreach (array('tty%s0', 'tty%s1', 'tty%s2', 'tty%s3') as $serialport) {
            $serialport = sprintf($serialport, isset($config['system']['serialusb']) ? 'U' : 'u');
            if (stripos($tty, $serialport) === 0) {
                fwrite($fd, "{$serialport}\t\"/usr/libexec/getty {$serial_type}\"\tvt100\t{$on_off_secure_u}\n");
                continue 2;
            }
        }
Title: Re: USB console hangs right after SSH keys are shown before login promt
Post by: kursu on February 26, 2019, 09:36:17 pm
I wasnt able to try out my code change due to my netgate hardware decided to die  :-\, a 12core proliant have jumpen in as temporary replacement  8)
Title: Re: USB console hangs right after SSH keys are shown before login promt
Post by: olgeni on February 26, 2019, 10:46:04 pm
ttyu0 and ttyu1 (lower case 'u') look like actual physical serial ports to me, not USB - could it be? (see uart(4) vs. ucom(4) for the naming)

This too doesn't look like USB...

Code: [Select]
uart0: <16550 or compatible> at port 0x3f8 irq 4 on isa0
uart1: <16550 or compatible> at port 0x2f8 irq 3 flags 0x10 on isa0
Title: Re: USB console hangs right after SSH keys are shown before login promt
Post by: franco on February 26, 2019, 11:15:44 pm
With serial port enabled (secondary or primary) and USB unchecked it should work in conjunction with the loader.conf.local trickery.


Cheers,
Franco