- Linux Serial Console Via Usb Cable Adapter
- Linux Serial Port Console
- Usb To Serial Console Cable
- Linux Serial Console Setup
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. No cable box required. Find out why Close. Putty and USB Serial Ryan Winkler. Unsubscribe from Ryan Winkler? Bricked TP-Link WDR4300 Router Recovery Using UART Serial Converter.
On this page
- Setting up a serial console
- I've been trying to connect to the serial console of a Raspberry Pi 3 with Android Things using USB to TTL cable from my Linux (Ubuntu) machine.Despite I connected the cable as per the documentation, all I get when executing the minicom command is the following. With no chance to type in any character.So I neither can see any kernel messages nor shell into the device.
- Share the post 'How to install CentOS 5.5 via serial console' FacebookTwitterGoogle+LinkedInE-mail I would like to use an old Intel-Based small appliance to have a small-form-factor Linux server. So I have bought a Hama RS232 to USB cable. This device has been recognized by Linux as PL2303 and works out of the box. Connect serial cable.
- Fix Cisco USB console cable not working on windows 10. And now enter your COM port in your Emulator port to connect, like in my case I am using putty. Select the serial option and put your COM port number, that’s it. A final option is might be your cable have some issue, you need to buy new one.
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:
[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.
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
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:
Finally, log in, and check that it works fine:
Congratulations, everything is set up and working fine.
Hope you enjoyed this tutorial! :)
Daniel15 (Daniel Lo Nigro)
http://www.daniel15.com/
http://www.dansoftaustralia.net/
http://www.daniel15.com/
http://www.dansoftaustralia.net/
Active11 months ago
When all you have is a serial console (say via telnet through a terminal server), what methods can be used to transfer files in/out of a host?
Cut/paste works for the small/printable stuff and I've played with a combination of uuencode/uudecode (with gzip) handle the unprintable but it's all very limiting.
Caleb53.6k99 gold badges157157 silver badges200200 bronze badges
Stephen Paul LesniewskiStephen Paul Lesniewski
5 Answers
The serial console programs¹ you'll use on the other end of the connection will have some way to send a file to the remote side. How exactly you go about it depends on what resources you have available on the remote system.
I Have
lrzsz
or kermit
on the Remote SideThe easiest case is if you have a solid binary file transfer program installed on the remote side such as
lrzsz
or kermit
. This was once more common than today, but your particular system might still have one of these.The serial console program you're using on the local side almost certainly has a way to do a Zmodem or Kermit upload, which lets you send whatever you need directly.
In the case of Zmodem, just type
rz
on the remote system, which sends out a special string that the local serial terminal should understand, causing it to pop up a file picker dialog.Kermit is a simpler protocol, so you have to start the transfer manually in that case.
I Don't Have a Binary File Transfer Program, but I Do Have
uuencode
/base64
There are several advantages to using a proper binary file transfer program like
lrzsz
or kermit
: efficiency, checksumming, automatic retries, aborted transfer resumption, multiple file transfer, etc., but these are luxuries. If you only need to send one file, or you're sending files rarely, you can get away with ASCII uploads.Because terminal protocols interpret many of the byte values that occur in a binary data file, you can't send the file directly through the same connection; if you do, the terminal emulation code on either end will try to interpret some of the data, corrupting the data and likely confusing the terminal handling code as well.
You get around this by encoding the binary data into a safe subset of ASCII on the local side, then turning it back into raw binary data on the remote side. This is what the
uuencode
and base64
programs do, differing only in minor algorithm choices.On the local system, you encode the file:²
Then you type this command on the remote system, and send the file using the local serial console's 'ASCII upload' feature:
When the file upload finishes, hit Ctrl-C to get out of
cat
. Now you have your decoded file on the remote system, as you wanted.But I Have Many Files to Send, and Printable ASCII Transcoding Is a Pain!
It is not hard to bootstrap yourself up to a higher level of technology. If the remote system has a C compiler, you can use the prior technique to send the remote system a copy of the
lrzsz
source code. On the local side:Then on the remote system, type this via the serial console program:
After you start the first command, do an 'ASCII upload' of the
lrzsz.tgz.uue
file to the remote system. The pipeline accepts the uuencoded data and decodes it to a binary tarball for you, which you can unpack and build.But I Don't Have a C Compiler on the Remote System
If you don't even have a compiler on the remote system, you can cross-compile the
rz
(or whatever) program on the local system and send it to the remote system using the above technique.Linux Serial Console Via Usb Cable Adapter
Footnotes:
- minicom, picocom, PuTTY, VanDyke CRT...
- You have to give the input file name to this version of
uuencode
twice, once to name the source of the input data, and again to declare what the remote system should call the file when it decodes the data to an output file. You could conceivably want the remote system to have a different name for its output file.Your local version ofuuencode
may behave differently.
Community♦
Warren YoungWarren Young58k1212 gold badges148148 silver badges152152 bronze badges
Basically you have to use pre-internet methods to transfer over a serial tty, and you must have a way to receive the transfer on the other side. Obviously the best way to do this is by using ZMODEM, which means you need to have a tool like
sz
already on the receiving end. However this isn't always possible, for example, when the receiving target is a router without a network.The only possible way to do this transfer is directly over the channel, using terminal safe ASCII, in pre-8-bit clean style. I'm going to use more modern tools, that I'd hope are installed on most systems.
Sender:
Linux Serial Port Console
First we encode our file
Now make sure your com send-file command is,
ascii-xfr
, this was my connection command lineNormally we want
ascii-xfr
on the receiving side, but since we don't have it, that -n
works around this by maintaining correct line endings.Receiver:
Now that we've connected, go to the directory where you want the received file.
On picocom, I just CTRL+a+s, and enter the full path of the file I'm sending. Once the transfer completes, you'll need to CTRL+c to break that
cat
.Now we decode the file,
Usb To Serial Console Cable
Do whatever you can to verify that file is IDENTICAL to the one you sent, because an ASCII transfer has no checksum protection. My receiving box had
J. M. BeckerJ. M. Beckersha512sum
, but any checksum command would suffice. Once you manually confirm the sums match, you can assume the transfer was successful!3,54611 gold badge1717 silver badges3838 bronze badges
elmarcoelmarco86611 gold badge99 silver badges1313 bronze badges
Don't know if this would work if all you had was a serial console, but if you have network access at all, then you could use
nc(1)
to copy files using TCP/IP.In the above example, I cloned
sdbYYY
from a source box to sdaXXX
of the destination box. My choice of 8675 for a TCP port number was arbitrary; you could use any port you have access to. And it doesn't have to be a device; it can be any file.In the second example, I copied my rsa public key (
G-Man~/.ssh/id_rsa.pub
) and added it to the authorized keys file for the target host.15.3k99 gold badges4444 silver badges8484 bronze badges
Kevin MKevin MLinux Serial Console Setup
1,74211 gold badge1313 silver badges1313 bronze badges
I would use kermit, the grandparent of filetransfer programs. We used that already long before there was Linux.
txwikingertxwikinger