|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
<HTML>
|
|
Packit Service |
50ad14 |
<HEAD>
|
|
Packit Service |
50ad14 |
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
Packit Service |
50ad14 |
<TITLE>The Linux keyboard and console HOWTO: Console switching</TITLE>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ-8.html" REL=next>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ-6.html" REL=previous>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ.html#toc7" REL=contents>
|
|
Packit Service |
50ad14 |
</HEAD>
|
|
Packit Service |
50ad14 |
<BODY>
|
|
Packit Service |
50ad14 |
Next
|
|
Packit Service |
50ad14 |
Previous
|
|
Packit Service |
50ad14 |
Contents
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
console!switching
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
By default, console switching is done using Alt-Fn or Ctrl-Alt-Fn.
|
|
Packit Service |
50ad14 |
Under X (or recent versions of dosemu ), only Ctrl-Alt-Fn works.
|
|
Packit Service |
50ad14 |
Many keymaps will allow cyclic walks through all allocated consoles
|
|
Packit Service |
50ad14 |
using Alt-RightArrow and Alt-LeftArrow.
|
|
Packit Service |
50ad14 |
XFree86 1.3 does not know that Alt is down when you switch to the X
|
|
Packit Service |
50ad14 |
window. Thus, you cannot switch immediately to some other VT again
|
|
Packit Service |
50ad14 |
but have to release Alt first.
|
|
Packit Service |
50ad14 |
In the other direction this should work: the kernel always keeps
|
|
Packit Service |
50ad14 |
track of the up/down status of all keys. (As far as possible: on some
|
|
Packit Service |
50ad14 |
keyboards some keys do not emit a scancode when pressed (e.g.: the PFn
|
|
Packit Service |
50ad14 |
keys of a FOCUS 9000) or released (e.g.: the Pause key of many keyboards).)
|
|
Packit Service |
50ad14 |
XFree86 1.3 saves the fonts loaded in the character ROMs when started,
|
|
Packit Service |
50ad14 |
and restores it on a console switch. Thus, the result of setfont on
|
|
Packit Service |
50ad14 |
a VT is wiped out when you go to X and back.
|
|
Packit Service |
50ad14 |
Using setfont under X will lead to funny results.
|
|
Packit Service |
50ad14 |
One can change VT under program control using the chvt command.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
console!changing number of
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
This question still comes up from time to time, but the answer is:
|
|
Packit Service |
50ad14 |
you already have enough of them.
|
|
Packit Service |
50ad14 |
Since kernel version 1.1.54, there are between 1 and 63 virtual
|
|
Packit Service |
50ad14 |
consoles. A new one is created as soon as it is opened. It is
|
|
Packit Service |
50ad14 |
removed by the utility deallocvt (but it can be removed only when
|
|
Packit Service |
50ad14 |
no processes are associated to it anymore, and no text on it has been
|
|
Packit Service |
50ad14 |
selected by programs like selection or gpm ).
|
|
Packit Service |
50ad14 |
For older kernels, change the line
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#define NR_CONSOLES 8
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in include/linux/tty.h (don't increase this number beyond 63),
|
|
Packit Service |
50ad14 |
and recompile the kernel.
|
|
Packit Service |
50ad14 |
If they do not exist yet, create the tty devices with MAKEDEV
|
|
Packit Service |
50ad14 |
or mknod tty N c 4 N where N denotes the tty number. For example,
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
for i in 9 10 11 12; do mknod /dev/tty$i c 4 $i; done
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
or, better (since it also takes care of owner and permissions),
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
for i in 9 10 11 12; do /dev/MAKEDEV tty$i; done
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
If you want the new VCs to run getty , add lines in /etc/inittab .
|
|
Packit Service |
50ad14 |
(But it is much better to have only two getty 's running,
|
|
Packit Service |
50ad14 |
and to create more consoles dynamically as the need arises.
|
|
Packit Service |
50ad14 |
That way you'll have more memory when you don't use all these consoles,
|
|
Packit Service |
50ad14 |
and also more consoles, in case you really need them.
|
|
Packit Service |
50ad14 |
Edit /etc/inittab and comment out all getty 's except
|
|
Packit Service |
50ad14 |
for the first two.)
|
|
Packit Service |
50ad14 |
When the consoles are allocated dynamically, it is usually easiest
|
|
Packit Service |
50ad14 |
to have only one or two running getty . More are opened by
|
|
Packit Service |
50ad14 |
open -l -s bash . Unused consoles (without associated processes)
|
|
Packit Service |
50ad14 |
are deallocated using deallocvt (formerly disalloc ).
|
|
Packit Service |
50ad14 |
But, you say, I am involved in activities when I suddenly need more
|
|
Packit Service |
50ad14 |
consoles, and do not have a bash prompt available to give the open
|
|
Packit Service |
50ad14 |
command.
|
|
Packit Service |
50ad14 |
Fortunately it is possible to create a new console upon a single
|
|
Packit Service |
50ad14 |
keystroke, regardless of what is happening at the current console.
|
|
Packit Service |
50ad14 |
If you have spawn_login from kbd-1.04.tar.gz and you put
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
loadkeys << EOF
|
|
Packit Service |
50ad14 |
alt keycode 103 = Spawn_Console
|
|
Packit Service |
50ad14 |
EOF
|
|
Packit Service |
50ad14 |
spawn_login &
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in /etc/rc.local , then typing Alt-UpArrow will create a fresh VC
|
|
Packit Service |
50ad14 |
running login (and switch to it). With spawn_console & instead of
|
|
Packit Service |
50ad14 |
spawn_login & you'll have bash running there.
|
|
Packit Service |
50ad14 |
See also open-1.4.tgz and dynamic-vc-1.1.tar.gz .
|
|
Packit Service |
50ad14 |
What action should be taken upon this Spawn_Console keypress
|
|
Packit Service |
50ad14 |
can also be set in /etc/inittab under kbrequest ,
|
|
Packit Service |
50ad14 |
if you have a recent init . See inittab(5).
|
|
Packit Service |
50ad14 |
(This action can be something entirely different - I just called
|
|
Packit Service |
50ad14 |
the key Spawn_Console because that is what I used it for.
|
|
Packit Service |
50ad14 |
When used for other purposes it is less confusing to use
|
|
Packit Service |
50ad14 |
its synonym KeyboardSignal.
|
|
Packit Service |
50ad14 |
For example, some people like to put the lines
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
kb::kbrequest:/sbin/shutdown -h now
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in /etc/inittab , and
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
control alt keycode 79 = KeyboardSignal
|
|
Packit Service |
50ad14 |
control alt keycode 107 = KeyboardSignal
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in their keymap. Now Ctrl-Alt-End will do a system shutdown.)
|
|
Packit Service |
50ad14 |
You can only login as "root" on terminals listed in /etc/securetty .
|
|
Packit Service |
50ad14 |
There exist programs that read terminal settings from files
|
|
Packit Service |
50ad14 |
/etc/ttys and /etc/ttytype . If you have such
|
|
Packit Service |
50ad14 |
files, and create additional consoles, then it might be a good idea
|
|
Packit Service |
50ad14 |
to also add entries for them in these files.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Next
|
|
Packit Service |
50ad14 |
Previous
|
|
Packit Service |
50ad14 |
Contents
|
|
Packit Service |
50ad14 |
</BODY>
|
|
Packit Service |
50ad14 |
</HTML>
|