- Linux Serial Console Connect
- Linux Serial Console Over Usb
- Linux Serial Console Azure
- Linux Serial Console App
- Linux Serial Console Auto Login
- Linux Serial Console Program
On this page
Console is a special sort of terminal, it was also a Physical device. Example in Linux we have virtual console which i can access them by combination of Ctrl + Alt + F1 to F7. Console sometimes means the keyboard and monitor physically attached to this computer. Disable Linux Serial Console. When serial console (at UART C) was enabled by default, kernel boots up just fine. However, when the console was disabled by the following commands at uboot prompt,the kernel seems not running properly as the Linux logo is hanging on screen for much longer time (like 45 minutes longer) before out application launches automatically.
- Setting up a serial console
Setting up a serial console
This tutorial will show you how to set up a serial console on a Linux system, and connect to it via a null modem cable. This is quite useful if your Linux server is in a headless configuration (no keyboard or monitor), as it allows you to easily get a console on the system if there are any problems with it (especially network problems, when SSH is not available). In the end, the GRUB menu will appear over the serial link, as will the bootup messages (output when booting the system). I'm using Debian Etch on the server and Ubuntu Edgy on my client, although this should work on any Linux distribution.
First steps
One of the most important things we need to check that you do actually have a serial port on the server :). Take a look at the back of your server, and see if it has a 9-pin serial port. Most motherboards have either one or two serial ports. On the system, check to see that Linux is recognising the serial ports:
Sewer pipe repair. [email protected]:~# dmesg | grep tty
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
This shows that my system has one serial port, ttyS0 (remember this for later).
GRUB configuration
The next step is to edit the GRUB configuration, so it sends its messages to the serial console. One of the most important things is to set a password, otherwise anyone can connect a serial cable, edit the GRUB configuration line while the system is booting (via the 'e' key), and get root access. When a password is set, interactive menu editing will be disabled, unless the correct password is entered. To set the password, we first need to get the encrypted version of it.
Run grub, and use the 'md5crypt' command to encrypt the password:
grub> md5crypt
Password: ********
Encrypted: $1$AlfMq1$FxRolxW5XvSLAOksiC7MD1
Password: ********
Encrypted: $1$AlfMq1$FxRolxW5XvSLAOksiC7MD1
Copy the encrypted version of the password (we need it for the next step), and then type quit to exit.
![Linux Linux](/uploads/1/2/6/3/126346947/944814396.png)
Now, we need to edit the GRUB configuration. Edit the /boot/grub/menu.lst file (by typing nano /boot/grub/menu.lst), and find this section:
Below that, add:
Replace $1$AlfMq1$FxRolxW5XvSLAOksiC7MD1 with the encrypted form of your password. The second line tells GRUB to initialise the serial port at 38,400 bps (same speed as the standard console), 8 data bits, no parity, and 1 stop bit (basically, the standard settings). Note that the --unit=0 means that it will use the first serial port (ttyS0). If you're using the second serial port (ttyS1), change it to --unit=1. The last line tells GRUB to show its menu on both the serial line and the console (monitor).
Now, we also need to edit the kernel sections, so that they output messages to the serial console. At the end of every kernel line, add console=tty0 console=ttyS0,38400n8 (replace ttyS0 with the correct serial port). In my case, it ended up looking like:
Save and exit, by pressing CTRL+O (to 'output', or save the file), Enter (to accept the file name) and CTRL+X (to actually exit).
Allow logins over Serial Console
Now, the GRUB menu will appear over the serial connection, but we still aren't listening for logins over it (there's no 'getty' running on it yet). Edit the /etc/inittab file, and find this section:
Below that (I don't like editing the default lines :P), add:
And that's all there is to it. Your server will now show the GRUB menu over the serial console, and also allow logons (once it has finished booting).
Let's test it!
Now that that's all done, we need to configure our client. I'm using GtkTerm on my laptop, although any terminal program should work (as long as it can use a serial port. On Windows, HyperTerminal should work). My laptop doesn't have a serial port, so I'm using a USB to Serial adapter I bought off eBay (it creates a ttyUSB0 device). Set your terminal program to these settings:
- Port (Linux):ttyS0 or ttyS1 (if your system has a serial port), or ttyUSB0 (if you're using a USB to Serial converter).
- Port (Windows): COM1 or COM2
- Bits per second: 38400
- Data bits: 8
- Parity: None
- Stop bits: 1
- Flow control: None, although hardware (RTS/CTS) should work properly
Linux Serial Console Connect
Restart the server (probably from a SSH connection, or however you edited the GRUB config above), and then connect the null modem cable as it's starting (ie. at the BIOS screen). Press any key when prompted, and you'll get something like:
This means that GRUB is working fine :). Press enter, and it should boot, showing all messages in the terminal window. Once it boots, it will look something like:
Linux Serial Console Over Usb
Finally, log in, and check that it works fine:
Congratulations, everything is set up and working fine.
Hope you enjoyed this tutorial! :)
![Linux Linux](/uploads/1/2/6/3/126346947/976891079.jpg)
Daniel15 (Daniel Lo Nigro)
http://www.daniel15.com/
http://www.dansoftaustralia.net/
http://www.daniel15.com/
http://www.dansoftaustralia.net/
Linux Serial Console Azure
Using a serial console on Linux is much like using a modem; the technology is virtually identical, but instead of using a modem to dial into a remote system, a special serial cable, called a null-modem cable, is strung between two computers via their serial ports. Most modern desktops and laptops no longer come with serial ports; however, virtually all server-class systems do.
The one system is set up to listen on one end of the cable, and the other system is used to log in, as the client, on the other end. This can be reverted very easily; a null-modem cable works both ways. Why use a serial console? For one, it can be very useful for debugging, particularly if the network is down and the system is headless. For another, you can use it to bypass security rules and bridge one network to another -- not for things like copying files, but purely for login purposes to obtain shell access to the other system. For instance, if you had a server in a DMZ, you could bypass potentially complex networking needs to obtain shell access to the server from a system on the LAN. This also could mean that running a remotely-accessible sshd service is no longer required on the DMZ server.
Linux Serial Console App
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:
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:
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.
Linux Serial Console Auto Login
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:
Linux Serial Console Program
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.
Passive grammar exercises. Passive Voice - Learning English with our free Online Exercises.
Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!