By the end, you’ll have a detailed understanding of what serial consoles are and how they work on Linux.

Setting Up the USB to Serial Converter

Almost any USB serial converter you can find on the market is automatically recognized by Linux. Plug any USB converter into your computer and use the dmesg command to find out the file name of the device.

In the example above, you see VirtualBox in the manufacturer section, as the host is a Linux distribution running on VirtualBox. Here, the manufacturer name will change depending on the converter you are using. You can also see that the serial converter you are using is attached to the system with a name, such as ttyUSB0.

You can use the serial converter recognized by your system via the device file /dev/ttyUSB0. Depending on the distribution you use, the device file is automatically created under the /dev directory, showing major, minor, and device types. For USB serial converters, the naming scheme is usually ttyUSB0, ttyUSB1, and ttyUSBX for each simultaneous translation.

If you remove and reinsert the USB serial converter while it is in use by an application, the system issues a new number to the device.

Access Authorization on Serial Devices

The default access privileges of mounted USB converter device files are usually as follows:

On examining the above output, you can tell:

The letter c at the beginning of the line denotes that this is a character-based device The file owner is the root user and the user has read and write privileges The group owner of the file is the dialout group and users included in this group also have read and write permissions The rest of the users do not have any read and write rights on the file

If you’re currently logged in as a regular user, who isn’t a member of the dialout group, you cannot read and write to the USB serial converter. To solve this problem, you must either make the current user a member of the dialout group or edit the udev rule files on your system.

You can utilize the first technique for convenience. To begin, use the id command to determine which groups your user belongs to:

Add your user to the group using the adduser or usermod command:

The group membership procedure is now complete. However, the system checks group membership information during the first login step in graphical sessions and then provides it to all running processes.

As a result, you must log out of the current graphical session and then log back in or restart your machine for the modifications to take effect. You will have read/write access to the serial converter device after finishing this operation.

How to Connect to Serial Consoles on Linux

When you need access to a computer or network console, you can refer to serial console applications. Usually, you require access over SSH to do so. However, from a software and hardware point of view, in some cases, it is also possible to access the console using only serial ports.

You’ll find these types of examples most often on older computers. Below are some of the best serial console applications that will work for you.

Using Minicom

You can install Minicom, an old but still working application on your system as follows:

When you launch the application for the first time, it will try to open a device file such as /dev/modem by default. It terminates when it cannot find the file. To overcome this problem, you can directly start the application’s settings screen with the -s parameter:

You can set the device name by pressing the A key, and the serial port speed by pressing the E key. Then when you exit with Exit, you can use the corresponding serial port.

While on the application main screen, you can return to the configuration screen with Ctrl + A + O, exit the application with Ctrl + A + X, activate the line wrap mode with Ctrl + A + W, and get help with other shortcuts with Ctrl + A + Z.

Using GTKTerm

Minicom is generally used by advanced Linux users and therefore, is not recommended for beginners. Linux newcomers can install GTKTerm, a graphical serial terminal emulator for Linux. You can install the application on your system using the following commands:

When you launch the app, you’ll have to set the device name and speed parameters via the Configuration > Port menu as follows:

Save the settings as default to facilitate later use.

Using screen

If you are familiar with screen for multi-terminal management, you’d know that you can use it for serial port access as well. Here are the commands to install it:

After installation, you can run a command like this to connect to a serial console:

Now You Can Establish a Serial Port Connection on Linux

Being able to access your Linux system using the serial port is a very useful feature, especially when you don’t want to attach a monitor to the SBC (Session Border Controller).

Since the serial console authorization is built into the Linux kernel at the time of compilation, you should have at least a basic understanding of the Linux kernel and its working.