Size: 4628
Comment:
|
Size: 6487
Comment: Update for newer Ubuntu releases and other fixes
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
This document presents (almost) the minimum amount of work required to enable a serial console login on an Ubuntu 6.06 installation. (Minor changes have been added to improve performance) Both server and client settings are included. | This document presents (almost) the minimum amount of work required to enable a serial console login on an Ubuntu 6.06 and later versions. (Minor changes have been added to improve performance.) Both server and client settings are included. |
Line 3: | Line 3: |
This procedure was developed using the Remote Serial Console HOWTO ([ http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html]), and adapted to apply specifically to Ubuntu 6.06. The reader is referred to this document for any issues arising from using this HOWTO. |
This procedure was developed using the Remote Serial Console HOWTO (see "External links" below), and adapted to apply specifically to Ubuntu. The reader is referred to this document for any issues arising from using this HOWTO. |
Line 7: | Line 6: |
* You have enabled the serial console in your BIOS. * The serial connection is being made at 115200 baud 8n1, on console port /dev/ttyS0 (9600 8n1 is the default fall back if your hardware does not support 115200 baud) |
* You have enabled the serial console in your BIOS.[[FootNote(This is only needed if you plan to use serial console to enter BIOS configuration utility or observe early startup messages even before GRUB starts. Note, that in some cas1es it may interfere with GRUB settings described below. If you're sure you've configured GRUB correctly, but the serial menu does not appear, try '''disabling''' serial console support in BIOS.)]] * The serial connection is being made at 115200 baud 8n1, on first serial port, called /dev/ttyS0 in linux (9600 8n1 is the default fall back if your hardware does not support 115200 baud) |
Line 12: | Line 11: |
Note: an excellent resource is: http://www.lammertbies.nl/comm/cable/yost-serial-rj45.html which will show you how to make Serial to Cat 5 adaptors. | If you want to use a standard Ethernet/RJ-45 cable for serial connection you can buy a couple of Serial to Cat 5 adapters or [http://www.lammertbies.nl/comm/cable/yost-serial-rj45.html make one yourself]. |
Line 17: | Line 16: |
This section details how to configure the 'getty' process to enable a login via the console port. | This section details how to configure the 'getty' process to enable a login via the console port. You need to configure either an Upstart system or the older inittab, depending on Ubuntu version you are using. |
Line 19: | Line 18: |
==== Configuring upstart (Edgy and newer) ==== Paste the following into /etc/event.d/ttyS0 {{{ # ttyS0 - getty # # This service maintains a getty on ttyS0 from the point the system is # started until it is shut down again. start on runlevel 2 start on runlevel 3 start on runlevel 4 start on runlevel 5 stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 respawn exec /sbin/getty 115200 ttyS0 }}} ==== Configuring inittab (Dapper and older) ==== |
|
Line 20: | Line 42: |
NOTE: In newer versions of ubuntu, inittab is no longer used. Instead, look in /etc/event.d and make modifications there. |
|
Line 48: | Line 66: |
Line 105: | Line 124: |
'''NOTE:''' the first console parameter is 'console=tty0', '''not''' ttyS0 | Note two "console=" kernel options. You can specify this option several times. All devices, mentioned in it will receive kernel messages (those, generated by printk() and seen by dmesg). However, stdin/stdout/stderr of {{{/sbin/init}}} process will be set to the last device only, therefore '''only the last device''' will show startup messages and act as a console in single-user mode. |
Line 110: | Line 129: |
1) Ensure you have a read/write permissions on /dev/ttyS0. {{{ $ ls -l /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 2007-12-20 13:56 /dev/ttyS0 $ id -Gn |grep dialout }}} if the last command didn't show an output add yourself to {{{dialout}}} group and logout/login: {{{ sudo adduser $USER dialout }}} |
|
Line 111: | Line 140: |
1) Install minicom | Alternatively, you can always run minicom through sudo, but it's not recommended. 2) Install minicom |
Line 116: | Line 147: |
2) Configure minicom. | 3) Configure minicom. |
Line 118: | Line 150: |
sudo minicom -s | minicom -s |
Line 121: | Line 153: |
3) Configure client serial port settings: In Serial port setup, set the following options | 4) Configure client serial port settings: In Serial port setup, set the following options |
Line 127: | Line 159: |
4) Configure Initialization string: In Modem and dialing clear the init | 5) Configure Initialization string: In Modem and dialing clear the init |
Line 132: | Line 164: |
5) Save setup as dfl | 6) Save setup as dfl |
Line 134: | Line 166: |
6) You might need to press enter several times to get the connection running. | 7) You might need to press enter several times to get the connection running. |
Line 136: | Line 168: |
7) To log on in the future, run | 8) To log on in the future, run |
Line 138: | Line 170: |
sudo minicom | minicom |
Line 142: | Line 174: |
== External links == * [http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html Serial Console Howto] * [http://www.rajeevnet.com/linux/grub_serial_console.html Setup Serial Console with GRUB bootloader] * [http://www.cpqlinux.com/serialconsole.html Serial Console] |
This document presents (almost) the minimum amount of work required to enable a serial console login on an Ubuntu 6.06 and later versions. (Minor changes have been added to improve performance.) Both server and client settings are included.
This procedure was developed using the Remote Serial Console HOWTO (see "External links" below), and adapted to apply specifically to Ubuntu. The reader is referred to this document for any issues arising from using this HOWTO.
Assumptions
You have enabled the serial console in your BIOS.FootNote(This is only needed if you plan to use serial console to enter BIOS configuration utility or observe early startup messages even before GRUB starts. Note, that in some cas1es it may interfere with GRUB settings described below. If you're sure you've configured GRUB correctly, but the serial menu does not appear, try '''disabling''' serial console support in BIOS.)
- The serial connection is being made at 115200 baud 8n1, on first serial port, called /dev/ttyS0 in linux (9600 8n1 is the default fall back if your hardware does not support 115200 baud)
- You are comfortable editing critical system files such as /etc/inittab, /boot/grub/menu.lst
- You are using a serial (null modem) cable. It is also possible to use a USB to Serial adaptor, but the tty* must be changed to reflect your hardware.
If you want to use a standard Ethernet/RJ-45 cable for serial connection you can buy a couple of Serial to Cat 5 adapters or [http://www.lammertbies.nl/comm/cable/yost-serial-rj45.html make one yourself].
Server Setup
Configuring the console login process
This section details how to configure the 'getty' process to enable a login via the console port. You need to configure either an Upstart system or the older inittab, depending on Ubuntu version you are using.
Configuring upstart (Edgy and newer)
Paste the following into /etc/event.d/ttyS0
# ttyS0 - getty # # This service maintains a getty on ttyS0 from the point the system is # started until it is shut down again. start on runlevel 2 start on runlevel 3 start on runlevel 4 start on runlevel 5 stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 respawn exec /sbin/getty 115200 ttyS0
Configuring inittab (Dapper and older)
1) Edit /etc/inittab
sudo vi /etc/inittab
2) Change the following line:
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
to:
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
3) Restart init:
sudo /sbin/telinit q
At this point, a new login prompt should appear on the output of the serial console.
Configuring grub
This section details how to get grub talking via the serial port.
This section is optional if the user does not want grub interaction via the serial console port.
1) Edit /boot/grub/menu.lst:
vi /boot/grub/menu.lst
2) Add the following lines to the top of the file:
# Enable console output via the serial port. unit 0 is /dev/ttyS0, unit 1 is /dev/ttyS1... serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal --timeout=15 serial console
3) When you next reboot, the output from grub will go to the normal console unless input is received from the serial port. Whichever receives input first becomes the default console. This gives you the best of both worlds.
Configuring the kernel boot parameters
This section details how to configure the kernel boot parameters to get boot information through the console port.
This section is optional if the user does not want the kernel boot messages to appear on the serial console port.
The following procedure can be carried out by modifying the 'kernel' line in grub prior to committing the changes directly to the /boot/grub/menu.lst file.
1) Edit /boot/grub/menu.lst:
sudo vi /boot/grub/menu.lst
2) Modify the kernel line for the image you want to boot using the serial console on. In this case, I'm setting up the default 2.6.10-5.386 kernel to use the serial console line. Change:
title Ubuntu, kernel 2.6.10-5-386 root (hd0,0) kernel /boot/vmlinuz-2.6.10-5-386 root=/dev/hda1 ro quiet splash initrd /boot/initrd.img-2.6.10-5-386 savedefault boot
to:
title Ubuntu, kernel 2.6.10-5-386 root (hd0,0) kernel /boot/vmlinuz-2.6.10-5-386 root=/dev/hda1 ro quiet splash console=tty0 console=ttyS0,115200n8 initrd /boot/initrd.img-2.6.10-5-386 savedefault boot
Note two "console=" kernel options. You can specify this option several times. All devices, mentioned in it will receive kernel messages (those, generated by printk() and seen by dmesg). However, stdin/stdout/stderr of /sbin/init process will be set to the last device only, therefore only the last device will show startup messages and act as a console in single-user mode.
3) Reboot into this kernel. Output from the boot process should be sent via the serial console line.
Client Setup
1) Ensure you have a read/write permissions on /dev/ttyS0.
$ ls -l /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 2007-12-20 13:56 /dev/ttyS0 $ id -Gn |grep dialout
if the last command didn't show an output add yourself to dialout group and logout/login:
sudo adduser $USER dialout
Alternatively, you can always run minicom through sudo, but it's not recommended.
2) Install minicom
sudo apt-get install minicom
3) Configure minicom.
minicom -s
4) Configure client serial port settings: In Serial port setup, set the following options
A - Serial device: /dev/ttyS0 E - Bps/Par/Bits: 115200 8N1
5) Configure Initialization string: In Modem and dialing clear the init
A - Init string .....
6) Save setup as dfl
7) You might need to press enter several times to get the connection running.
8) To log on in the future, run
minicom
and press enter several times if it does not come up on start up.
External links
[http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html Serial Console Howto]
[http://www.rajeevnet.com/linux/grub_serial_console.html Setup Serial Console with GRUB bootloader]
[http://www.cpqlinux.com/serialconsole.html Serial Console]