[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
howtos:general_admin:serial_console [2012/12/15 12:55 (UTC)] – created fdonkers | howtos:general_admin:serial_console [2014/11/14 09:18 (UTC)] (current) – add GRUB2 section fdonkers | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <!-- Reviewed 2013-01-06 mfillpot --> | ||
<!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> | <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> | ||
====== Serial Console ====== | ====== Serial Console ====== | ||
+ | Slackware can be installed on various embedded devices. A lot of those don't | ||
+ | have a traditional console, like a monitor and keyboard. Instead, the console | ||
+ | is often routed to the serial port. In order to take advantage of this, some | ||
+ | post-install configuration is necessary. | ||
- | Slackware can be installed on various embedded devices. A lot of those don't have a traditional console, like a monitor and keyboard. Instead, the console is often routed to the serial port. In order to take advantage of this, some post-install configuration is necessary. | + | This howto can also be used to setup a serial console on an existing headless |
- | + | server as a backup for administering the machine. | |
- | This howto can also be used to setup a serial console on an existing headless server as a backup for administering the machine. | + | |
====== Preparation ====== | ====== Preparation ====== | ||
+ | You need to know the serial device and the speed. The device will mostly be | ||
+ | ttyS0, the first serial device. If you are using a serial to USB adapter, it | ||
+ | will likely be ttyUSB0. Consult the documentation of your board if you are | ||
+ | not sure. | ||
- | You need to know the serial device | + | Some devices have an option in the BIOS to change |
+ | settings. Make sure you know the speed that is currently set. | ||
- | Some devices have an option in the BIOS to change the speed and other serial settings. Make sure you know the speed that is currently set. | + | In the below examples we will assume ttyS0 with speed 38400. |
- | + | ||
- | In the below examples we will assume ttyS0 with speed 38400. | + | |
====== Host configuration ====== | ====== Host configuration ====== | ||
- | |||
===== Activate serial port ===== | ===== Activate serial port ===== | ||
+ | Edit ''/ | ||
+ | the speed setting when required. | ||
- | Edit '' | + | <file - / |
- | + | ||
- | <code> | + | |
# Local serial lines: | # Local serial lines: | ||
s1: | s1: | ||
# | # | ||
- | </code> | + | </file> |
===== Allow root login ===== | ===== Allow root login ===== | ||
- | + | Edit ''/ | |
- | Edit ''/ | + | login via the serial console. You can omit this step if you will access the |
- | + | machine with a normal user id. | |
- | <code> | + | <file - / |
# These are some remote ttys, and uncommenting them might be less than fully secure: | # These are some remote ttys, and uncommenting them might be less than fully secure: | ||
ttyS0 | ttyS0 | ||
# | # | ||
- | </code> | + | </file> |
===== Setup LILO boot loader ===== | ===== Setup LILO boot loader ===== | ||
- | + | Edit ''/ | |
- | Edit ''/ | + | <file - / |
- | <code> | + | |
serial=0, | serial=0, | ||
- | </code> | + | </file> |
- | The 0 refers to the first serial device, ttyS0. | + | The 0 refers to the first serial device, ttyS0. |
- | Add the following parameter to the kernel line: | + | Add the following parameter to the kernel line: |
- | <code> | + | <file - / |
append=" | append=" | ||
- | </code> | + | </file> |
- | If the '' | + | If the //append// line already exists, add the parameter as follows: |
- | <code> | + | <file - / |
append=" | append=" | ||
- | </code> | + | </file> |
Now run ''/ | Now run ''/ | ||
- | To have the console on normal tty as well as serial port, adjust the kernel line as follows: | + | To have the console on normal tty as well as serial port, adjust the |
- | + | kernel line as follows: | |
- | <code> | + | <file - / |
append=" | append=" | ||
- | </code> | + | </file> |
- | ===== Setup GRUB boot loader ===== | + | ===== Setup GRUB-legacy |
+ | Edit ''/ | ||
- | Edit ''/ | ||
- | |||
Add lines to the general section as follows: | Add lines to the general section as follows: | ||
- | + | <file - / | |
- | <code> | + | |
serial --speed=38400 | serial --speed=38400 | ||
terminal serial | terminal serial | ||
- | </code> | + | </file> |
Add the following parameter to the kernel line: | Add the following parameter to the kernel line: | ||
- | <code> | + | <file - / |
console=ttyS0, | console=ttyS0, | ||
- | </code> | + | </file> |
- | The complete kernel line might look like this: | + | The complete kernel line might look like this (substitute your root |
- | + | partition and vmlinuz file): | |
- | <code> | + | <file - / |
kernel / | kernel / | ||
- | </code> | + | </file> |
- | To have the console on normal tty as well as serial port, adjust the terminal and kernel lines as follows: | + | To have the console on normal tty as well as serial port, adjust the |
- | + | terminal and kernel lines as follows: | |
- | <code> | + | <file - / |
terminal --timeout=5 serial console | terminal --timeout=5 serial console | ||
- | </code><code> | + | </file> |
+ | <file - / | ||
kernel xxx console=tty0 console=ttyS0, | kernel xxx console=tty0 console=ttyS0, | ||
+ | </ | ||
+ | |||
+ | When the terminal timeout expires, the first option (in this case serial) | ||
+ | will be chosen as the console. The normal bootloader timeout will start | ||
+ | when the terminal timeout ends. | ||
+ | |||
+ | ===== Setup GRUB2 boot loader ===== | ||
+ | Edit file ''/ | ||
+ | <file . grub> | ||
+ | GRUB_CMDLINE_LINUX_DEFAULT=" | ||
+ | </ | ||
+ | |||
+ | Add the following lines to define the console settings: | ||
+ | <file . grub> | ||
+ | GRUB_TERMINAL=serial | ||
+ | GRUB_SERIAL_COMMAND=" | ||
+ | </ | ||
+ | |||
+ | Now rebuild the GRUB2 configuration: | ||
+ | < | ||
+ | # grub-mkconfig -o / | ||
</ | </ | ||
- | |||
- | When the terminal timeout expires, the first option (in this case serial) will be chosen as the console. The normal bootloader timeout will start when the terminal timeout ends. | ||
====== Connect from a remote computer ====== | ====== Connect from a remote computer ====== | ||
+ | To use the serial console, you need to attach a second computer to the | ||
+ | serial port of the host. Use a null modem cable. Most modern computers no | ||
+ | longer have a serial port so you might need a serial to USB connector as | ||
+ | well. | ||
- | To use the serial console, you need to attach a second computer to the serial port of the host. Use a null modem cable. Most modern computers no longer have a serial port so you might need a serial to USB connector as well. | + | Once you have physically connected the machines, you need a communications |
- | + | package to interact with the console. Two popular options are **screen** | |
- | Once you have physically connected the machines, you need a communications package to interact with the console. Two popular options are //screen// and //minicom//. | + | and **minicom**. |
===== Connect using screen ===== | ===== Connect using screen ===== | ||
+ | This is the easiest option because it doesn' | ||
+ | Start **screen** and specify the serial device and the desired speed on the | ||
+ | command line. | ||
+ | < | ||
+ | user@darkstar$ screen / | ||
+ | </ | ||
- | This is the easiest option because | + | ===== Connect using minicom ===== |
+ | Before using minicom, you need to configure | ||
+ | as follows: | ||
< | < | ||
- | screen / | + | user@darkstar$ minicom -s |
</ | </ | ||
- | |||
- | ===== Connect using minicom ===== | ||
- | |||
- | Before using minicom, you need to configure it. Start with the '' | ||
- | |||
- | < | ||
You will see the main menu. | You will see the main menu. | ||
- | |||
< | < | ||
| | ||
Line 130: | Line 158: | ||
</ | </ | ||
- | Select //Serial port setup//. You will see the serial port settings. | + | Select //Serial port setup//. You will see the serial port settings. |
< | < | ||
+-----------------------------------------------------------------------+ | +-----------------------------------------------------------------------+ | ||
Line 146: | Line 173: | ||
</ | </ | ||
- | Use the < | + | Use the < |
+ | Make sure the //device// and // | ||
+ | < | ||
+ | //Modem and dialing// option. On the detail screen, make sure the | ||
+ | //Init string// and //Reset string// options are empty. Hit < | ||
+ | again to return to the main screen. Now you can save your options. Use | ||
+ | //Save setup as dfl// to save this as your new default. Use | ||
+ | //Save setup as..// to save as a certain profile. | ||
- | Call minicom again and the new options will take effect. | + | Call minicom again and the new options will take effect. |
- | + | < | |
- | < | + | user@darkstar$ |
+ | </ | ||
Or you can start with a certain configuration | Or you can start with a certain configuration | ||
+ | < | ||
+ | user@darkstar$ minicom myprofile | ||
+ | </ | ||
- | < | + | Use <key>C-a</ |
- | + | to quit. | |
- | Use <key>CTRL-A</ | + | |
====== Troubleshooting ====== | ====== Troubleshooting ====== | ||
- | |||
===== Garbled characters in terminal ===== | ===== Garbled characters in terminal ===== | ||
- | + | When you see progress in the terminal but the characters are garbled and | |
- | When you see progress in the terminal but the characters are garbled and unreadable, make sure you have the same speed set in the following sections: BIOS, bootloader and inittab. Also make sure your client connects with the same speed. | + | unreadable, make sure you have the same speed set in the following |
+ | sections: BIOS, bootloader and inittab. Also make sure your client connects | ||
+ | with the same speed. | ||
===== Unable to sign on as root ===== | ===== Unable to sign on as root ===== | ||
- | + | Check the '' | |
- | Check the '' | + | |
===== Unable to use screen or minicom as a regular user ===== | ===== Unable to use screen or minicom as a regular user ===== | ||
- | |||
When you get authorization problems using the serial device, make sure your user is in the '' | When you get authorization problems using the serial device, make sure your user is in the '' | ||
====== Further reading ====== | ====== Further reading ====== | ||
- | + | | |
- | | + | * screen [[http:// |
- | * screen [[http:// | + | |
* '' | * '' | ||
Line 189: | Line 224: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
<!-- You must remove the tag-word " | <!-- You must remove the tag-word " | ||
- | {{tag> | + | {{tag> |