OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: Steven on May 20, 2021, 05:10:07 pm

Title: Serial Console stopped working
Post by: Steven on May 20, 2021, 05:10:07 pm
I have serial console set as my primary console in settings and it's no longer working.

I've checked the device, cable, and serial port are all fine. When I restart I can see output from the serial port (OPNsense splashscreen and and device loading lines on boot up) but after OPNsense loads the serial console stops responding. No console menu for login and no response to keyboard commands.

The serial console used to work fine, but some recent update changed that. I see in the change log some mention of "system: better logic for serial console options -h and -D" is there something I need set to restore the serial console functionality?
Title: Re: Serial Console stopped working
Post by: Steven on May 20, 2021, 05:24:33 pm
From SSH "desgm | grep uart" responds with the following:
Code: [Select]
uart0: <16950 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (115200,n,8,1)
uart1: <16950 or compatible> port 0x2f8-0x2ff irq 3 on acpi0

Below are my settings for OPNsense System>Settings>Administration>Console
(https://i.imgur.com/O848XEq.jpg)
Title: Re: Serial Console stopped working
Post by: Steven on May 22, 2021, 07:58:01 pm
I was able to capture the serial console output at boot. After this point the console no longer responds.

(https://i.imgur.com/84poLUP.png)
Title: Re: Serial Console stopped working
Post by: eponymous on May 23, 2021, 03:37:50 pm
Hi Steven,

If I'm not mistaken, it looks like you have two UART devices in your unit?

Have you tried setting the following in the tuneable page?:

comconsole_port=0x2F8
hint.uart.0.flags=0x00
hint.uart.1.flags=0x10

This will force the console output to be on 0x2F8 instead which might be the actual hardware UART you're trying to use.

I had a similar issue until I set these tunables.   
Title: Re: Serial Console stopped working
Post by: Steven on May 24, 2021, 11:44:05 pm
Thanks eponymous. I'll give it a try and report back.
Title: Re: Serial Console stopped working
Post by: Steven on May 25, 2021, 12:37:49 am
Looks like 0x3f8 is my correct comconsole_port, when I try 0x2f8 I get no output instead of some output with 0x3f8.

So far I have tried the following tunable but my console still stops at the same point.

Code: [Select]
hint.uart.0.flags=0x0
hint.uart.1.flags=0x10
comconsole_speed=115200
comconsole_port=0x3F8
console=comconsole
Title: Re: Serial Console stopped working
Post by: franco on May 25, 2021, 10:06:47 am
Do you have your serial console set to secondary?


Cheers,
Franco
Title: Re: Serial Console stopped working
Post by: Steven on May 25, 2021, 03:39:13 pm
I have serial console set as primary, and secondary console set to none.
Title: Re: Serial Console stopped working
Post by: Steven on May 27, 2021, 05:13:26 am
I have tried to set primary console to serial and secondary console to serial and still have same problem.
Title: Re: Serial Console stopped working
Post by: eponymous on June 18, 2021, 05:16:28 pm
Interesting, I've just updated to 21.1.7 and am now encountering a very similar issue on my Netgate SG-2440.

The unit boots fine and I see the OPNsense loader menu and the first few lines until "Booting.." - after which I have nothing.

To get the serial console working previously I had the following tuneable set that I mentioned above:

Code: [Select]
comconsole_port=0x2F8
hint.uart.0.flags=0x00
hint.uart.1.flags=0x10

These are still set.

The default menu options for Console are still set - no changes there.

It looks like something changed in 21.1.5 as Steven pointed out above. I'm trying to find this change on GitHub so I can try and work out what is different.

Can anyone point me in the right direction?

Thanks.
Title: Re: Serial Console stopped working
Post by: eponymous on June 18, 2021, 05:29:13 pm
Found the change:

https://github.com/opnsense/core/commit/84a241c30a093fd30334843819946b2dd2832340

Title: Re: Serial Console stopped working
Post by: Steven on June 19, 2021, 06:52:52 am
Found the change:

https://github.com/opnsense/core/commit/84a241c30a093fd30334843819946b2dd2832340



Thanks eponymous it was around this patch when my serial console died. Wonder if we should log a github issue.
Title: Re: Serial Console stopped working
Post by: eponymous on June 19, 2021, 12:33:06 pm
Hi Steven.

For me that turned out to be a red herring.

When I factory reset the unit and removed the hw.uart.console tuneable (since its value wasn't aligned with my hardware setup) it all magically started working again; I can't say for certain what change made it work.

If you suspect it was the above change, I'd do a quick test and change the /boot.config to the way it was before (-D rather than -h). If you look at: boot (https://www.freebsd.org/cgi/man.cgi?boot(8)) for serial installs, the change is more correct than the way it was before as in, you shouldn't need -D and it should be -h. However, if you want both serial and vga output, then that flag may need changing.

It might also be worth you trying various combinations of tuneables also.

Best.

E.
Title: Re: Serial Console stopped working
Post by: Steven on June 20, 2021, 02:26:47 am
If you suspect it was the above change, I'd do a quick test and change the /boot.config to the way it was before (-D rather than -h).

Wow that worked for me. I had to change /boot.config back to -D for some reason and now my serial console is working again... -h does not work for me.
Title: Re: Serial Console stopped working
Post by: Steven on June 20, 2021, 02:33:18 am
So for the boot config to set -D, I have to configure "Primary Console: VGA" and "Secondary Console: Serial" and now it works for me (i.e. the /boot.config is set with -D flag).

If I try to do "Primary Console: Serial" it will fail for me. Not sure why.
Title: Re: Serial Console stopped working
Post by: franco on June 20, 2021, 08:27:54 pm
First things first: which hardware is this?

And does it have a VGA port?


Cheers,
Franco
Title: Re: Serial Console stopped working
Post by: Steven on June 20, 2021, 09:26:09 pm
Hi
First things first: which hardware is this?

And does it have a VGA port?

It's a Qotom q500g6.

It has a HDMI and Serial port.
Title: Re: Serial Console stopped working
Post by: franco on June 21, 2021, 06:07:51 am
Thanks, I suspect that a VGA/HDMI ready device might not like to be forced as being a primarily serial device or it could be that the kernel refuses to do it in such cases because it can't get rid of the non-serial port during initialisation.

Does the HDMI port in this configuration work for login though?

In any case your configuration suggestion is the best approach here.

From experience with Nano image testing I can say, however, that -D -h and serial as primary works on all the devices in my test pool, but to be fair I don't have a Qotom. ;)


Cheers,
Franco