To enable the serial console in Linux, you will need to edit the configuration file for the GRUB boot loader.
First, open the GRUB configuration file in a text editor:
sudo nano /etc/default/grubSource:www.lautturi.com
In the file, find the line that begins with GRUB_CMDLINE_LINUX_DEFAULT
. This line contains the default kernel command-line options passed to the kernel at boot time.
To enable the serial console, you will need to add the following options to this line:
console=ttyS0,115200n8
Replace ttyS0
with the name of the serial port you want to use (e.g., ttyS1
for the second serial port). Replace 115200
with the desired baud rate, and n8
with the number of bits per character (usually 8).
For example, the line might look like this:
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8"
Save the file and exit the text editor.
Next, update the GRUB configuration to apply the changes:
sudo update-grub
Finally, reboot the system to activate the serial console:
sudo reboot
After the system reboots, you should be able to use the serial console to access the system. To do this, you will need a terminal emulator program, such as minicom
or picocom
, that is configured to use the same serial port and baud rate as the one you specified in the GRUB configuration.
Keep in mind that you may also need to configure your hardware (e.g., motherboard BIOS or system firmware) to use the serial port as a console. Refer to your hardware documentation for more information.