Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our machine runs a modified RedHat 9 (Kernel Linux 2.6.20-1.21, GNOME 2.10.0). When USB mouse is plugged in, the X Window will always switch out, we have to switch back by Alt + F7. There is no such problem with PS2 mouse.

So, one line was added into /etc/udev/rules.d/15-mouse.rules:

KERNEL=="mouse", BUS=="usb", SYSFS{product}=="Mouse", MODE="0660", NAME="input/mouse0", PROGRAM="/bin/sh -c 'chvt 8; chvt 7'"

But these days, we found this doesn't work for 2 machines. I have to use Alt + F9 to switch back to X Window.

I am new to this, can anybody help me to understand:

  1. Why virtual terminals are switched when USB mouse is plugged in?

  2. I thought #7 virtual terminal is used for X window, why it is changed to #9?

Thank you.

share|improve this question
@warl0ck Not sure. This is for an old product, which runs only this modified Red Hat 9. I'll test with a new distro. – Rufus Sep 14 '12 at 7:09
1. The vt switch when plugging in a mouse looks like an X server bug. – Gilles Sep 14 '12 at 23:11

I thought #7 virtual terminal is used for X window, why it is changed to #9?

You can start your X window system on an arbitrary virtual terminal. There is no restriction. To change that on your current setup you have to look at the configuration/initialization file of your display manager. For example if you use xdm you can define on which vt you want to start your X server in /etc/X11/xdm/Xservers. In this case the line of interest looks like

:0 local /usr/bin/X :0 vt<no> -nolisten tcp

Where <no> is the number of the virtual terminal on which you want to start the X-server. For other display managers the approach is a similar.

It is important that the number of the vt must be different from the numbers of those terminals getty is bound to. Usually the first six vt's are bound to getty so in most cases a number greater than six is just fine.

To test that the used vt is really arbitrary you can start another instance of your standard X server on another vt by

xinit -- :99 vt8

This, for example starts a new instance on vt8 if display number 99 isn't already in use.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.