4

When I use ctrl+alt+F7 and switch to the X11 server, I can see the desktop UI.

When I switch to ctrl+alt+[F1-F6], I can see the virtual terminal.

Now how do I access the virtual terminal 7 where I can input commands even though X is running parallely

thanasisp
  • 7,802
  • 2
  • 26
  • 39
user446881
  • 43
  • 2

2 Answers2

8

If you run fuser /dev/tty7, you'll see that the X11 server is actually holding that TTY device for itself.

The X11 server is not running parallel to virtual console 7, but actually in virtual console 7. It is switching that virtual console to graphics mode and using it.

By itself, a virtual console is just a black screen with maybe a cursor blinking in the top left corner. If a virtual console is otherwise unoccupied, you can use it by e.g. piping logs or other important messages to it.

There are multiple programming interfaces for a virtual console: the default one is a TTY emulator, which can be used to run a getty process to allow command-line logins. But on modern systems, there is usually also the frame-buffer interface (either VESA SVGA or UEFI GOP). If the GPU driver kernel modules are loaded, there is also kernel modesetting and Direct Rendering Interface (DRI). If possible, the X11 server will use DRI and kernel modesetting, but it can fall back to the framebuffer interface or even to old-school direct hardware access if necessary.

telcoM
  • 87,318
  • 3
  • 112
  • 232
6

You can’t, your X server is running there. It takes over the virtual terminal.

Your terminals 1 through 6 are running a getty variant, and that’s what starts the login process and then the shell running in the virtual terminal. But you can’t have a getty-based session and a display server in the same virtual terminal.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • why it's not the case where they can start X in a background mode using & and still keep the getty session alive? In case of typing "xeyes &" in emulator, I still have the command line alive and the "double eyes UI" pops up in front. Sorry if I'm having a lame understanding on this. – user446881 Dec 17 '20 at 12:54
  • You can do that, if you start X on another VT (`X -vt 8` for example). Starting a program “in the background” only works if that program either doesn’t need input or produce output, or does so using some other way — `xeyes` is an X client, so it goes through the X server for its interface, not through the terminal where it was started (if any). – Stephen Kitt Dec 17 '20 at 13:07
  • Two follow up questions, 1) X doesn't take any input from user(me) , not very clear why it's running in foreground. 2) does the input to X applications (GUI), follow, keyboard - kernel - tty7 - X Server - Application? Or does it skip tty7 – user446881 Dec 17 '20 at 13:13
  • 1. Yes, it does, unless you’re not touching your keyboard and mouse etc. 2. See [this answer](https://unix.stackexchange.com/a/361367/86440) for details. – Stephen Kitt Dec 17 '20 at 13:16