We currently migrate to MediaWiki from our old installation, but not all content has been migrated yet. Take a look at the Wiki Team page for instructions how to help or browse through our new wiki at wiki.linux-vserver.org to find the information already migrated.

Howto access a vserver from a console tty ?

Our linux-with-vserver-support host runs a vserver that we want accessible from the console on TTY3.

There are three simple steps :

  1. freeing a tty on the host,
  2. configuring it on the vserver and
  3. creating the device on the vserver.

See at the end of the document for alternatives.

1. Free a TTY on the host.

Edit /etc/inittab and comment out the line concerning respawning on tty3 :

 1:2345:respawn:/sbin/getty 38400 tty1
 2:23:respawn:/sbin/getty 38400 tty2
 #3:23:respawn:/sbin/getty 38400 tty3
 4:23:respawn:/sbin/getty 38400 tty4
 5:23:respawn:/sbin/getty 38400 tty5
 6:23:respawn:/sbin/getty 38400 tty6

2. Configure tty on the vserver

Edit inittab for the vserver : /path/to/vserver/etc/inittab

and add the line that was commented out on the host :

3:23:respawn:/sbin/getty 38400 tty3

3. Create the device on the vserver

If you don't use devFS, the easy way to go is :

# cp -ax /dev/tty3 /path/to/vserver/dev/

Well, you're almost done...

If you're using vserver 2.0, you also need to

# echo "plain" > /etc/vservers/<vserver>/apps/init/style

Make sure you kill the existing tty3 before restarting your vserver.

If you use devFS (Thanks to Bertl on #vserver)

 <Bertl> you copy the apropriate /dev/vc/* or whatever it is named, to the
         vserver and label it /dev/vc/0 there  ...
 <Bertl> or /dev/vc/1 if you prefer ...
 <Bertl> then you setup inittab to use that device as console ...
 <Bertl> (inside each server)

If you don't want to change anything in your vservers,

you might want to write a (login) script that launches a vserver console

when you log on console ttyX :

 <Bertl> if you 'just' want to have access to a vserver on console 2,3,4 ...
 <Bertl> you could use a small script, which does 'vserver <name> exec login' ;)
 <Bertl> and restarts it on the specified console (via inittab) that would not
         require any changes in the vserver

i.e. in /etc/inittab:

3:23:respawn:/sbin/getty -l /sbin/console-vserver -n 38400 tty3

and in /sbin/console-vserver (chmod +x):

# Start vserver on the console tty3
exec vserver <vserver> exec login