Previous Next Contents

7. Console switching

By default, console switching is done using Alt-Fn or Ctrl-Alt-Fn. Under X (or recent versions of dosemu), only Ctrl-Alt-Fn works.

XFree86 1.3 does not know that Alt is down when you switch to the X window. Thus, you cannot switch immediately to some other VT again but have to release Alt first. In the other direction this should work: the kernel always keeps track of the up/down status of all keys. (As far as possible: on some keyboards some keys do not emit a scancode when pressed (e.g.: the PFn keys of a FOCUS 9000) or released (e.g.: the Pause key of many keyboards).)

XFree86 1.3 saves the fonts loaded in the character ROMs when started, and restores it on a console switch. Thus, the result of setfont on a VT is wiped out when you go to X and back. Using setfont under X will lead to funny results.

One can change under program control using the chvt command.

7.1 Changing the number of Virtual Consoles

This question still comes up from time to time, but the answer is: you already have enough of them. Since kernel version 1.1.54, there are between 1 and 63 virtual consoles. A new one is created as soon as it is opened. It is removed by the utility disalloc (but it can be removed only when no processes are associated to it anymore).

For older kernels, change the line

#define NR_CONSOLES     8
in include/linux/tty.h (don't increase this number beyond 63), and recompile the kernel. You might have to create the devices with MAKEDEV or mknod ttyN c 4 N where N denotes the tty number. If you want the new VCs to run getty, add lines in /etc/inittab.

When the consoles are allocated dynamically, it is usually easiest to have only one or two running getty. More are opened by open -l -s bash. Unused consoles (without associated processes) are disallocated using disalloc.

If you have spawn_login from kbd-0.90.tar.gz and you put

        loadkeys << EOF
        alt keycode 103 = Spawn_Console
        EOF
        spawn_login &
in /etc/rc.local, then typing Alt-UpArrow will create a fresh VC running login (and switch to it). See also open-1.3.tgz.

You can only login as "root" on terminals listed in /etc/securetty.


Previous Next Contents