How to configure grub serial access (serial console)



For the average user a serial console has no advantage compared to a graphical console offered by a directly attached keyboard and screen.

But there are some scenarios where serial consoles are useful:

  • Systems administration of remote computers via remote management (IPMI)
  • Console redirection to non-standard settings
  • Recording boot console messages
  • Handicapped (blind) administrators who can not do anything with a graphical output
  • Disable graphical GRUB output (text output only)

Note “Hardware Servers”:
Many USB serial converters don’t work reliably, please use the hardwares serial console or “console re-direction” on affected servers. Many servers support serial console re-direction over network nowadays, for example over IPMI (How to do remote server administration over IPMI?).

Note “Virtual Servers”:
Please add a virtual “serial console device” on affected virtual servers.
Note “UCS Version”:
The following does not apply on systems earlier UCS 4.1, erratum #171. On affected systems, please update first to UCS 4.1 erratum #171 or higher.

Problems/Tasks to solve

Disable graphical output of GRUB, enable text output:

To disable the graphical output of GRUB:

 # ucr set grub/terminal='console'
 # reboot

Configure serial access (standard serial settings)

The serial connection is being made at 115200/8n1, on first serial port. Default fallback if your hardware does not support 115200 baud, is 9600/8n1. Default Linux console (/dev/console) is always the first entry given to UCR variable “grub/terminal”.

This makes the VGA console the default console, as “console” is given first:

 # ucr set grub/terminal='console serial'
 # reboot

This makes the serial console the default console, as “serial” is given first:

 # ucr set grub/terminal='serial console'
 # reboot

Configure serial access (standard serial settings)

Serial settings are configurable via UCR variable “grub/serialcommand”.
Note that the serial port is not used as a communication channel unless a terminal is configured (see above: “grub/terminal”)

Example to configure serial access to the second console:

 # ucr set grub/serialcommand='serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1'

Related: handicapped (blind) administrators

Especially for blind administrators, any graphical output during or after the boot is not only useless but a hindrance. In addition to disable the graphical output of GRUB (see above) the following settings may be usefull:

To disable graphical startup animation:

 # ucr set grub/bootsplash=nosplash

To disable the graphical welcome-screen after boot:

 # ucr set welcome-screen/autostart=disabled

Related: Configure a login prompt on the serial console

In addition to redirect grub messages, you often want to configure a login prompt (getty) via serial console.

This is already prepared in the /etc/inittab file and only needs to be activated.

To use the standard settings, simply enable the line beginning with ‘#T0:’:

 # sed -i -re '/^#?T0:/s/#//' /etc/inittab
 # reboot

To customize settings, the file /etc/inittab must be edited manually. As an example, in order to use the second serial port:

 # Example how to put a getty on a serial line (for a terminal)
 #  T0:23:respawn:/sbin/getty -L ttyS0 115200 vt102

Related: Configure serial settings in older UCS installations


Of course we recommend an version update to to UCS 4.1 erratum #171 or higher. Should this not be possible, some settings can be adjusted directly, e.g. as follows:

 # Re-direct GRUB input/output to serial console:
 cat >>/etc/univention/templates/files/etc/default/grub <<__GRUB__
 GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no
 ucr commit /etc/default/grub