|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
| Recommended Links | grub | Runlevels | Xinetd | ||
|
|
GNU Screen | Serial Console on Solaris |
Humor |
Etc |
Linux kernels can output information to serial ports. This is useful for debugging kernel panics and hardware issues with video devices or headless servers.
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.el5If your serial console is oncom1=115200,8n1module /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=RHEL5_i386console=tty0console=ttyS0,115200module /boot/initrd-2.6.18-92.el5xen.img
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.imgSave 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.
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 vt102This 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 115200Hit 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/ttyS0If 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] 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 2008On 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
Chris.Knadle@coredump.us
____________________________________________________________ _________________
Hire expert Linux talent by posting jobs here :: http://jobs.nylug.org
The nylug-talk mailing list is at nylug-talk@nylug.org
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
Ruben Safir
Messages: 219
Registered: January 2008 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
- Previous message: Console Redirection After Boot
- Next message: Console Redirection After Boot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)
Remote Serial Console HOWTO Also at Remote Serial Console HOWTO
Enabling Linux Serial Console with a Script - NachoTech Blog
Configuring a Remote Serial Console for SLES
Linux Online - Upgrading Red Hat Linux from a serial console
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
- The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with.
- We do not warrant the correctness of the information provided or its fitness for any purpose
- In no way this site is associated with or endorse cybersquatters using the term "softpanorama" with other main or country domains (e.g. softpanorama.com) with bad faith intent to profit from the goodwill belonging to someone else.
Last modified: August 21, 2009