Can I put a card in a generic PC to make Linux have a serial console?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can I put a card in a generic PC to make Linux have a serial console?
I have a couple Linux boxes at home, and they're all based on desktop-class machines (i.e., not rackmountable servers). For example, a run of the mill Asus i3 motherboard.
If I have an issue with the system or want to do something in single user mode, I have to drag a monitor/mouse/keyboard over to it and access it that way. I could invest in a KVM setup but that is really overkill - and I couldn't access the console if I was remote anyway.
The boxes don't have serial ports on them (most PCs don't these days, alas) and I'm wondering if I can buy an add-on card and tell Linux "use this serial as your console" so that on boot all input goes there and I can connect to it from another server (via tip/cu).
I also have a USB-to-serial device and am wondering if that is an option. Ideally, I'd have both boxes running their consoles on serial ports, and then those serial ports could be accessed via tip from one server.
Or is this something that needs to be wired into the mobo?
I have a Soekris box (which is a small embedded system) with a serial port, and this is exactly what I do - but that port is directly on the mobo and the BIOS supports it, while my Linux boxes are generic PCs.
Yes, you can find lots of info on configuring a serial console but it depends on the distribution / version i.e using inittab or systemd etc. Most recent versions should be able to use a USB adapter but not confirmed.
If the system are on your LAN then why not use 'ssh' to access for work/maintenance?
ssh is only available after the network comes up. I'm talking about having the device talk to the serial as a console the moment the kernel starts booting.
A bit dated but the basic concept has not changed. We need to know what distribution / version you are running. Many have gone to using systemd or upstart and inittab is not used anymore.
Well I'm a little further along with this but it isn't quite working.
What I'm hoping is that after BIOS, everything from the grub stage on will go to the serial console. I've got the serial console working, but it only seems to come up after boot is finished.
And then did an update-grub2 but this made no difference. ttyS0 talks fine after boot, but I don't see boot (i.e., the kernel startup messages, the services starting, etc.)
I also tried the 40_custom which was the same.
As I understand things, while I can't get BIOS over serial, I should be able to get everything from grub on forward over serial. What I'm looking for is to have the serial port as the console, not just another login.
The magic sauce is that this is a two-phase problem. You have to tell grub and the kernel to use ttyS0.
So in addition to the above, you also need:
Code:
GRUB_CMDLINE_LINUX="console=ttyS0,115200"
One final question - once the console is up and running, I see the following on the console (tip'd in from another host). Everything is legible until the boot is finished, then it's garbage. I'm connecting at 115200...is there another setting needed?
Code:
[ ok ] Starting system message bus: dbus.
[ ok ] Starting ACPI services....
[ ok ] Starting network connection manager: NetworkManager.
[ ok ] Starting GNOME Display Manager: gdm3.
~xf~xfx`xf~`ffxf`ffxf~f``fxxffxf~fx``fx``枞`ffxf~fxfff`ffxxf~
Looking at this if you have source installed; /usr/source/linux/Documentation/kernel-parameters.txt;
You can also look at: kernel-parameters.txt , you will need to scroll down to console=;
Quote:
console= [KNL] Output console device and options.
tty<n> Use the virtual console device <n>.
ttyS<n>[,options]
ttyUSB0[,options]
Use the specified serial port. The options are of
the form "bbbbpnf", where "bbbb" is the baud rate,
"p" is parity ("n", "o", or "e"), "n" is number of
bits, and "f" is flow control ("r" for RTS or
omit it). Default is "9600n8".
See Documentation/serial-console.txt for more
information. See
Documentation/networking/netconsole.txt for an
alternative.
uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
Start an early, polled-mode console on the 8250/16550
UART at the specified I/O port or MMIO address,
switching to the matching ttyS device later. The
options are the same as for ttyS, above.
hvc<n> Use the hypervisor console device <n>. This is for
both Xen and PowerPC hypervisors..
You would need to pass this to the kernel to set things early.
Hope this helps.
Have fun & enjoy!
One thought that came to mind is what type of cable configuration are you using? Null modem cable for RS232 would be the easiest to setup if you not need handshaking.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.