Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Configuring serial console in Red Hat and Suse

News

Recommended Books

Recommended Links grub Runlevels Xinetd

 Installation Checklist

How to use TeraTerm for the Serial Console

GNU Screen Serial Console on Solaris

Humor

Etc

Linux kernels can output information to serial ports. This is useful for installation if you do not have DRAC or ILI cards, debugging kernel panics and hardware issues with video devices or headless servers. In case of installation you can connect laptop to the server and use it as "poor man Drac carde". 

To receive kernel information on a serial port modify the /boot/grub/grub.conf  file by setting the appropriate serial device parameters.

If your serial console is on com1, modify /boot/grub/grub.conf  by inserting the lines com1=115200,8n1, console=tty0  and console=ttyS0,115200   where shown.

title Red Hat Enterprise Linux 5 i386 Xen (2.6.18-92.el5xen)
	root (hd0, 8)
	kernel /boot/xen.gz-2.6.18-92.el5 com1=115200,8n1
	module /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=RHEL5_i386 console=tty0
	console=ttyS0,115200
	module /boot/initrd-2.6.18-92.el5xen.img
If your serial console is on com2, modify /boot/grub/grub.conf  by inserting the lines com2=115200,8n1 console=com2L, console=tty0 and console=ttyS0,115200  where shown.
title Red Hat Enterprise Linux 5 i386 Xen (2.6.18-92.el5xen)
	root (hd0, 8)
	kernel /boot/xen.gz-2.6.18-92.el5 com2=115200,8n1 console=com2L
	module /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=RHEL5_i386 console=tty0
	console=ttyS0,115200
	module /boot/initrd-2.6.18-92.el5xen.img
Save the changes and reboot the host. The hypervisor outputs serial data on the serial port(com1, com2  or other port) you selected in the previous step.

Note the example using the com2  port, the parameter console=ttyS0 on the vmlinuz line us used. The behavior of every port being used as console=ttyS0 is not standard Linux behavior and is specific to the Xen environment.


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

Learn to use a serial console on Linux TechGuides Open Source ZDNet Asia

To begin, all you really need is the null-modem cable and two systems with serial ports, making sure the serial ports are enabled in the BIOS. On the server, edit /etc/inittab and add:
S0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt102

This tells init to launch agetty, listening on /dev/ttyS0 (the first serial port) at a baud-rate of 115200bps, and to use vt102 terminal emulation. On the client, once the null-modem cable is in place and agetty is running, use screen to connect:

$ screen /dev/ttyS0 115200

Hit enter once screen starts and you will be sitting at a familiar login prompt on the remote system. To disconnect, simply type [CTRL-A]+K in screen, after logging out.

If you were so inclined, you could also force syslog to send all logs to the serial port as well, for observation over the serial line. This can be done by modifying /etc/syslog.conf to add:

*.* /dev/ttyS0

If nothing else, should you need to connect to some hardware via the console, like a network router or switch, being able to use screen to manage the serial connection is a great and easy way to do so. Virtually all Linux distributions either come with screen preinstalled, or it's a simple apt-get, urpmi, or yum away. Most Linux distributions come with agetty already installed.

NYLUG-Talk NYLUG-Talk = [nylug-talk] serial console on Dell PowerEdge 1950

[nylug-talk] serial console on Dell PowerEdge 1950? [message #3087 is a reply to message #3084 ] Thu, 23 October 2008 00:51

Chris Knadle
Messages: 174
Registered: January 2008
Senior Member

On Wednesday 22 October 2008 18:15:34 Alex Pilosov wrote:

> On Wed, 22 Oct 2008, Joachim Rosenfeld wrote:
> > hello,
> >
> > What should I do to get the serial console working on a Dell PowerEdge
> > 1950?
> >
> > With Sun servers, I just plug in and I'm good to go, but with these PCs,
> > I'm not sure what to do. Do I flip a BIOS setting? Add a kernel
> > parameter to grub?

Yes -- either by adding it manually to each 'kernel' menu item,
or to the #kopt line in the grub.conf to have the 'update-grub'
program add it to all 'kernel' menu items (assuming that your
distribution contains 'update-grub'), such as:

# kopt=root=/dev/hda1 ro console=ttyS0,38400n8

(Note the "#", that's not an error -- single #'s are taken as
configuration options for 'update-grub'.)

Also, if you're using this box as a headless machine, you might
want to redirect the text output from GRUB itself to the serial
port via configuration in the grub.conf so you can see and use
the GRUB menu through the serial port:

## Redirect the Grub menu to the serial port
serial --speed=38400
terminal serial

(Double ##'s marks a comment.)

If you want to LOG IN via the serial port then you'll also need
to modify /etc/inittab (if you have one) and add something like:

T0:23:respawn:/sbin/getty -L ttyS0 38400 vt100

I believe Ubuntu no longer uses an /etc/inittab since they
switched to using 'upstart', so if you're running Ubuntu look
in /etc/event.d/ for doing something similar.

> > Recompile the kernel?

No need to for this that I know of.

-- Chris

--

Chris Knadle
[email protected]
____________________________________________________________ _________________
Hire expert Linux talent by posting jobs here :: http://jobs.nylug.org
The nylug-talk mailing list is at [email protected]
The list archive is at http://nylug.org/pipermail/nylug-talk
To subscribe or unsubscribe: http://nylug.org/mailman/listinfo/nylug-talk

Re: [nylug-talk] serial console on Dell PowerEdge 1950? [message #3088 is a reply to message #3087 ] Thu, 23 October 2008 01:31 Go to previous messageGo to next message
Ruben Safir  is currently offline Ruben Safir
Messages: 219
Registered: January 2008
Senior Member
Chris Knadle wrote:
> On Wednesday 22 October 2008 18:15:34 Alex Pilosov wrote:
>
>> On Wed, 22 Oct 2008, Joachim Rosenfeld wrote:
>>
>>> hello,
>>>
>>> What should I do to get the serial console working on a Dell PowerEdge 1950?
>>>
>>> With Sun servers, I just plug in and I'm good to go, but with these PCs, I'm not sure what to do. Do I flip a BIOS setting? Add a kernel parameter to grub?
>>>
>
> Yes -- either by adding it manually to each 'kernel' menu item, or to the #kopt line in the grub.conf to have the 'update-grub' program add it to all 'kernel' menu items (assuming that your distribution contains 'update-grub'), such as:
>
> # kopt=root=/dev/hda1 ro console=ttyS0,38400n8
>
> (Note the "#", that's not an error -- single #'s are taken as configuration options for 'update-grub'.)
>
> Also, if you're using this box as a headless machine, you might
> want to redirect the text output from GRUB itself to the serial
> port via configuration in the grub.conf so you can see and use
> the GRUB menu through the serial port:
>
> ## Redirect the Grub menu to the serial port serial --speed=38400 terminal serial
>
> (Double ##'s marks a comment.)
>
> If you want to LOG IN via the serial port then you'll also need
> to modify /etc/inittab (if you have one) and add something like:
>
> T0:23:respawn:/sbin/getty -L ttyS0 38400 vt100
>
> I believe Ubuntu no longer uses an /etc/inittab since they
> switched to using 'upstart', so if you're running Ubuntu look
> in /etc/event.d/ for doing something similar.
>
>

He might need a getty processs once he is booted

Ruben
>>> Recompile the kernel?
>>>
>
> No need to for this that I know of.
>
> -- Chris

Console Redirection After Boot

eclark eclark at alabanza.com
Wed Nov 1 08:37:01 CST 2006
Heres one! How do you stop console re-redirection from happeing _during_ boot? 
I have in the past needed to grab the boot sequence from a serial console, 
but once the linux kernel kicks on, I completely loose serial console. Is 
there any way to force serial console redirection in the kernel, so I can log 
boot sequences? It gets a bit old having to continuously reboot to stare at 
scrolling messages when you are trying to do kernel testing.


On Wednesday 01 November 2006 08:36 am, Gary Rogers wrote:
> Here's the script I use to get the console re-directed to the DRAC4
> in my x850's (RHEL4). You'll need the OpenManage tools for it to
> work, and I'd suggest that you set your grub.conf your self. You
> really need to look out for the DRAC virtual CD-ROM as well, as this
> script WILL hang the system if you don't have the ide-scsi lines in
> grub.conf so that it's safe to disconnect the virtual CD-ROM.
>
> Works pretty well though, especially when ssh-ing to the DRAC and
> connecting to com1.
>
> #!/bin/bash
>
> set_securetty() {
>          cd /etc
>          backup_file securetty
>          echo "ttyS0" >> /etc/securetty
> }
>
> set_inittab() {
>          cd /etc
>          backup_file inittab
>          echo "co:2345:respawn:/sbin/agetty -h -L 57600 ttyS0 vt100"
>
>  >> /etc/inittab
>
> }
>
> set_grub() {
>          cat /boot/grub/grub.conf | perl -e '{ $value = join
> "",<STDIN>; $value =~ s/splashimage=\(hd0,0\)\/boot\/grub\/
> splash.xpm.gz/#splashimage=\(hd0,0\)\/boot\/grub\/splash.xpm.gz
> \nserial --unit=0 --speed=57600\nterminal --timeout=5 console serial/
> g; $value =~ s/root=LABEL=\//root=LABEL=\/ console=tty0
> console=ttyS0,57600/g; print $value }' > /tmp/grub.conf
>          cd /boot/grub
>          backup_file grub.conf
>          mv /tmp/grub.conf /boot/grub.conf
> }
>
> set_drac() {
> racadm getconfig -f /root/raccfg.bak
> cat << EOF > /root/drac.conf
> [cfgSerial]
> cfgSerialBaudRate=115200
> cfgSerialConsoleEnable=1
> cfgSerialConsoleQuitKey=,./
> cfgSerialTelnetEnable=1
>
> [cfgRacTuning]
> cfgRacTuneHostCom2BaudRate=57600
>
> [cfgRacVirtual]
> cfgVirMediaDisable=1
> EOF
>
> racadm config -f /root/drac.conf
> racadm racreset
> }
>
> set_inittab
> set_securetty
> set_grub
> set_drac
>
> On Nov 1, 2006, at 4:39 AM, Jerry Yu wrote:
> > I believe Brian's question is on 'bios redirect after boot' as in
> > 'os boot'. Dell PE series have BIOS redirect builtin and you can
> > enable it from BIOS to select serial port (ttyS0 or ttyS1), baud
> > rate (115200 or 57600 or 9600), and whether to have 'bios redirect
> > after boot'. I always have to turn off 'bios redirect after boot',
> > since it interferes with the agetty/mgetty listening on the same
> > serial port (CentOS 4 or RHAS 4).
> >
> >
> > On 11/1/06, Gordon Henderson < gordon at drogon.net> wrote:
> >
> > On Tue, 31 Oct 2006, Brian A. Seklecki wrote:
> > > All:
> > >
> > > What's the deal with this feature?  Was it intended to be used
> >
> > for any
> >
> > > relatively modern OS?
> > >
> > > It seems to work with DOS and Memtest86+, and perhaps then even
> >
> > some of
> >
> > > the bootable FreeDOS based utils available from Dell.
> > >
> > > But forget about using it for anything that "does not use the
> >
> > BIOS for
> >
> > > console I/O."
> > >
> > > All the Dell Linux docs I find suggest not using it; use the DRAC
> > > VGA->VNC feature instead,  but Dell really bungled that with the new
> > > DRAC5 and the ActiveX dependency (imagine that, an embedded Linux
> >
> > device
> >
> > > that serves an ActiveX applet -- the irony is painful)
> >
> > I can't answer your question about using BIOS for console IO, so
> > this may
> > not help, but I do use "console over serial" in many (remote) Linux
> > installations I have (None Dell, but I see no reason why it won't
> > work in
> > a Dell). You can make lilo use the serial line (and I'm sure grub
> > too),
> > and it's a compile & command-line feature for the linux kernel (but
> > I'd be
> > surprised it if wasn't included in the standard Dell/RH kernels,
> > and you
> > just needed to activate it somehow - eg. in the grub config file)
> >
> > In lilo.conf it's as simple as putting:
> >
> >   serial=0,57600n8
> >
> > in it somewhere, and to make linux use it, you need something like:
> >
> >   append="console=ttyS0,57600n8"
> >
> > in the same file. I'm sure grub does it in a similar fashion, but I
> > don't
> > use grub so can't comment there. I do it this way on another
> > vendors mobos
> > which have a BIOS over serial switch, so if required I can connect
> > to a
> > servers serial line (cisco terminal concentrator thingy) power
> > cycle it,
> > and from then on, do bios "stuff", then boot lilo and do lilo
> > poking, then
> > into linux (with extra command-line "stuff", if required, and it
> > all "just
> > works".
> >
> > There is also a comple-time version of memtest to make it work over a
> > serial-line too (rather than rely on the console redirection, I guess)
> > I've used this too (but also have the non-serial line version of
> > memtest86+ installed too!)
> >
> > Gordon
> >
> > _______________________________________________
> > Linux-PowerEdge mailing list
> > Linux-PowerEdge at dell.com
> > http://lists.us.dell.com/mailman/listinfo/linux-poweredge
> > Please read the FAQ at http://lists.us.dell.com/faq
> >
> >
> > _______________________________________________
> > Linux-PowerEdge mailing list
> > Linux-PowerEdge at dell.com
> > http://lists.us.dell.com/mailman/listinfo/linux-poweredge
> > Please read the FAQ at http://lists.us.dell.com/faq
>
> --------------------
> Gary Rogers
> Sr. Application Administrator
> University of Northern Iowa
> gary.rogers at uni.edu
> "Nothing but turtles all the way down."
> http://en.wikipedia.org/wiki/Turtles_all_the_way_down

RemoteConsoleNotes

To setup a serial console, do the following:
(Note: a more explicit explanation can be found at
http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Remote-Serial-Console-HOWTO.html

1) Configure grub (Note: This assumes COM1(or ttyS0) will be used)
Added to /etc/grub.conf:
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

Comment out:
splashimage=(hd0,0)/grub/splash.xpm.gz

Append to kernel definition that should use serial console:
console=tty0 console=ttyS0,9600n8
Example configuration:

default=0
timeout=10
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
#splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.18-14)
root (hd0,0)
kernel /vmlinuz-2.4.18-14 ro root=LABEL=/ console=tty0 console=ttyS0,9600n8
initrd /initrd-2.4.18-14.img
title Red Hat Linux (2.4.18-14) Single User
root (hd0,0)
kernel /vmlinuz-2.4.18-14 ro root=LABEL=/ console=tty0 console=ttyS0,9600n8 s
initrd /initrd-2.4.18-14.img

2) Turn on a getty
Added to /etc/inittab
# Used for remote console
ko:2345:respawn:/sbin/agetty -h ttyS0 9600 xterm

Change initdefault to 3
id:3:initdefault:

3) Allow root to login from serial console
Added to /etc/securetty
ttyS0

4) Remove saved console settings
rm /etc/ioctl.save

5) Alter target of /dev/systty
Change stty entry in /etc/makedev.d/linux-2.4.x to
l systty ttyS0

Recreate systty device
cd dev
rm systty
./MAKEDEV systty

6) Changed the variables in /etc/sysconfig/init to:
BOOTUP=serial
PROMPT=no

7) Change variable in /etc/sysconfig/kudzu to
SAFE=yes

Reboot....

When kudzu asks:
"Keep" the mouse configuration
"Configure" the serial console port

Recommended Links

Dell Power SolutionsEnabling Serial Port Console Redirection on Linux-based Dell Servers by By Christopher Stanton (February 2003)

Linux Serial Console HOWTO

Remote Serial Console HOWTO by Glen Turner & Mark F. Komarinski v2.6 2003-03-31

Enabling Linux Serial Console with a Script - NachoTech Blog

Configuring a Remote Serial Console for SLES Novell

Linux Online - Upgrading Red Hat Linux from a serial console

Learn to use a serial console on Linux | TechRepublic

Setting up a serial console | HowtoForge - Linux Howtos and Tutorials

Using serial console during Linux installation - Google Search



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019