3

By default, Ctrl+Alt+F1-F6 lead to a virtual console.

A lxc container is running on my computer. How to configure the host so that Ctrl+Alt+F6 goes to the virtual console of the container?

Moreover, how to configure the host so that Ctrl+Alt+F6 goes to an x server running inside the container?

  • The first will probably involve writing a systemd service file, that runs lxc console .... Read here for more info: http://unix.stackexchange.com/a/194218/127903 . Note the part about "NAutoVTs". – Alex Stragies Jul 05 '16 at 22:28

1 Answers1

1

I've figured this out, mainly inspired by this post on arch forum.

  • Disable the getty currently running behind tty6 by removing /etc/init/tty6.conf, this would take effect after rebooting.
  • Allow the container to access tty6 by adding lxc.cgroup.devices.allow = c 4:6 rwm to the container's configuration
  • Autostart getty in the container, by editing /etc/init/tty6.conf instead the container

    start on runlevel [23] # and not-container <- not-container is commented out
    
    stop on runlevel [!23]
    
    respawn
    exec /sbin/getty -8 38400 tty6
    

Now Ctrl+Alt+F6 is container's console.

Additional operations are need for tty[1-4], as /dev/tty[1-4] in the container are not tty devices.