Enabling Serial Console Access for Imported Linux Images

You can configure your custom Linux image to support connections using the serial console feature in the Compute service.

For more information about serial console connections, and steps to troubleshoot if your image has network connectivity issues after it is launched, see Instance Console Connections.

The serial console connection in Oracle Cloud Infrastructure uses the first serial port, ttyS0, on the VM. The boot loader and the operating system should be configured to use ttyS0 as a console terminal for both input and output.

Configuring the Boot Loader

The steps to configure the boot loader to use ttyS0 as a console terminal for both input and output depend on the GRUB version. Run the following command on the operating system to determine the GRUB version:

grub install --version

If the version number returned is 2.x, use the steps for GRUB 2. For earlier versions, use the steps for GRUB.

To configure GRUB2
To configure GRUB

Configuring the Operating System

The operating system may already be configured to use ttyS0 as a console terminal for both input and output. To verify, run the following command:

sudo vi /etc/securetty

Check the file for ttyS0. If you don't see it, append ttyS0 to the end of the file.

Validating Serial Console Access

After completing the steps to enable serial console access to the image, you should validate that serial console access is working by testing the image with serial console in your virtualization environment. Consult the documentation for your virtualization environment for steps to do this. Verify that the boot output displays in the serial console output and that there is interactive input after the image has booted.

Troubleshooting the Serial Console

If no output is displayed on the serial console, verify in the configuration for your virtualization environment that the serial console device is attached to the first serial port.

If the serial console displays output, but there is no interactive input available, check that there is a terminal process listening on the ttyS0 port. To do this, run the following command:

ps aux | grep ttyS0

This command should output a terminal process that is listening on the ttyS0 port. For example, if your system is using getty, you will see the following output:

/sbin/getty ttyS0

If you don't see this output, it is likely that a login process is not configured for the serial console connection. To resolve this, enable the init settings, so that a terminal process is listening on the ttyS0 at startup.

For example, if your system is using getty, add the following command to the init settings to run on system startup:

getty -L 9600 ttyS0 vt102

The steps to do this will vary depending on the operating system, so consult the documentation for the image's operating system.