How to access the console

You can access the instance console to log in to the instance and see log messages. The console is available at boot time already, so you can use it to see boot messages and, if necessary, debug startup issues of a container or VM.

Use the lxc console command to attach to instance consoles. To get an interactive console, enter the following command:

lxc console <instance_name>

To show new log messages (only for containers), pass the --show-log flag:

lxc console <instance_name> --show-log

You can also immediately attach to the console when you start your instance:

lxc start <instance_name> --console
lxc start <instance_name> --console=vga

Tip

To exit the console, enter Ctrl+a q.

Access the graphical console (for virtual machines)

On virtual machines, log on to the console to get graphical output. Using the console you can, for example, install an operating system using a graphical interface or run a desktop environment.

An additional advantage is that the console is available even if the lxd-agent process is not running. This means that you can access the VM through the console before the lxd-agent starts up, and also if the lxd-agent is not available at all.

To start the VGA console with graphical output for your VM, you must install a SPICE client (for example, virt-viewer or spice-gtk-client). Then enter the following command:

lxc console <vm_name> --type vga