Skip to content

Instantly share code, notes, and snippets.

@alexforster
Last active June 18, 2023 12:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexforster/06e25cf802819f914b4fbdf3b0cdd58d to your computer and use it in GitHub Desktop.
Save alexforster/06e25cf802819f914b4fbdf3b0cdd58d to your computer and use it in GitHub Desktop.
LXD: accessing container's consoles
~# lxc profile device show default
# (...sic...)
console:
  path: /dev/console
  type: unix-char
tty:
  path: /dev/tty
  type: unix-char
tty0:
  path: /dev/tty0
  type: unix-char
ttyS0:
  path: /dev/ttyS0
  type: unix-char

Add with:

lxc profile device add default console unix-char path=/dev/console
lxc profile device add default tty unix-char path=/dev/tty
lxc profile device add default tty0 unix-char path=/dev/tty0
lxc profile device add default ttyS0 unix-char path=/dev/ttyS0

Open console with:

lxc-console -P /var/lib/lxd/containers -t 0 -n my-container

I use an lxcon bash alias:

alias lxcon='lxc-console -P /var/lib/lxd/containers -t 0 -n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment