Serial Terminal as Console
A frequently asked, but never completely answered, question in the comp.os.linux.* newsgroups and other Linux mailing lists, is the one about cheap, headless Linux boxes. It seems that many people need to install Linux boxes without a video card, a monitor or a keyboard.
A cheap response to this problem is to use a serial terminal (Wyse or Ampex, for example) as the main Linux console. This cuts the cost of a keyboard, a video card and a monitor. I've done this very thing on my second computer, an old 486 VLB, by using a Wyse 60 terminal.
Linking a terminal to your computer's serial port is not at all difficult. You can easily follow the instructions in the Serial-HOWTO and in the inittab(5) and agetty(8) man pages. Here's a short summary.
First, you must use a null modem cable.
Second, insert the following line in your /etc/inittab file, if you're using agetty. Other getty programs, like getty_ps, use a different syntax.
ID:RUNLEVELS:respawn:/sbin/agetty -L SPEED TTY TERM
ID = a two character identifier, e.g., s1 or s2
RUNLEVELS = Runlevels in which the terminal must be active
SPEED = serial port speed
TTY = tty port name relative to the /dev directory
TERM = value to be used for the TERM environment variable
My machine's /etc/inittab has the following line:
s2:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
for a serial terminal on the /dev/ttyS1 port (COM2 for DOS users), with a port speed of 9600 BPS and vt100 terminal emulation (which seems to run better than native Wyse 60 mode).
Finally, restart init with the command init q.
If you correctly followed these three simple steps, you should see the login prompt on your terminal screen. You can log in and work on your machine in the same way you can when you're actually on the console or telneting from a remote host.
The messages the kernel shows at boot time are always directed to your main console (tty1). If you turn on your headless box, you can only wait for the login on the terminal, which means losing those precious messages. You can see them by using the dmesg command, but usually you need them before the login shell comes up.
There are other messages on your console: those generated by the scripts in the /etc/rc.d directory, and from scripts run at boot and shutdown time. How can you really know that “the system is halted” if you can't read it on a monitor?
You must patch the /usr/src/linux/drivers/char/console.c program in your kernel source tree. It's not a complex kernel hack. You can follow these three simple steps.
First, define the CONFIG_SERIAL_ECHO symbol at program start:
Second, modify the address of the terminal serial port (only if you're using a port different from that defined by default) looking for the following line:
#define SERIAL_ECHO_PORT 0x3f8 /* COM1 */In my machine I've changed that line to:
#define SERIAL_ECHO_PORT 0x2f8 /* COM2 */Third, rebuild your kernel and reboot: you should see on your terminal screen the kernel messages during your system's hardware devices probe.
Please note that these steps work for a 2.0.0 kernel, not on 1.2.13. I haven't yet had time to try other kernels. The console.c patch is necessary for all Linux ports except the one for Alpha, which contains it in the make config with the following option:
Echo console messages on /dev/ttyS1
To show these messages on your terminal, you can append > TTY to every line of these files that contains the command echo. TTY is the terminal serial port (the same one used in /etc/inittab serial terminal line).
If you want to choose among more than two kernel images, you have to modif the LILO configuration file, /etc/lilo.conf.
Complete instructions for seeing the LILO prompt on serial terminals can be found in the /usr/doc/lilo/README file (look for the SERIAL option). Here are two steps to do that correctly.
First, edit the /etc/lilo.conf file and insert a SERIAL option line after the BOOT option line:
serial=SERIAL_LINE,SPEED PARITY BITS
SERIAL_LINE = 0 (com1) 1 (com2) 2 (com3) 3 (com4) SPEED = serial port speed PARITY = n (= none) o (= odd) e (= even) BITS = bits in a character (8 or 7)Please note that there are no spaces between the SPEED, PARITY and BITS parameters. These must be equal to the ones defined in your terminal setup. Here's the line used by my machine's LILO:
serial=1,9600n8This line means COM2 at 9600 BPS, no parity, 8 bits per character.
Second, execute the lilo command to update your system's configuration.
Using the SERIAL option, LILO sets a two second delay (the same as when you put a delay = 20 line in the lilo.conf file) before booting the default kernel image. During this pause, you can interrupt the boot process and get the LILO prompt by sending a break to the terminal as you press the SHIFT key on your main console.
|Contrast Security's Contrast Enterprise||Aug 30, 2016|
|illusive networks' Deceptions Everywhere||Aug 29, 2016|
|Happy Birthday Linux||Aug 25, 2016|
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Contrast Security's Contrast Enterprise
- illusive networks' Deceptions Everywhere
- Happy Birthday Linux
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- New Version of GParted
- All about printf
- ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs
- Tech Tip: Really Simple HTTP Server with Python
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide