Jim's Depository

this code is not yet written
 

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.

  1. 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.
  2. kill -HUP 1
  3. Now we will give tty3 to my container named rattus. You will replace rattus with your machine name.
  4. Go to /var/lib/lxc/rattus.
  5. 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.
  6. Do the same for config.
  7. 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.
  8. 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.