You are not logged in.

#1 2012-02-09 22:19:32

shushu
Member
Registered: 2012-01-24
Posts: 35

Random question: Why are there multiple virtual consoles?

I'm very interested in every single detail of some things and that has spawned a random question.

Why do we have multiple virtual consoles(proper term?) ?  i.e. if I am looking at my desktop I can simply hit ctrl-alt-f3 for example, and poof!  I'm at a new login prompt.

What is/are the purpose(s) for this feature?  Can someone name off some scenarios?

Thanks!

Offline

#2 2012-02-09 22:31:28

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Random question: Why are there multiple virtual consoles?

Purpose: you can log into multiple consoles at once.
Not everyone uses tmux / dvtm or X.

You can set the number of consoles and even which of them (e.g. 1, 3 & 4) are spawned in /etc/inittab.

Offline

#3 2012-02-09 22:36:17

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,140

Re: Random question: Why are there multiple virtual consoles?

I don't know why there are 6 rather than 5 or 7, say, but having multiple can be very useful. Suppose you start a process which gets out of control and which you can't find a way to stop - you can often switch to another console, log in and kill it. That's much cleaner than, say, hitting the power button. Basically many of the same reasons you might find a virtual console useful in addition to a gui on tty7, I guess.

I'm not sure if that is historically why. But it is a reason I'm quite pleased there are!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#4 2012-02-09 23:01:24

RichAustin
Member
From: Wakefield, Yorkshire, England
Registered: 2011-07-27
Posts: 186

Re: Random question: Why are there multiple virtual consoles?

I sometimes use two or three consoles when the GUI won't start. I might open a couple of log files and another for fixing the issue. You could use Links (or similar) to browse the web in one console while fixing an issue in another - never tried it myself except when setting a system up.

Just remembered why I use them the most actually - so that I can do a clean shutdown / reboot if the system has died for some reason. I used this sort of idea only the other day to turn off auto login in the Slim config file and reboot when OpenBox died on me. I also used the consoles to fix the issue with the upgrade - I hadn't updated correctly.

Last edited by RichAustin (2012-02-09 23:06:07)

Offline

#5 2012-02-09 23:05:48

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Random question: Why are there multiple virtual consoles?

karol wrote:

Purpose: you can log into multiple consoles at once.
Not everyone uses tmux / dvtm or X.

You can set the number of consoles and even which of them (e.g. 1, 3 & 4) are spawned in /etc/inittab.

Not to mention that X needs its own console to run on, which means that if you want to launch X from the command line (and everyone does--even GDM and KDM do so, though they usually reserve TTY7 for themselves), you'd better have more than one virtual console ready.  If you use "startx" to--well, start X--you'll need one vc to launch it, one for it to run on and one to fall back to if trouble arises.  And being left without a fallback can be frustrating: I don't know how many times I've had Windows lag or lock up on me over the last few years, and my first reaction was to hit Ctrl+Alt+F2. tongue

Last edited by ANOKNUSA (2012-02-09 23:07:15)

Offline

#6 2012-02-09 23:10:13

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Random question: Why are there multiple virtual consoles?

I never had much trouble with X. I've used the extra consoles for reading some notes, logs or man pages while compiling or experimenting with X-less setup.

Offline

#7 2012-02-10 01:00:59

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Random question: Why are there multiple virtual consoles?

Of course, not all of us use a login manager either.  If you use startx from a command line, this makes it really easy to open another  X session.

BTW, did you know you can set things up to start a VirtualBox machine from startx ?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2012-02-10 01:45:53

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,140

Re: Random question: Why are there multiple virtual consoles?

I've been using it recently to shutdown when KDE becomes unusable after disconnecting an external monitor, something I've so far been unable to solve.

Otherwise, I'd have to press the power button - ctrl + alt + f* is the only way out. (Either the only thing which gets a response or the only thing which gets me something visible or...)

The virtual consoles stay on my laptop screen even when X has put the gui in never never land...

I also used it to take notes through a talk - I didn't want to restart the machine because of noises etc. So I just used vim while X was frozen on tty7. (Didn't work very well because it kept beeping but I think I've managed to kill that now. Why is that the *default*?!)

Last edited by cfr (2012-02-10 01:47:27)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#9 2012-02-10 15:07:17

shushu
Member
Registered: 2012-01-24
Posts: 35

Re: Random question: Why are there multiple virtual consoles?

cfr wrote:

Suppose you start a process which gets out of control and which you can't find a way to stop - you can often switch to another console, log in and kill it.

How is this done?  I can't tell you how many times I've boogered up syntax in something I was tinkering with and ended up locking up X or having something happen and I've had to hit the power button and manually boot into run mode 3 to undo it.

Offline

#10 2012-02-10 15:13:00

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: Random question: Why are there multiple virtual consoles?

shushu wrote:
cfr wrote:

Suppose you start a process which gets out of control and which you can't find a way to stop - you can often switch to another console, log in and kill it.

How is this done?  I can't tell you how many times I've boogered up syntax in something I was tinkering with and ended up locking up X or having something happen and I've had to hit the power button and manually boot into run mode 3 to undo it.

Usually with 'Ctrl+Alt+F#' where # represents the TTY number. F1-F12+ depending on if you enable that many TTYs. Rebooting is usually a last resort in [Li,U]nix.

General information: http://www.linusakesson.net/programming/tty/index.php

Last edited by Earnestly (2012-02-10 15:15:21)

Offline

#11 2012-02-10 15:15:14

shushu
Member
Registered: 2012-01-24
Posts: 35

Re: Random question: Why are there multiple virtual consoles?

I meant the kill process.  How does one locate (from another console) the process which is out of control, then kill it?

Offline

#12 2012-02-10 15:15:34

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: Random question: Why are there multiple virtual consoles?

I meant the kill process.  How does one locate (from another console) the process which is out of control, then kill it?

ps

Last edited by Earnestly (2012-02-10 16:55:07)

Offline

#13 2012-02-10 15:23:14

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Random question: Why are there multiple virtual consoles?

ewaller wrote:

BTW, did you know you can set things up to start a VirtualBox machine from startx ?

Are you talking about VBoxHeadless?

[rant]Because that feature is crap in my opinion.  Last I checked, you couldn't 'attach a head' later, and you couldn't reconfigure the VM as you could when it was run 'headed', like enabling 'Cable connected' on a network adapter.  Thank god I started virtualization with VMware or I might think I had to put up with such nonsense.[/rant]


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#14 2012-02-10 15:32:02

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Random question: Why are there multiple virtual consoles?

alphaniner wrote:
ewaller wrote:

BTW, did you know you can set things up to start a VirtualBox machine from startx ?

Are you talking about VBoxHeadless?

[rant]Because that feature is crap in my opinion.  Last I checked, you couldn't 'attach a head' later, and you couldn't reconfigure the VM as you could when it was run 'headed', like enabling 'Cable connected' on a network adapter.  Thank god I started virtualization with VMware or I might think I had to put up with such nonsense.[/rant]

No, You can actually use VirtualBox itself as a WM.  Just pass in the machine you want to run as an argument.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#15 2012-02-10 16:21:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Random question: Why are there multiple virtual consoles?

shushu wrote:

I meant the kill process.  How does one locate (from another console) the process which is out of control, then kill it?

I usually use htop ;P

Offline

#16 2012-02-10 20:06:23

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: Random question: Why are there multiple virtual consoles?

Multiple TTYs can act like browser tabs. But honestly, I can't be bothered to log in just to kill a process... If a process goes wild and makes my computer unresponsive, I press Ctrl+Alt+F1 and Ctrl+C to "cancel" the X session. Then I run "startx". It's very effective, usually taking up 3-5 seconds.

On Windows I would probably have to reboot because 9 out of 10 times it's faster than waiting around for the Task Manager to show up, waiting for the "Processes" tab to be drawn, scroll down, click the fricken process, press "End Task", wait for the confirmation, press "Yes". Much, much faster to just reboot.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#17 2012-02-10 20:12:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Random question: Why are there multiple virtual consoles?

DSpider wrote:

Multiple TTYs can act like browser tabs. But honestly, I can't be bothered to log in just to kill a process... If a process goes wild and makes my computer unresponsive, I press Ctrl+Alt+F1 and Ctrl+C to "cancel" the X session. Then I run "startx". It's very effective, usually taking up 3-5 seconds.

Sometimes you don't want to kill the whole X, just e.g. a game that turned your screen all black.

Offline

#18 2012-02-10 22:40:59

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,140

Re: Random question: Why are there multiple virtual consoles?

karol wrote:
DSpider wrote:

Multiple TTYs can act like browser tabs. But honestly, I can't be bothered to log in just to kill a process... If a process goes wild and makes my computer unresponsive, I press Ctrl+Alt+F1 and Ctrl+C to "cancel" the X session. Then I run "startx". It's very effective, usually taking up 3-5 seconds.

Sometimes you don't want to kill the whole X, just e.g. a game that turned your screen all black.

Plus that method only works if you start X from a console. If X is started at boot, you have to log into a console even if you do want to kill X completely and restart it.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#19 2012-02-11 03:54:04

Forgotten Path
Member
Registered: 2012-02-07
Posts: 20

Re: Random question: Why are there multiple virtual consoles?

ewaller wrote:
alphaniner wrote:
ewaller wrote:

BTW, did you know you can set things up to start a VirtualBox machine from startx ?

Are you talking about VBoxHeadless?

[rant]Because that feature is crap in my opinion.  Last I checked, you couldn't 'attach a head' later, and you couldn't reconfigure the VM as you could when it was run 'headed', like enabling 'Cable connected' on a network adapter.  Thank god I started virtualization with VMware or I might think I had to put up with such nonsense.[/rant]

No, You can actually use VirtualBox itself as a WM.  Just pass in the machine you want to run as an argument.


How so?  I tried running

virtualbox --startvm Windoze

on a virtual console and received an error about finding the X server.  Also tried VBoxSDL with no luck.

Running VBox in a virtual console is very interesting to me for some reason...  LOL

Offline

#20 2012-02-11 17:10:30

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Random question: Why are there multiple virtual consoles?

Forgotten Path wrote:

How so?  I tried running

virtualbox --startvm Windoze

on a virtual console and received an error about finding the X server.

Here is my ~/.xinitrc

#xset b off
setxkbmap -option ctrl:nocaps

case $WM in
kde)
	ck-launch-session dbus-launch startkde
	;;
gnome)
	ck-launch-session dbus-launch gnome-session
	;;
compiz)
	~/bin/compiz&
	ck-launch-session dbus-launch compiz ccp
	#ck-launch-session dbus-launch fusion-icon
	;;
lxde)
	~/bin/lxde&
	ck-launch-session dbus-launch startlxde
	;;
openbox)
	~/bin/openbox&
	ck-launch-session dbus-launch openbox
	;;
e17)
	ck-launch-session dbus-launch
    enlightenment_start
    ;;
vb)
    VirtualBox -startvm "Windows XP" -fullscreen
    ;;
xfce4)
	ck-launch-session dbus-launch startxfce4
	;;
i3)
	ck-launch-session dbus-launch i3
	;;
*)
	ck-launch-session dbus-launch startxfce4
	;;
esac

From the console, use :

WM=vb startx

or, if there is already something running on Screen 0 (OpenBox, Xfce4, whatever) simply:

WM=vb startx -- :1

Note that the examples start VitutalBox.  I could just as easily set WM to any of the other environments defined in my .xinitrc.

I have also made this work straight from kdm.  I think I created a custom session, but I may have created a .desktop file in /usr/share/apps/kdm/sessions/ 
I am not using kdm on this machine and I don't remember hmm

edit: Typo

Last edited by ewaller (2012-02-11 23:14:09)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#21 2012-02-11 22:01:50

Forgotten Path
Member
Registered: 2012-02-07
Posts: 20

Re: Random question: Why are there multiple virtual consoles?

Ah...  Thanks for your reply!  Now looking into running VirtualBox as a session with GDM.  smile

Offline

Board footer

Powered by FluxBB