LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-18-2014, 12:55 PM   #1
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Rep: Reputation: 1
Question 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.
 
Old 12-18-2014, 02:44 PM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

If the system are on your LAN then why not use 'ssh' to access for work/maintenance?
Have fun & enjoy!
Hope this helps.
 
Old 12-18-2014, 03:09 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
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.
 
Old 12-18-2014, 04:26 PM   #4
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by onebuck View Post
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.

This might be useful: http://www.vanemery.com/Linux/Serial...l-console.html
 
Old 12-18-2014, 04:36 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
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.
 
Old 12-18-2014, 04:39 PM   #6
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Original Poster
Rep: Reputation: 1
CentOS 7 and Debian 7, so both systemd and inittab at the moment. Would this only be supported on one or the other?
 
Old 12-18-2014, 04:47 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
Quote:
Would this only be supported on one or the other?
I don't understand your question.
 
Old 12-18-2014, 04:56 PM   #8
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Original Poster
Rep: Reputation: 1
Sorry, what I meant is "do Centos 7 and Debian 7 both support a serial console"?

I'm assuming they do, though the procedure for getting there is different, given that one is systemd and one is /etc/init.d
 
Old 12-18-2014, 05:37 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
Yes.
 
Old 12-23-2014, 03:44 PM   #10
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Original Poster
Rep: Reputation: 1
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.

I'm running Debian 7 and was using this guide: http://www.coreboot.org/Serial_console#GRUB2

I put this in /etc/default/grub:

Code:
# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=serial
GRUB_TERMINAL_OUTPUT=serial
GRUB_TERMINAL_INPUT=serial
GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"
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.
 
Old 12-23-2014, 05:13 PM   #11
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Original Poster
Rep: Reputation: 1
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~
 
Old 12-23-2014, 05:17 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
Try adding:
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"

http://wiki.linuxservertech.com/inde...155&artlang=en
 
Old 12-23-2014, 05:19 PM   #13
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

From: https://duckduckgo.com/l/?kh=-1&uddg...-4175528157%2F

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!
 
Old 12-24-2014, 09:27 AM   #14
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

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.
 
Old 12-24-2014, 10:57 AM   #15
raindog308
Member
 
Registered: Dec 2010
Posts: 34

Original Poster
Rep: Reputation: 1
Adding the 'n8' to

Code:
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
to specify line parameters solved the issue. Thanks to all for your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux serial console logging priyadarshan Linux - Newbie 5 08-28-2013 08:30 PM
serial console +plx tech console server card pankajd Linux - Hardware 1 10-14-2009 01:45 PM
System without video card but with serial cable console? Dims Linux - Newbie 23 06-08-2009 12:04 PM
initctl: make serial console unavailable polemon Fedora 1 03-18-2009 09:15 PM
generic serial mouse woes dharriso Linux - Hardware 5 08-07-2002 01:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration