7

Normally when system starts you have all output printed on the TTY1, and that's ok, but I start X-server via startx and achieve this by the following lines in the ~/.profile file :

if [[ $(tty) = /dev/tty4 ]]; then
    exec startx &> ~/.xsession-errors
fi

So, as you can see I use TTY4 to start X-server, and I want to switch to that console automatically after the boot is done. Is there a way to do this?

5

I've found the answer. It's simple, you just have to add chvt 4 to /etc/rc.local file, and that's it.

1
# /etc/inittab
4:2345:respawn:/bin/login -f username tty4 < /dev/tty4 > /dev/tty4 2>&1

Normally you would have here a getty line, see man getty,

   agetty opens a tty port, prompts for a login name and invokes the
   /bin/login command.

and man login

   The login program is used to establish a new session with the system.

but this line calls directly login and opens a shell defined in the Gecos field on tty4.

See also man 5 inittab.

See also my prevous answer How to resolve Xserver failure.

  • Could you tell me what the line does? – Mikhail Morfikov Feb 17 '14 at 14:08
  • On Virtual Terminal #4... When in runlevel 2, 3, 4 or 5... If the program running here (/bin/login) terminates, restart it (every time it terminates)... Run the program /bin/login on Virtual Terminal #4, stdin is VT #4, stdout is VT #4, stderr is hooked to stdout. (not sure about -f username... try man login) – Baard Kopperud Feb 17 '14 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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