Abbyy Linux Serial Console

Frequently Asked Questions releated to ABBYY CLI. The Licence Manager Console can be found in. ABBYY CLI OCR for Linux 11 or V9 can be reinstalled on one. Frequently Asked Questions releated to ABBYY CLI Tool. The Licence Manager Console can be found in your installation directory. ABBYY CLI OCR for Linux 11 or V9 can be reinstalled on one and the same computer an unlimited number of times without reactivation. However, if you make major system upgrades, e.g.

On this page

  1. Setting up a serial console

Setting up a serial console

Usb

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

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

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/

Active7 days ago

Linux Serial Console

Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this

I know I can cat the output from /dev/ttyS0 but only one way communication is possible that way, from the port to the console. And echo out to the port is just the same but the other way around, to the port.

How can I realize two way communication with a serial port the simplest possible way on Unix/Linux?

ihatetoregister
ihatetoregisterihatetoregister
1,4353 gold badges15 silver badges15 bronze badges

16 Answers

I find screen the most useful program for serial communication since I use it for other things anyway. It's usually just screen /dev/ttyS0 <speed>, although the default settings may be different for your device. It also allows you to pipe anything into the session by entering command mode and doing exec !! <run some program that generates output>.

Shawn J. GoffShawn J. Goff
31.4k19 gold badges117 silver badges134 bronze badges

Background

The main reason why you need any program like minicom to communicate over a serial port is that the port needs to be set up prior to initiating a connection. If it weren't set up appropriately, the cat and echo commands would not do for you what you might have expected. Notice that once you run a program like minicom, the port is left with the settings that minicom used. You can query the communication settings using the stty program like this:

If you have done it right; after booting the computer and before running any other program like minicom, the communication settings will be at their default settings. These are probably different than what you will need to make your connection. In this situation, sending the commands cat or echo to the port will either produce garbage or not work at all.

Run stty again after using minicom, and you'll notice the settings are set to what the program was using.

Minimal serial communication

Basically, two things are needed to have two-way communication through a serial port: 1) configuring the serial port, and 2) opening the pseudo-tty read-write.

The most basic program that I know that does this is picocom. You can also use a tool like setserial to set up the port and then interact with it directly from the shell.

rozcietrzewiaczrozcietrzewiacz
30.7k4 gold badges79 silver badges95 bronze badges

I found a way using a shell script here that put cat as a background process and a while loop that read the user input and echo it out to the port. I modified it to be more general and it fitted my purpose perfectly.

heemayl
38.4k4 gold badges83 silver badges111 bronze badges
ihatetoregisterihatetoregister
1,4353 gold badges15 silver badges15 bronze badges

If UUCP is installed on the system, you may use the command cu, e.g.

ktfktf

Try http://tio.github.io

'tio' is a simple TTY terminal application which features a straightforward commandline interface to easily connect to TTY devices for basic input/output.

Typical use is without options. For example:

Which corresponds to the commonly used options:

It comes with full shell auto completion support for all options.

Thomas
4,5237 gold badges15 silver badges31 bronze badges
MartinMartin

This script is based on another answer, but sends everything over the serial port (except Ctrl+Q), not just single commands followed by Enter. This enables you to use Ctrl+C or Ctrl+Z on the remote host, and to use interactive 'GUI' programs like aptitude or alsamixer. It can be quit by pressing Ctrl+Q.

Community
FritzFritz

BTW, the putty package (which does run on Linux) does include serial support.

mdpcmdpc
5,2612 gold badges19 silver badges38 bronze badges

Putty works well on Linux and offers some convenience, especially for serial communications. It has one drawback I haven't been able to directly solve: no copy-paste from the Putty window itself. The windows version has a lovely auto-copy to clipboard on highlight, right-click to paste behaviour (and there are excellent plugins for both chrome and firefox to enable the same behavior), but on Linux, no copy love AFAIK.

If the lack of copy is a problem (it is for me) then turn on logging in putty and open a standard terminal window and # tail -f putty.log and bidirectional text is available for standard copypasta action.

gesselgessel

Another issue that can occur is that your user account may need to set to the 'dialout' group to access the serial port.

GAD3R
30.5k19 gold badges63 silver badges123 bronze badges
dfowler7437dfowler7437

It depends on what you want to do. Do you want to run a shell or applicaiton interactively from the terminal, connect out to another computer over the serial line, automate communication with a device over a serial port?

If you want bidirectional communication then I presume you want something interactive with a human on the terminal. You can configure the system to allow logins from a terminal over a serial port by seting up a getty(1) session on the serial port - getty is the tool for setting up a terminal and allowing logins onto it. Put an entry in your inittab(5) file to run it on the appropriate serial port on a respawn basis.

If you want to connect to a device and initiate automated two way conversations then you could see if expect will get you what you want. Use stty(1) to configure the port to the right parity, baud rate and other relevant settings.

If you want to communicate interactively with another computer over the serial port then you will need terminal emulation software. This does quite a lot - it sets up the port, interprets ANSI or other terminal command sequences (ANSI was far from being the only standard supported by serial terminals). Many terminal emulators also support file transfer protocols such as kermit or zmodem.

The ins and outs of serial communications and terminal I/O are fairly complex; you can read more than you ever wanted to know on the subject in the serial howto.

ConcernedOfTunbridgeWellsConcernedOfTunbridgeWells

As mentioned before you can try picocom. The latest release (2.0) can also be used (safely) to set-up a 'terminal server' since it no longer permits shell command injection. See:

Nick PatavalisNick Patavalis

You might want to take a look at

Pro: doesn't have obvious security problems like minicom or picocom (if you don't have a problem giving the users shell access, no problem, but you most likely do have one if you want to set up a terminal server...)

PeterPeter

You need to be sure to have the correct read write permits on the device, you could see it with:

I rely on the script you found and made some modifications.

For the development systems I've used by now, they used to need:

  • None parity and
  • One stop bit

Those values are the default ones in the script.

So in order to connect, you can use it as simple as follows:

Example:

Script:

P.S.: You need to know which kind of line feed is using your receiver system since this will determine how you'll need to send the commands in my case I needed a Windows like LF, means that I need to send

ASCII values for:

  • LF : 0Ah, line feed 'n'
  • CR : 0Dh, carrige return 'r'
  • BS : 08h, back space '<-'
Rafael KarosuoRafael Karosuo

As it is not mentioned here already, I'd also mention socat - more info in https://stackoverflow.com/questions/2899180/how-can-i-use-com-and-usb-ports-within-cygwin :

or

(though, I've had the problem of stopping it once it starts running, under MSYS2 on Windows)

sdbbssdbbs

I wonder why nobody mentioned ser2net.

Example /etc/ser2net.conf:

You can connect to serial port as easy as:

Or remotely:

Or even set up port forwarding on your router and expose it to Internet, so that you could connect to it from anywhere (let's skip security issues, I'm talking about flexibility).

Andrejs CainikovsAndrejs Cainikovs

Another easy option is to access the machine over ssh with the -X flag and run a program such as putty or gtkterm.

So:

Serial Console Software

It should launch the graphical interface on your client PC and from there you can access the serial port as if you would be in the host.

Disclaimer: Only tried this with ubuntu machines. I'm guessing that it won't work with machines without graphic interfaces.

From the ssh manual:

-X

Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file. X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X authorization database) can access the local X11 display through the forwarded connection. An attacker may then be able to perform activities such as keystroke monitoring. For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information.

-Y

Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.

So use -Y if security is an issue.

GrifoGrifo

Linux Serial Console Over Usb

Not the answer you're looking for? Browse other questions tagged command-lineterminalttyserial-portserial-console or ask your own question.