Error when trying to use Xorg: Only console users are allowed to run the X server?

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.


/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.