Serial Monitor Linux Terminal



An Arch Linux machine can be configured for connections via the serial console port, which enables administration of a machine even if it has no keyboard, mouse, monitor, or network attached to it.

  1. Serial Terminal For Ubuntu
  2. Serial Monitor Linux Terminal Command
  3. Linux Rs232 Terminal
  4. Serial Monitor Linux Terminal Linux
  5. Linux Monitor Serial Port
  6. Linux Serial Terminal

The Serial Monitor is a separate pop-up window that acts as a separate terminal that communicates by receiving and sending Serial Data. See the icon on the far right of the image above. Serial Data is sent.

  • The cu command is used to call up another system and act as a dial in terminal.
  • A) jpnevulator – What once started as a Jackpot Navigator emulator (hence the strange name) is now a nice serial sniffer and you can use it to send data on a serial line too. It’s sort of like a very simple terminal emulator, like picocom. But jpnevulator uses hexadecimal byte values to display and send along the line.
  • Download ScriptCommunicator / serial terminal for free. Scriptable data terminal which supports several interfaces. ScriptCommunicator is a scriptable cross-platform data terminal which supports serial port (RS232, USB to serial), UDP, TCP client/server, SPI, I2C and CAN. All sent and received data can be shown in a console and can be logged in an html and a text log.
  • Serial to Network Proxy (ser2net) provides a way for a user to connect from a network connection to a serial port. SerialSpy acts as a serial pass-through device. It listens for incoming data on two serial.

Installation of Arch Linux is possible via the serial console as well.

A basic environment for this scenario is two machines connected using a serial cable (9-pin connector cable).The administering machine can be any Unix/Linux or Windows machine with a terminal emulator program (PuTTY or Minicom, for example).

The configuration instructions below will enable boot loader menu selection, boot messages, and terminal forwarding to the serial console.

Configure console access on the target machine

Boot loader

GRUB

When using GRUB with a generated grub.cfg, edit /etc/default/grub and enable serial input and output support:

Next add the GRUB_SERIAL_COMMAND variable and set the options for the serial connection. For COM1 (/dev/ttyS0) with baud rate of 115200 bit/s:

Read GRUB's manual on Using GRUB via a serial line and the serial command for detailed explanation of the available options.

GRUB Legacy

Edit the GRUB Legacy configuration file /boot/grub/menu.lst and add these lines to the general area of the configuration:

Note: When the terminal --timeout=5 serial console line is added to your menu.lst, your boot sequence will now show a series of Press any key to continue messages. If no key is pressed, the boot menu will appear on whichever (serial or console) appears first in the terminal configuration line.

rEFInd

rEFInd supports serial console only in text mode. Edit refind.conf and uncomment textonly.

Serial Terminal For Ubuntu

Syslinux

To enable serial console in Syslinux, edit syslinux.cfg and add SERIAL as the first directive in the configuration file.

For COM1 (/dev/ttyS0) with baud rate of 115200 bit/s:

The serial parameters are hardcoded to 8 bits, no parity and 1 stop bit.[1]. Read Syslinux Wiki:Config#SERIAL for the directive's options.

Kernel

Kernel's output can be sent to serial console by setting the console=kernel parameter. The last specified console= will be set as /dev/console.

See https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html.

getty

At boot, systemd-getty-generator(8) will start a getty instance for each console specified in the kernel command line.

If you have not configured console= in kernel command line startserial-getty@device.service. For /dev/ttyS0 (COM1) that would be serial-getty@ttyS0.service. Enable the service to start it at boot.

Unless specified otherwise in the kernel command line, getty will be expecting 38400 bit/s baud rate, 8 data bits, no parity and one stop bit-times.

Making Connections

Connect using a terminal emulator program

Note: Before making a connection, it is recommended to add your user to the uucp group. Otherwise you will need root's permission to make a connection:See Users and groups#User groups for details.

Perform these steps on the machine used to connect the remote console.

Command line

dterm

dtermAUR is a tiny serial communication program. If you invoke it without parameters, it will connect to /dev/ttyS0 at 9600 baud by default. The following example connect to /dev/ttyS0 at 115200 baud, with 8 data bits, no parity bit and 1 stop bit-times:

See its homepage[2] for more examples.

Minicom

minicom can be obtained from the official repositories. Start Minicom in setup mode:

Using the textual navigation menu, change the serial port settings to the following:

Press Enter to exit the menus (pressing Esc will not save changes).Remove the modem Init and Reset strings, as we are not connecting to a modem. To do this, under the Modem and Dialing menu, delete the Init and Reset strings. Optionally save the configuration by choosing save setup as dfl from the main menu.Restart minicom with the serial cable connected to the target machine.To end the session, press Ctrl+A followed by Ctrl+X.

picocom
Monitor

picocom is a tiny dumb-terminal emulation program that is very like minicom, but instead of mini, it is pico. The following example connect to ttyS0 at 9600 bps:

Note: if the backspace key won't work properly try out this option: '--omap delbs'

See its manual for detailed usage.

Screen

GNU Screen is able to connect to a serial port. It will connect at 9600 baud by default:

A different baud rate (e.g. 115200) may be specified on the command line.

To end the session, press Ctrl+a followed by K. Alternatively, press Ctrl+a, type :quit and confirm it by pressing Enter.

Serialclient

Serialclient[3] is a CLI client for serial connection written in ruby. Install ruby package, then install it with the following:

Then, you can use like this:

And, for Windows

On Windows machines, connect to the serial port using programs like PuTTY[4] or Terminalbpp[5].

Graphical front-ends

cutecomAUR is another gui enabled serial monitor.

putty is also available for Linux.

moserial is a gtk-based serial terminal, primarily intended for technical users and hardware hackers who need to communicate with embedded systems, test equipment, and serial consoles.

Installing Arch Linux using the serial console

Note: The Arch Linux monthly release(i.e. the installation CD)'s boot loader has been configured[6] to listen on 0 port(ttyS0/COM1) at 38400 bps, with 8 data bits, no parity bit and 1 stop bit-times.
  1. Connect to the target machine using the method described above.
  2. Boot the target machine using the Arch Linux installation CD.
  3. When the bootloader appears, select Boot Arch Linux (<arch>) and press Tab to edit
  4. Append console=ttyS0,38400 and press Enter.
  5. Now systemd should detect ttyS0 and spawn a serial getty on it. Login as root and start the installation as usual.
Note: After setup is complete, the console settings will not be saved on the target machine; in order to avoid having to connect a keyboard and monitor, configure console access on the target machine before rebooting.
Note: While a port speed of 9600 is used in most of the examples in this document, working with higher values is recommended (List of available speeds is displayed in Minicom by pressing 'Ctrl-A' and then 'P')

Troubleshooting

Ctrl+c and Minicom

If you are having trouble sending a Ctrl+c command through minicom you need to switch off hardware flow control in the device settings (minicom -s), which then enables the break.

Resizing a terminal

Unlike ssh, serial connections do not have a mechanism to transfer something like SIGWINCH when a terminal is resized. This can cause weird problems with some full-screen programs (e.g. less) when you resize your terminal emulator's window.

Resizing the terminal via stty is a workaround:

However, this requires you to manually input the proper geometry. The following methods should be simpler.

1. There is a lesser-known utility called resize, shipped with xterm, that can solve this problem. Invoke it without parameters after you resize the terminal emulator's window:

2. If you don't want to install xterm, it is possible to do the same work via a shell function. Put the following function into your zshrc and invoke it without parameters after resizing the terminal emulator's window:

Missing ports on multi-port expansion cards

This article or section needs expansion.

Serial Monitor Linux Terminal Command

Reason: Can the kernel module option be set in modprobe.d(5)? (Discuss in Talk:Working with the serial console#)

The number of serial ports using the generic 8250 driver on the default kernel configuration is set to 4 at runtime with a maximum of 32. This will prevent the creation of /dev/ttyS4 and above. Counting the typical built in serial port on the motherboard this prevents the use of the 4th serial port on a 4 port expansion card.

This can be overridden with the kernel parameter8250.nr_uarts. E.g.:

Retrieved from 'https://wiki.archlinux.org/index.php?title=Working_with_the_serial_console&oldid=626181'

Name

slsnif - Serial line snifferTerminal

Synopsis

slsnif [-b] [-l logfile] [-i file] [-o file] [-s speed] [-t] [-x] [-p port2] [--colorcolor] [--timecolor color] [--bytescolor color] [-n] [-u] port1

Description

slsnif is a serial line sniffer software. It listens to the specified serial port andwrites all data coming through it into either stdout (default) or a log file (if specified -- see option -l).

slsnif operates either by creating a pseudo tty (pty) and linking it to the serial port, or by linking two serial ports together. In order to set upa debug session one has either to start slsnif on a given port first, note the pty it had opened (also available from file /tmp/slsnif_pty whileslsnif is running), then configure the controlling software for the device being debugged to use this pty instead of the actual port, or, in case of twoports being used, simply start slsnif on two ports (see option -p) and watch the show :)

Note 1 : Slsnif will try to match port settings on pty and port (or on 1st and 2nd ports) as soon as it detects first chunk of data comingfrom the 'host side' (which is either pty or 2nd port). If it fails (in case of a braindead controlling software that doesn't set the baudrate correctly), onehas an ability to set baudrate by hand via option -s. Controlling software and slsnif should be set up to use the same baudrate, which in turnshould match the baudrate used by the device connected to the port.

Linux Rs232 Terminal

Note 2 : If controlling software is running under vmware (www.vmware.com) and pty is used, port in question should be disconnected from vmwarebefore invoking slsnif, and connected to the opened pty after slsnif has been started.

Parameters

slsnif accepts the following parameters:
[-l <logfile>] ([--log <logfile>])
File to direct output to. Output is sent to stdout by default.
[-i <in-file>] ([--in-tee <in-file>])
File to dump raw data from device to. Multiple '-i' / '--in-tee' arguments result in multiple copies of data in corresponding files.
[-o <out-file>] ([--out-tee <out-file>])
File to dump raw data from host to. Multiple '-o' / '--out-tee' arguments result in multiple copies of data in corresponding files.
[-s <speed>] ([--speed <speed>])
Baudrate to use. Valid options are:
50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
Defaults to 9600 baud.
[-b] ([--bytes])
Print number of bytes transmitted on every read.
[-p <port2>] ([--port2 <port2>])
Use real serial port instead of pty. Useful when one needs to log data going between two ports.
[-n] ([--nolock])
Disable locking of the port. Normally not a good idea, but can be very useful if one doesn't have permissions to write to lock directory (usually/var/lock/)
[-t] ([--timestamp])
Print timestamp for every transmission.
[-x] ([--hex])
Display hexadecimal ascii values.
[-u] ([--unix98])
Use SYSV (Unix98) ptys instead of BSD ptys.
[--color <color>]
Color to use for normal output.
[--timecolor <color>]
Color to use for timestamp.
[--bytescolor <color>]
Color to use for number of bytes transmitted.
Valid <color> values are:
black, red, green, yellow, blue, magenta,
cyan, white, brightblack, brightred,
brightgreen, brightyellow, brightblue,
brightmagenta, brightcyan, and brightwhite.
[-h] ([--help])
Display help.

Rc File

The following options can be specified via rc-file '.slsnifrc', which should be located in the user's home directory:

Serial Monitor Linux Terminal Linux

Options specified via command line always override the ones specified via rc-file.

Example

slsnif -n -l log.txt -s 2400 /dev/ttyS1
Started logging data into file 'log.txt'.
Opened pty: /dev/ttyp0
Saved name of the pty opened into file '/tmp/slsnif_pty'.
Opened port: /dev/ttyS1
Baudrate is set to 2400 baud.

Note: pty slsnif has opened is /dev/ttyp0.

Signals

SIGHUP signal causes slsnif to move file pointer in all log files back to the beginning. This is useful for example when logfiles are rotated bylogrotate. SIGUSR1 signal causes slsnif to re-synchronize settings between ttys at any time. Useful for debugging software that changes portsettings in the middle of transmission.

See Also

setserial(8), stty(1).

Linux Monitor Serial Port

Author

Linux Serial Terminal

Yan Gurtovoy <ymg@dakotacom.net>.