I'm running Slackware GNU/Linux 14.2, which doesn't start an X server by default. On a whim, I tried running startx inside a screen session and got the warning

/usr/libexec/Xorg.wrap: Only console users are allowed to run the X server
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Couldn't get a file descriptor referring to the console

Why can't I run startx from inside a screen session? What resource can you access on a "raw" console that you can't on a shell running under screen?

  • Pardon? ssh is not involved. I am running Slackware on my laptop. Commented Dec 5, 2016 at 5:44
  • Which distribution? On Debian, there is a configuration option, to restrict starting X only from console user or only from root or all can do it. Commented Dec 5, 2016 at 14:55

3 Answers 3


Running startx only makes sense if you are in front of the computer. Testing for console ownership is one way to determine this. As you have found out, it can be fooled by operating in a screen session. In that case, no X for you.


A typical Linux system has a fixed number of virtual terminals/consoles (VCs), which are assigned devices /dev/tty1, /dev/tty2, etc. These are used for console login shells and can be accessed using the keystrokes Ctrl-Alt-F1, Ctrl-Alt-F2, etc.

In addition there are pseudo terminals (PTYs), which have names like /dev/pts/19. These are used for terminal emulators like Xterm, for SSH sessions, Screen windows, and so on.

You can find out which kind your shell is running on like this:

$ echo $TTY

For reasons I'm not very clear about, full-screen graphics software like Xorg needs to be associated with a virtual console. Since X can't run unless it has permissions to write to the VC device (e.g. /dev/tty7), it probably starts by opening this device and using it to send certain requests to the kernel. I imagine that these requests would not be understood by a PTY device.

Below, you can see the permissions of two VC devices. In the first one, /dev/tty1, I'm logged in as myusername and you can see that the program which logged me in has changed the device to be owned by me. The second line, /dev/tty2, is owned by root because it is still showing the login prompt:

$ ls -al /dev/tty{1,2}
crw------- 1 myusername tty 4, 1 Dec  9 05:47 /dev/tty1
crw--w---- 1 root       tty 4, 2 Dec  9 05:11 /dev/tty2

If you would like to run startx on a specified VC, but you don't have access to it directly (for example if you are logged in via SSH, or talking to a Screen window), then you can use systemd-run as described here. That method requires sudo privileges, but in the end you'll be running startx as a normal user as if you had logged in to the specified VC.


To understand this first we have to understand the difference between terminal, shell and console.

  • Terminal is a program that run a shell , in the past it was a physical device (Before terminals were monitors with keyboards, they were teletypes) and then its concept was transferred into software, like Gnome-Terminal.
  • Gnome-Terminal, a black windows appear that run Shell so we can run our commands.
  • Console is a special sort of terminal, it was also a Physical device . example in Linux we have virtual consoles which we can access them by combination of Ctrl + Alt + F1 to F7.

virtual consoles because in early times it was a physical device. but now it not a saparate dedicated device. so we call it virtual terminals..

Most terminals nowadays are strictly speaking terminal emulators. It is a type of role in the workings of a UNIX-like system and at the same time the basic interface offered by the systems.

In fact everything, including the GUI builds on top of it.[1]

Colloquially we can say "terminal" refer to end-points in a computer network with a star-topography.

then a question arises. As GUI are built up on console. then what to do if we want to do some command line operations. and the answer for that is terminal... which further emulates the console.. and let us enter our favorite command in it.

explanation of [1]

So Here we know that even GUI is built up on console.. and by entering the command startx you further again are requesting to open up and new XServer. So think by your own why should the GUI Terminal should let you to do that???[do you want to break your XServer??]. and if you really want to force that command.. just run startx command by administrative privileges. you will succeed but for sure you are going to break your XServer runtime.

and to answer you last question.. [What resource can you access on a "raw" console that you can't on a shell running under screen?]

In fact till now i don't saw any case where i cannot access the resource by the terminal running on Xserver. You must be able to access all the resources by the internal Xserver GUI terminal.. (because that too was designed to fullfill all the needs that ordinary console was giving!!!)..

But running a command which results the same as Cutting a branch of tree on while sitting exactly on that branch.. will definitely create error.

Everything makes sense in field of Computer Science.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .