If you are going to run virtual machines in LXC containers it is nice to let each one have a console on your physical box. You can do this thusly…
Note: we are going under the knickers of lxc. It may not appreciate having its config files changed, but I didn't find an exposed command to accomplish this.
- Take some virtual consoles away from the main container. Edit your /etc/inittab and comment out the four lines for tty3 to tty6. We will save these for the containers.
- kill -HUP 1
- Now we will give tty3 to my container named rattus. You will replace rattus with your machine name.
- Go to /var/lib/lxc/rattus.
- Edit cgroup. The devices like 4:N are the virtual console terminals. We want to have a line 4:3 and no other 4:N where N is an integer.
- Do the same for config.
- Cut rattus down to two virtual consoles, the kind that can be used with lxc-console. This will be tty1 and tty2 leaving tty3 to be the real one. Edit /var/lib/lxc/rattus/ttys to be a 2 instead of a 4. Beware: There is a NUL after the digit. It may be important. Emacs will preserve it.
- Edit the ROOT/etc/inittab file and comment out the getty line for tty4 since we don't get to use it and it won't have a virtual console on it. While you are in here, take out the console line as well. I think it is responsible for the spurious login prompts while you are working in the other consoles.