Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

20.10. Connecting the Serial Console for the Guest Virtual Machine

The virsh console domain [--devname devicename] [--force] [--safe] command connects the virtual serial console for the guest virtual machine. This is very useful for example for guests that do not provide VNC or SPICE protocols (and thus does not offer video display for GUI tools) and that do not have network connection (and thus cannot be interacted with using SSH).
The optional --devname parameter refers to the device alias of an alternate console, serial, or parallel device configured for the guest virtual machine. If this parameter is omitted, the primary console will be opened. If the --safe option is specified, the connection is only attempted if the driver supports safe console handling. This option specifies that the server has to ensure exclusive access to console devices. Optionally, the force option may be specified, which requests to disconnect any existing sessions, such as in the case of a broken connection.

Example 20.19. How to start a guest virtual machine in console mode

The following example starts a previously created guest1 virtual machine so that it connects to the serial console using safe console handling:
# virsh console guest1 --safe