OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: Mbl on May 22, 2022, 07:35:18 pm

Title: DEC3860 mini-USB Console
Post by: Mbl on May 22, 2022, 07:35:18 pm
Anybody ever connected to a DEC mini-USB Console port?

Looks like I can connect but only get port up and down messages, had no look to fire any commands or so...

Every help is appreciated!
Title: Re: DEC3860 mini-USB Console
Post by: Patrick M. Hausen on May 22, 2022, 09:00:45 pm
What operating system are you connecting the USB console to?

"Behind" that console connector is a USB to serial converter. So you get a serial port when you plug it in AND there is driver support for that in your OS. You then need to use a serial terminal program like putty (Windows), cu/minicom (Linux, BSD, Mac OS) to connect to that newly created port.
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 22, 2022, 09:53:57 pm
It’s Win11 with Putty. I can get to bios, I can see all the dmesg messages during the bootup, but once it shows the interfaces - there where usually the OPNsense 0 to 9 menu appears, it stops and I can hit any key without getting to the OPNsense menu or making any console input.
A driver should not be required as the USB maps to COM3 which is fine. I know this worked once but does not for some reasons.

I have followed this guide: https://docs.opnsense.org/hardware/serial_connectivity.html#legacy-uart

Have updated the bios to the latest version: https://docs.opnsense.org/hardware/bios.html#dec800-and-dec3800-series

Also I can change terminal type, console speed, party, stop bits and so on, but still have the same problem….

Title: Re: DEC3860 mini-USB Console
Post by: Patrick M. Hausen on May 22, 2022, 10:06:03 pm
System > Settings > Administration > Console is set to "Serial Console"?
And then there was a mention in the release notes once, that you need to disable a certain "legacy" feature ... waitaminute ...

https://forum.opnsense.org/index.php?topic=27432
Quote
In the BIOS: AMD CBS->FCH-UART ->Uart 0 Legacy Options: Disabled
Best make sure to remove the hw.console.uart tunable when this is set.
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 22, 2022, 10:35:59 pm
System > Settings > Administration > Console is set to "Serial Console"?
And then there was a mention in the release notes once, that you need to disable a certain "legacy" feature ... waitaminute ...

Not 100% sure but I think "Serial Console" is set on my system. At least I have never chnaged it. Thats also the reason I need console access as I have changed some VLANs and have no access to the web gui anymore  ::)


https://forum.opnsense.org/index.php?topic=27432
Quote
In the BIOS: AMD CBS->FCH-UART ->Uart 0 Legacy Options: Disabled
Best make sure to remove the hw.console.uart tunable when this is set.

Yes this I have disabled legacy UART support (see above link)...

Title: Re: DEC3860 mini-USB Console
Post by: Patrick M. Hausen on May 22, 2022, 10:40:19 pm
115200, 8N1 I assume is a given. You could try fiddling with the hardware handshake (RTS/CTS) setting. I mean the serial port config in putty. Other than that I am running out of ideas, too.
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 22, 2022, 11:04:41 pm
115200, 8N1 I assume is a given. You could try fiddling with the hardware handshake (RTS/CTS) setting.

yes have already done that - also have no more ideas...
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 24, 2022, 12:40:26 am
May OPNsense staff has an idea how to recover console access - @franco ?
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 24, 2022, 10:02:12 am
Biggest question is what version is running there?


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 24, 2022, 10:49:36 am
This is the latest version 22.4.2
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 24, 2022, 11:13:57 am
You mean 22.4_2 but that version is fine either way. The console works reliably with the included kernel.

Make sure to disable legacy UART in BIOS and remove hw.uart.console tunable from the GUI. UEFI serial console is a bit wonky on FreeBSD but that's no operational concern.


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 24, 2022, 11:22:11 am
Little more documentation here

https://docs.opnsense.org/hardware/serial_connectivity.html
https://docs.opnsense.org/manual/how-tos/serial_access.html


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 24, 2022, 03:35:42 pm
Thanks for your replay @franco, very appreciated.

I have already disabled legacy UART as described in the documentation. Unfortunately as I'm unable to access the GUI / SSH I can't remove hw.uart.console tunable...

During bootup I can follow all the boot messages from console. So console access works in general. But it stops always after the following messages:

Quote
Starting syslog_ng.
>>> Invoking start script 'carp'
>>> Invoking start script 'cron'
Starting Cron: OK
>>> Invoking start script 'beep'
Root file system: /dev/gpt/rootfs
Sun May 22 21:45:00 CEST 2022

*** opnsense.domain: OPNsense 22.4_2 (amd64/OpenSSL) ***

 XXXXX_VLAN (vlan03) -> v4: XXX.XXX.XXX.XXX/XXX
 XXXXX_VLAN (igb0_vlanXXX) -> v4: XXX.XXX.XXX.XXX/XXX
 XXXXX_VLAN (vlan02) -> v4: XXX.XXX.XXX.XXX/XXX
 WAN_ax1_phy (ax1) ->
 WAN_ax1_XXXX (ax1_XXXXX) ->
 WAN_igb3_XXXX (igb3) -> v4: XXX.XXX.XXX.XXX/XXX

 HTTPS: SHA256 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 SSH:   SHA256 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (ECDSA)
 SSH:   SHA256 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (ED25519)
 SSH:   SHA256 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (RSA)
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 24, 2022, 04:14:07 pm
It looks like the console was disabled if it's not asking for "root" prompt. Unsure what to do here. SSH should be available according to the hashes as is the GUI but which rules are preventing it from access I don't know.

You could boot a serial image of 22.4 and get into that system by mounting the actual hard disk, but I'm unsure what strategy should be used to restore what.. revert config so GUI/SSH access is there again? Try to unbreak console that looks to be misconfigured?

Begs the question when this was last working.


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 24, 2022, 05:27:53 pm
The system was working very well till I changed some VLAN IDs for management and client VLANs view days back (to avoid some conflicts on another system). After this I was unable to access the system either from web and ssh.

I have tried diffenrent setups with old and new VLAN IDs and was not able to regain access on the IP path. Thats why I tried to access it via console to either create a new (blank non VLAN) interface or restore a backup from bevor the changes.

So the easiest would be to regain IP access but also would be happy to connect via console... So assuming console is disabled (which actually should not be the case), is there any hidden trick to enable console during boot up? 
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 24, 2022, 06:38:45 pm
Hmmm just checked one of the latest backup files and have found this:

Code: [Select]
<disableconsolemenu>1</disableconsolemenu>
Looks like I have disabled console once in the past (even if I don't why I should have done this  ::) )
Title: Re: DEC3860 mini-USB Console
Post by: Patrick M. Hausen on May 24, 2022, 06:41:11 pm
Shouldn't that just present a login prompt instead of the menu?

Franco?
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 24, 2022, 06:44:08 pm
Shouldn't that just present a login prompt instead of the menu?

Franco?

Yes you're probably right. But I don't even get the promt
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 25, 2022, 11:15:56 am
Hmmm just checked one of the latest backup files and have found this:

Code: [Select]
<disableconsolemenu>1</disableconsolemenu>
Looks like I have disabled console once in the past (even if I don't why I should have done this  ::) )

@Franco, is there a way (hack) to enable console without web or SSH access?
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 25, 2022, 11:35:39 am
Look, login(1) doesn't work. Whether it lets you auto-login or prompt for a user/password both of these things don't work if login(1) doesn't have a console to attach to. It could even be that the /etc/login.conf is trashed which is rare but it can happen. Manual recovery or troubleshoot of damaged file systems is difficult. Reinstall from an image with config import is a quick and easy recovery mechanism.

Still the question is if 22.4 serial stick behaves the same way and if maybe a 21.10 stick would not have these issues (different FreeBSD version).

And to stress that point: the "serial" image use is important here.


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: Patrick M. Hausen on May 25, 2022, 12:57:51 pm
You could still boot single user and try to find out what's disabling the login prompt. You'll need quite a bit of FreeBSD experience, though, and I doubt this can be solved by question/answer ping pong via the forum in a reasonable amount of time.

Booting from an install/live medium to check if the serial console works *at all* is probably a good idea. And a way to a rescue procedure - boot into live mode, manually mount the installed system drive, copy the config.xml and look for hints what went wrong. Then sanitize the XML config, reinstall, reimport ...
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 25, 2022, 01:17:36 pm
Thanks for your replay Franco - very appreciated!

I have booted from serial USB image and console works well.

I know whats wrong on the config.xml to make the system working again. So would it not be possible to mount the local disk into the USB life environment or single user (as pmhausen mentioned), make manual changes on config.xml and boot again from local disk?

What type of device should I look at for the local disk on the DEC3860?
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 25, 2022, 01:32:59 pm
When having booted the stick go to console (option 8) and type

# opnsense-importer -m

It'll list the devices to attach to and mount it for you and execute  a shell for manual repair. It's going to tell you where the disk is mounted. Inside that directory under $DIR/conf/config.xml is the file to edit. Then type "exit" and reboot the stick. If it was the config.xml change the system should come back fine.

If not there are backups under $DIR/conf/backup/ that might help shed some light on what change was done when.

In any case fingers crossed. :)


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 25, 2022, 02:08:35 pm
System up and running!  :)

I have SSH and web access to the firewall again.

Strange that console is still not working. In config.xml I have chnaged
Code: [Select]
<disableconsolemenu>1</disableconsolemenu> to "0". Looking at the GUI (see attached print screen) it should be enabled from my point of view.

BIOS has been set to UART Configuration Options --> UART 0 Legacy Options. Going to remove "hw.uart.console" and reboot and will report back...



Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 25, 2022, 02:10:02 pm
Was to fast.
Code: [Select]
hw.uart.console does not even exist on my system
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 25, 2022, 02:20:07 pm
USB-base serial ports setting is wrong. This is for directly connected USB consoles, not adapters that expose USB connectivity.

Pretty sure that's the issue (image defaults to off).


Cheers,
Franco
Title: Re: DEC3860 mini-USB Console
Post by: Mbl on May 25, 2022, 02:42:22 pm
USB-base serial ports setting is wrong.

This did the trick. It's working now...

Thanks again for your superbe support!
Title: Re: DEC3860 mini-USB Console
Post by: franco on May 25, 2022, 02:48:45 pm
Yay, happy to help :)


Cheers,
Franco