7

So when i try to use the Xorg command as a normal user, this is the error that it gives me :

/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server

but i don't understand, what are the "console users"? and when i switch to root it gives me another error :

_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
(EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.

So what is going on and what are the reason for each of these errors?

UPDATE: and the output of the command netstat -ln | grep -E '[.]X|:6[0-9][0-9][0-9] is :

unix  2      [ ACC ]     STREAM     LISTENING     18044    @/tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     47610    @/tmp/.X11-unix/X1
unix  2      [ ACC ]     STREAM     LISTENING     18045    /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     47611    /tmp/.X11-unix/X1
  • @sourcejedi can you give me a link or resource that explains this console user? i googled console users in linux but there was nothing! – John P Oct 30 '18 at 20:35
  • please edit your question to note the version of Debian. The question I linked claimed that Xwrapper is not used anymore in Debian 9. (I think the "console users" error comes from Xwrapper, although it's possible your message comes from new-style Xorg that you run directly and which gains access using systemd-logind. – sourcejedi Oct 30 '18 at 20:36
  • @sourcejedi I'm actually using Kali linux which is debian based, the kali version is 2018.4, also when i run it as root it won't give me that console user error anymore, but some new types of error : Fatal server error: (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) – John P Oct 30 '18 at 20:45
  • @sourcejedi it still gave me the same error – John P Oct 31 '18 at 7:29
  • 1
    @sourcejedi yes it changed from Xorg.0.log to Xorg.1.log, and i updated the question for the output of the command you mentioned – John P Oct 31 '18 at 13:37
6
/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server

but i don't understand, what are the "console users"?

It means you need to be running from the Linux text console, it actually does not matter what user you are. (Except that root is always allowed). Confusing :).

There are two different examples of switching to the Linux text console (and back) here, depending on exactly how your system is configured:

Switch to a text console in Fedora

The details can vary, as to which numbered consoles (Ctrl+Alt+F1, Ctrl+Alt+F2, etc) allow a text login, and which ones are used for graphical sessions (or not used at all).


I keep getting the message: "Cannot establish any listening sockets..."

You get an error message like:

_XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running

This problem is very similar to the previous one. You will get this message possibly because the lock file was removed somehow or some other program which doesn't create a lock file is already listening on this port. You can check this by doing a netstat -ln. Xservers usually listen at tcp port 6000+, therefore if you have started your Xserver with the command line option :1 it will be listening on port 6001. Please check the article above for further information.

As this says, there is more information about what :0, :1, :2 mean, immediately above the quoted section:

https://www.x.org/wiki/FAQErrorMessages/#index5h2

(Note that you are using a more modern X server config, which does not listen on any TCP ports. This is why your error happens in _XSERVTransSocketUNIXCreateListener, instead of _XSERVTransSocketInetCreateListener. But the principle is exactly the same).

When i tried Xorg :2 in my virtual machine with Kali, the screen went black, why did this happen?

A-ha, yes :-D. Xorg is a graphics server. If you want to show some graphics on it, you need to run some client programs.

Xorg also starts up with an empty cursor nowadays. It's deliberately featureless, to avoid flashes / inconsistencies when starting your graphical stuff. This has changed - when I first used Xorg, the default background and cursor were quite obtrusive. If you want to see what that looked like, you can pass the -retro option :-).

Traditionally - and I think this is the behaviour with Xwrapper - Xorg would grab an unused console and switch to it. In this case you can switch back to your previous console (see above). Of course you can switch back again to the Xorg server, once you find which number console it grabbed :-).

If you are running a virtual machine on Linux, your VM will provide some method to inject the key combination Ctrl+Alt+F1 or whatever, because pressing that key combination probably switches consoles on your real machine.

I would tell you to compare startx -- :2, which (hopefully) launches some clients as well as an X server :-). However, the most popular modern GUIs now explicitly do not support multiple sessions. So you must make sure to logout your existing GUI session, before you run startx. Otherwise, it might look like it works, but then go wrong in weird ways that you don't understand.

  • Thanks for the answer, one thing i forgot to mention is when i tried Xorg :2 in my virtual machine with Kali, the screen went black, why did this happen? – John P Oct 31 '18 at 15:57
  • @JohnP edited. The answer is "because you started Xorg". However, this is unsettling and it was clear you weren't familiar with Xorg, so I think the answer probably does need to say something about why this is expected. – sourcejedi Oct 31 '18 at 16:35
7

If you are sure about the security implications (anyone can start the X-Server with root rights, which, since it has privileged hardware access and accesses a lot of files can open up a big security hole) and care only for functionality, not for security, for

So when i try to use the Xorg command as a normal user, this is the error that it gives me :

/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server

the following can help:

You can add to

/etc/X11/Xwrapper.config

the line

allowed_users = anybody

From man Xorg.wrap:

CONFIG FILE
[...]
allowed_users = rootonly|console|anybody Specify which users may start the X server through the wrapper. Use rootonly to only allow root, use console to only allow users logged into a physical console, and use anybody to allow anybody. The default is console.

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.