Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read configuration for only virtual X server #1606

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

RolKau
Copy link
Contributor

@RolKau RolKau commented Jun 14, 2020

When the X server is launched, only the configuration main file
xrdp/xorg.conf is specified, but the configuration directory is
retained as default, as is indicated by the output:

(==) Using config directory: "/etc/X11/xorg.conf.d"

in ~/.xorgxrdp.10.log. If the host has an existing X server running for
the console, and this is not entirely auto-configured, configuration
files from this directory will be picked up and cause the virtual X
server that XRDP launches to attempt to load modules for it, which may
result in errors such as:

(EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)

or

(EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)

Searching the Internet for these errors will typically lead the user to
a myriad of non-solutions, involving added the user to the tty group, or
editing /etc/X11/Xwrapper.config.

This changeset changes the configuration of the virtual X server so that
it considers only /etc/X11/xrdp as its proper configuration directory,
and pick up the xorg.conf file by default from there.

When the X server is launched, only the configuration _main file_
xrdp/xorg.conf is specified, but the configuration _directory_ is
retained as default, as is indicated by the output:

    (==) Using config directory: "/etc/X11/xorg.conf.d"

in ~/.xorgxrdp.10.log. If the host has an existing X server running for
the console, and this is not entirely auto-configured, configuration
files from this directory will be picked up and cause the virtual X
server that XRDP launches to attempt to load modules for it, which may
result in errors such as:

    (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)

or

    (EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)

Searching the Internet for these errors will typically lead the user to
a myriad of non-solutions, involving added the user to the tty group, or
editing /etc/X11/Xwrapper.config.

This changeset changes the configuration of the virtual X server so that
it considers only /etc/X11/xrdp as its proper configuration directory,
and pick up the xorg.conf file by default from there.
@moobyfr
Copy link
Contributor

moobyfr commented Jun 14, 2020

I had a look some years ago with the autoloading of modules. I came to the conclusion that the HAL part of Xorg loads modules directly without having to look for configuration files. For example, the load of nv, nouveau or nvidia can be made without having to specify it in the configuration file. Does the usage of configdir stop these mecanisms ?

If the -config switch is left out, the server will attempt to load
settings from the default file /etc/X11/xorg.conf. This file is now
usually non-existent; most distributions preferring to have the
configuration through files in /etc/X11/xorg.conf.d instead.

But in order to prevent any legacy settings that are put there to
interfere with XRDP, _both_ config and configdir should be redirected
to the xrdp/ subdirectory. This will overspecify the configuration by
having the xrdp/xorg.conf file probably read twice; this does not seem
to cause any harm. Incidentally, it does seem to make the X server now
pick up xrdpdev as a GPUDevice(?).
@RolKau
Copy link
Contributor Author

RolKau commented Jun 15, 2020

Does the usage of configdir stop ... [automatic loading of nv through HAL]

I am not really sure, but I think that the loading code works by first reading the file specified by -config, then appending all the files found in -configdir, and in the end auto-configuring what is missing. I know that with an X server connected to real hardware, you can for instance specify mouse settings in /etc/X11/xorg.conf.d, and have the monitor hardware probed automatically.

@metalefty metalefty self-assigned this Jun 15, 2020
@RolKau
Copy link
Contributor Author

RolKau commented Jun 15, 2020

I found that there is another potential bug lurking: If -config is not specified, it will read the default /etc/X11/xorg.conf, which of course can contain whatever irrelevant to xrdp. There doesn't seem to be some way of saying that you don't want a -config or -configdir (other than setting it to an invalid directory, which leaves an error message); over-specifying by pointing both to the same destination seems to work just as fine.

@RolKau RolKau changed the title Read only configuration for virtual X server Read configuration for only virtual X server Jul 8, 2020
@RolKau
Copy link
Contributor Author

RolKau commented Aug 26, 2020

load of nv, nouveau or nvidia can be made without having to specify it in the configuration file. Does the usage of configdir stop these mecanisms

FWIW, if I add myself to the render group (I am on a Debian derivative):

sudo adduser $(whoami) render

then I get these lines in ~/.xorgxrdp.10.log

[598498.241] rdpProbe: found DRMDevice xorg.conf value [/dev/dri/renderD128]
[598498.241] rdpProbe: found DRI3 xorg.conf value [1]
[598498.241] (II) XRDPDEV(0): using default device
...
[598498.241] rdpPreInit: /dev/dri/renderD128 open ok, fd 10
...
[598498.241] rdpPreInit: glamor module load ok
[598498.291] (II) XRDPDEV(0): glamor X acceleration enabled on Radeon RX 580 Series (POLARIS10, DRM 3.35.0, 5.4.0-42-generic, LLVM 10.0.0)
[598498.291] rdpPreInit: glamor init ok

even if both -config and -configdir are now redirected to /etc/X11/xrdp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants