Skip to content

Instantly share code, notes, and snippets.

@Nexarian
Last active December 18, 2024 01:09
Show Gist options
  • Save Nexarian/0eb26a3284b21b55b6e1e8653ed88ec9 to your computer and use it in GitHub Desktop.
Save Nexarian/0eb26a3284b21b55b6e1e8653ed88ec9 to your computer and use it in GitHub Desktop.
Setup for XRDP using Nvidia Acceleration
#!/usr/bin/env bash
set -e
cd ~
sudo -v
# Make sure system is in a good, updated, clean, state.
sudo apt-get -y update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
# Install CUDA (Shamelessly copied from Nvidia's website):
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda
sudo usermod $USER -a -G video
sudo usermod $USER -a -G tty
sudo usermod $USER -a -G render
# XRDP Build Pre-reqs Part 1
sudo apt-get -y install git autoconf libtool pkg-config gcc g++ make \
libssl-dev libpam0g-dev libjpeg-dev libx11-dev libxfixes-dev libxrandr-dev \
flex bison libxml2-dev intltool xsltproc xutils-dev python3-libxml2 g++ \
xutils libfuse-dev libmp3lame-dev nasm libpixman-1-dev xserver-xorg-dev \
libjson-c-dev libsndfile1-dev libspeex-dev libspeexdsp-dev libpulse-dev \
libpulse0 autopoint \*turbojpeg\* libfdk-aac-dev libopus-dev libgbm-dev \
libx264\* libx264-dev
#XRDP Build Pre-reqs Part 2 (For some reason apt needs this to be separate)
sudo apt-get -y install libepoxy-dev
#System Pre-reqs
sudo apt-get -y install xorg xserver-xorg-legacy dbus-x11
sudo apt-get -y remove dbus-user-session
sudo tee /etc/X11/Xwrapper.config > /dev/null << EOL
# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the
# xserver-xorg-legacy package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the xserver-xorg-legacy
# package *only* if it has not been modified since the last upgrade of that
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
# dpkg-reconfigure xserver-xorg-legacy
needs_root_rights=no
allowed_users=anybody
EOL
echo "gnome-session --session=ubuntu" > ~/.xsession
sudo chmod +x ~/.xsession
sudo tee ~/.xsessionrc > /dev/null << EOL
export DESKTOP_SESSION=ubuntu
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
EOL
sudo chmod +x ~/.xsessionrc
BUILD_DIR=$(mktemp -d)
echo "Building xrdp..."
git clone https://github.com/Nexarian/xrdp.git --branch mainline_merge "$BUILD_DIR/xrdp"
cd "$BUILD_DIR/xrdp"
./bootstrap
./configure --enable-fuse --enable-rfxcodec --enable-pixman --enable-mp3lame \
--enable-sound --enable-opus --enable-fdkaac --enable-x264 --enable-nvenc
make -j $(nproc) clean all
sudo make install
echo "Building xorgxrdp..."
git clone https://github.com/Nexarian/xorgxrdp.git --branch mainline_merge "$BUILD_DIR/xorgxrdp"
cd "$BUILD_DIR/xorgxrdp"
./bootstrap
./configure --with-simd --enable-lrandr
make -j $(nproc) clean all
sudo make install
echo "Configuring Nvidia..."
BUS_ID=$(nvidia-smi --query-gpu=pci.bus --format=csv | sed -n '2 p' | xargs -I{} printf "%d\n" {})
# Alternative method to get the BUS ID that doesn't work on some systems (Such as a laptop with an Intel iGPU and an Nvidia Discrete GPU).
# BUS_ID=$(lspci | grep -e 'VGA.*NVIDIA' | cut -d: -f1 | xargs -I{} printf "%d\n" 0x{} | sed -n 1p)
# nvidia-xconfig --query-gpu-info
sudo sed -i -E 's/(BusID "PCI:)[[:digit:]]+(:0:0")/\1'$BUS_ID'\2/' /etc/X11/xrdp/xorg_nvidia.conf
echo "Starting the server..."
sudo systemctl enable xrdp
sudo service xrdp start
@alexanderzjs
Copy link

I'm trying to run xrdp with gpu acceleration on a headless ubuntu 22.04 server. It is a fresh installation and I have done apt install ubuntu-desktop and then run this script. But the desktop does not load, I get "Can't create session for user testusr - X server could not be started".

What is missing, what am I doing wrong?

logs

As far as I know, if you want a headless server, you have to have a seated session and then configure your Xorg session with a virtual display card. I haven't tried yet, but I have tested it with Sunshine server. I will post the Sunshine server setup and you can adapt it to xrdp. If it works, you can also re-post a xrdp version to help others.

Setup

NOTE: The steps here only need to be performed once on your computer; after these are done, you only need to follow the steps under the "Execution" section.

  1. sudo systemctl set-default multi-user.target (original graphical.target): Set the graphical target to multi-user target so that the server will not give desktop manager on boot. After done, reboot your system.

  2. sudo usermod -a -G tty myusername: The user that will be connecting in via SSH must be in the 'tty' group on the system where Sunshine will be started. This is required because when we start Xorg, it will attempt to access the specific virtual TTY we give it to use. NOTE: You'd better reboot to take effect. Use the 'groups' command to verify that you see 'tty' before proceeding.

  3. sudo setcap CAP_SYS_RAWIO+eip /usr/lib/xorg/Xorg: You need to run the command below to give the capability 'CAP_SYS_RAWIO+eip' to the /usr/lib/xorg/Xorg executable. Note that some more research needs to be done into the implications of doing this but if you don't provide that capability than the Xorg server session will fail with an error: xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)

  4. sudo vim /etc/X11/Xwrapper.conf: You will need to edit the /etc/X11/Xwrapper.conf file and change the 'allowed_users' to 'anybody'. While this will have some security implications they should be managable as this should only be giving the required permission to valid and logged in users to start an Xorg server session. The default, which is typically 'console', requires that you log in with one of the virtual TTYs for the system and this is no different than physically logging into the system anyways (the exact thing we're trying to avoid). Reboot your system to make sure this takes effect before proceeding.

  5. You will need to create a custom Xorg configuration file that is suitable for use with a "headless" session (i.e., one in which we don't really use the physically attached monitor for). To do this follow the steps below:

    1. SSH into the machine where you want to run Sunshine.
    2. vim ~/xorg.conf: Create a new xorg.conf file with the following content:
         Section "ServerLayout"
             Identifier "TwinLayout"
             Screen 0 "metaScreen" 0 0
         EndSection
         
         Section "Monitor"
             Identifier "Monitor0"
             Option "Enable" "true"
         EndSection
         
         Section "Device"
             Identifier "Card0"
             Driver "nvidia"
             VendorName "NVIDIA Corporation"
             Option "MetaModes" "1920x1080"
             Option "ConnectedMonitor" "DP-0"
             Option "ModeValidation" "NoDFPNativeResolutionCheck,NoVirtualSizeCheck,NoMaxPClkCheck,NoHorizSyncCheck,NoVertRefreshCheck,NoWidthAlignmentCheck"
         EndSection
         
         Section "Screen"
             Identifier "metaScreen"
             Device "Card0"
             Monitor "Monitor0"
             DefaultDepth 24
             Option "TwinView" "True"
             SubSection "Display"
                 Modes "1920x1080"
             EndSubSection
         EndSection
      

Execution

NOTE: The steps here need to be performed each time that you want to bring up your Sunshine server. Note that the way the steps are given the entire setup (Xorg server, Sunshine, and desktop session) will be running under the context of your SSH session so once you exit the terminal all these things will exit. You will need to leave your SSH session up while you're using your Sunshine server. An alternative would be to use screen so that these processes stay up after you exit your terminal connection.

  1. SSH into the machine where you want to bring up the Sunshine server.
  2. Decide which virtual TTY (1-5) you want to tie the Xorg session to based on which are unused (we assume we use tty2). Note that TTYs 1-5 should correspond to the virtual teletype consoles that you can drop into if you were to use the key sequence [Ctrl] + [Alt] + [F1] (or [F2], etc).
  3. sudo chmod g+r /dev/tty2: Add read access to the group on its file descriptor.
  4. sudo Xorg -noreset +extension GLX +extension RANDR +extension RENDER vt2 -logfile /home/YOURUSERNAME/X_LOG.txt -config /home/YOURUSERNAME/xorg.conf :9 >> /home/YOURUSERNAME/std_stream.out 2>&1 &: Bring up an Xorg server and run it in the shell background.
  5. export DISPLAY=":9": In your shell, set the DISPLAY variable you specified when bringing up the Xorg server. This number is set in the previous command where [:x] is the number.
  6. sunshine &: Start Sunshine in the background.
  7. exec gnome-session or exec startplasma-x11: Start your desktop environment session.

Hope the above works!!!

References:
https://chadrick-kwag.medium.com/configuring-x-server-on-headless-server-a8b5c3bc7d9
https://unix.stackexchange.com/questions/503078/start-headless-x-server-as-non-root-user
https://www.howtogeek.com/428174/what-is-a-tty-on-linux-and-how-to-use-the-tty-command/
https://unix.stackexchange.com/questions/159124/xf86enableioports-failed-to-set-iopl-for-i-o-operation-not-permitted

@tokon2000
Copy link

@alexanderzjs
Thanks for your post.
I got it working on my local test machine with xserver-xorg-video-dummy and by adding a monitor to xorg_nvidia.conf.
It still does not work on the server, but I think it is a GPU/cuda/driver issue.

@alexanderzjs
Copy link

@alexanderzjs Thanks for your post. I got it working on my local test machine with xserver-xorg-video-dummy and by adding a monitor to xorg_nvidia.conf. It still does not work on the server, but I think it is a GPU/cuda/driver issue.

Great! Adding a virtual monitor is definitely the solution.

@BIGheadLL
Copy link

Hi @Nexarian, thank you for the Nvidia GPU setup. It works for me. However, I get 2 Xorg and gnome-shell processes at the same time when checking nvidia-smi. Is that normal? Is it any possible to optimize this one? Many thanks.
Screenshot 2024-04-25 at 10 24 33 PM

@ger5ones
Copy link

ger5ones commented Jun 7, 2024

Really want to try it on openSUSE Tumbleweed on KDE Plasma Wayland but I'm too dumb and (still) cannot adapt the procedures to my distribution/desktop manager =(

@Nexarian
Copy link
Author

Nexarian commented Jun 7, 2024

Unfortunately XRDP is not compatible with wayland, and likely won't be for some time.

@ger5ones
Copy link

ger5ones commented Jun 7, 2024

Unfortunately XRDP is not compatible with wayland, and likely won't be for some time.

Thanks.
I'll try to change desktop manager but I still don't know if I'll be able to adapt the steps to openSUSE. I'll try to google it.

@jonoharms
Copy link

I have been trying for a while to get this working on a headless machine. I think I am close (I can see the Xorg server and the window manager in nvidia-smi), however get the below errors about process group ID in the sesman.log file.

[INFO ] Starting the xrdp channel server for display :10
[ERROR] Can't set process group ID of 135797 to 135782 [Operation not permitted]
[INFO ] Session in progress on display :10. Waiting until the window manager (pid 135797) exits to end the session
[ERROR] Can't set process group ID of 135798 to 135782 [Operation not permitted]

and then eventually it says there was an error connecting to the session. The windows remote desktop looks like this. Any help would be appreciated, I've spent a few days on this so far. I'm on an ubuntu 22.04 vmware virtual machine server with a nvidia A40 gpu. Unfortunately my work is restrictive in that I can't copy and paste any logs directly.

@alexanderzjs
Copy link

I have been trying for a while to get this working on a headless machine. I think I am close (I can see the Xorg server and the window manager in nvidia-smi), however get the below errors about process group ID in the sesman.log file.

[INFO ] Starting the xrdp channel server for display :10
[ERROR] Can't set process group ID of 135797 to 135782 [Operation not permitted]
[INFO ] Session in progress on display :10. Waiting until the window manager (pid 135797) exits to end the session
[ERROR] Can't set process group ID of 135798 to 135782 [Operation not permitted]

and then eventually it says there was an error connecting to the session. The windows remote desktop looks like this. Any help would be appreciated, I've spent a few days on this so far. I'm on an ubuntu 22.04 vmware virtual machine server with a nvidia A40 gpu. Unfortunately my work is restrictive in that I can't copy and paste any logs directly.

You probably have to tell the steps you are following. Otherwise, it is quite hard to give you a direction. Did you add remote login user to "tty" and "video" groups? Did you try "sudo chmod g+r /dev/tty2" to add read access to the group on its file descriptor?

@jonoharms
Copy link

You probably have to tell the steps you are following. Otherwise, it is quite hard to give you a direction. Did you add remote login user to "tty" and "video" groups? Did you try "sudo chmod g+r /dev/tty2" to add read access to the group on its file descriptor?

Apologies, you are right. I will have to give more details. Yes, I did both of those things. I also added the user to event because I was getting some other errors. I followed pretty much exactly the original gist, as well as the relevant steps from @alexanderzjs's post. I will try to post more detail when I'm back at work on Monday, I don't remember exactly every change I made, but I noted them down.

@jonoharms
Copy link

Got it working! So, firstly, I realised I couldn't see xorgxrdp being initialised in the Xorg logs. So I tried to recompile. Turns out I had some compilations issues that I didn't notice first time around. Fixing those created an xorg_nvidia.conf file that wasn't there last time. I did wonder why I did not have that file, I had created one myself. It turns out the it was missing everything important. So xorgxrdp was not being loaded at all. It also explains why I had to add myself to the input group, the inputs I was using are different to those in the proper conf file.

My hand is firmly planted on my forehead, I had lots of clues along the way that should have triggered something in my brain. In anycase, my steps in case anyone needs them:

  • Recompile fixing issues (had to run libtoolize manually)
  • Changing to the proper conf file
  • Adding a simple monitor section
  • Add the "ConnectedMonitor" "DFP" and "UseDisplayDevice" "DFP" to the Device Section
  • Make sure the relevant tty has g+r permissions.

@alexanderzjs
Copy link

Got it working! So, firstly, I realised I couldn't see xorgxrdp being initialised in the Xorg logs. So I tried to recompile. Turns out I had some compilations issues that I didn't notice first time around. Fixing those created an xorg_nvidia.conf file that wasn't there last time. I did wonder why I did not have that file, I had created one myself. It turns out the it was missing everything important. So xorgxrdp was not being loaded at all. It also explains why I had to add myself to the input group, the inputs I was using are different to those in the proper conf file.

My hand is firmly planted on my forehead, I had lots of clues along the way that should have triggered something in my brain. In anycase, my steps in case anyone needs them:

  • Recompile fixing issues (had to run libtoolize manually)
  • Changing to the proper conf file
  • Adding a simple monitor section
  • Add the "ConnectedMonitor" "DFP" and "UseDisplayDevice" "DFP" to the Device Section
  • Make sure the relevant tty has g+r permissions.

Glad you make it! Good work!

@multisync-del
Copy link

need real help the linux ubuntu install is fucked after that how to undo the thing its stuck on 800x600 and cannot remote control with the windows app

@multisync-del
Copy link

ok reinstalled the video driver its at least a pc now did not fix the remotecontrole

@multisync-del
Copy link

multisync-del commented Aug 19, 2024

sudo vim /etc/X11/Xwrapper.conf does exist aparently so yeah and my desktop envirement is nuke lmao this was fun I tried

@auggie246
Copy link

I have tried many of the approaches here but I am stuck at "X Server could not be started"

@alexanderzjs
Copy link

I have tried many of the approaches here but I am stuck at "X Server could not be started"

"X Server could not be started" usually means nothing with RDP. Login a tty and type in startx or equivalent (e.g. startplasma-x11) and see if you can start the X server locally. If you can start, check xrdp.log and xrdp-sesman.log (under /var/log/). But, most importantly, you have to check Xorg.0.log (or Xorg.1.log or Xorg.n.log) under /var/log or under your home directory. It should show you what's the error.

@auggie246
Copy link

auggie246 commented Aug 27, 2024

I have tried many of the approaches here but I am stuck at "X Server could not be started"

"X Server could not be started" usually means nothing with RDP. Login a tty and type in startx or equivalent (e.g. startplasma-x11) and see if you can start the X server locally. If you can start, check xrdp.log and xrdp-sesman.log (under /var/log/). But, most importantly, you have to check Xorg.0.log (or Xorg.1.log or Xorg.n.log) under /var/log or under your home directory. It should show you what's the error.

i don't quite get "means nothing with RDP". I removed the xRDP and xorgrdp installed from this script and installed directly from sudo apt and it works fine albeit it's a much older version

I will take a look at the logs

EDIT: I managed to login now but now to a black screen, so at least that's progress
I am using L4 GPU on a GCP VM so I had to comment out "UseDisplayDevice" "None" in /etc/X11/xrdp/xorg_nvidia.conf.

@alexanderzjs
Copy link

I have tried many of the approaches here but I am stuck at "X Server could not be started"

"X Server could not be started" usually means nothing with RDP. Login a tty and type in startx or equivalent (e.g. startplasma-x11) and see if you can start the X server locally. If you can start, check xrdp.log and xrdp-sesman.log (under /var/log/). But, most importantly, you have to check Xorg.0.log (or Xorg.1.log or Xorg.n.log) under /var/log or under your home directory. It should show you what's the error.

i don't quite get "means nothing with RDP". I removed the xRDP and xorgrdp installed from this script and installed directly from sudo apt and it works fine albeit it's a much older version

I will take a look at the logs

Something must be wrong with your x server, not xrdp (at least from the message itself, you should be able to start the x server no matter if xrdp works or not, isn't it?). So, I would suggest first look at the Xorg log, then xrdp and xrdp-sesman log. If you see (EE) message from Xorg log, then you can further google the error message.

@auggie246
Copy link

auggie246 commented Aug 27, 2024

I have tried many of the approaches here but I am stuck at "X Server could not be started"

"X Server could not be started" usually means nothing with RDP. Login a tty and type in startx or equivalent (e.g. startplasma-x11) and see if you can start the X server locally. If you can start, check xrdp.log and xrdp-sesman.log (under /var/log/). But, most importantly, you have to check Xorg.0.log (or Xorg.1.log or Xorg.n.log) under /var/log or under your home directory. It should show you what's the error.

i don't quite get "means nothing with RDP". I removed the xRDP and xorgrdp installed from this script and installed directly from sudo apt and it works fine albeit it's a much older version
I will take a look at the logs

Something must be wrong with your x server, not xrdp (at least from the message itself, you should be able to start the x server no matter if xrdp works or not, isn't it?). So, I would suggest first look at the Xorg log, then xrdp and xrdp-sesman log. If you see (EE) message from Xorg log, then you can further google the error message.

I managed to login now but now to a black screen, so at least that's progress
I am using L4 GPU on a GCP VM so I had to comment out "UseDisplayDevice" "None" in /etc/X11/xrdp/xorg_nvidia.conf.

in /var/log/xrdp-sesman.log

[2024-08-27T06:57:45.161+0000] [INFO ] starting xrdp-sesexec with pid 3034
[2024-08-27T06:57:45.600+0000] [INFO ] Terminal Server Users group is disabled, allowing authentication
[2024-08-27T06:57:45.616+0000] [INFO ] Access permitted for user: htech-lead
[2024-08-27T06:57:45.627+0000] [INFO ] Received sys login status for htech-lead : logged in
[2024-08-27T06:57:45.640+0000] [INFO ] Received request from xrdp to create a session for user htech-lead
[2024-08-27T06:57:45.652+0000] [INFO ] ++ reconnected session: username htech-lead, display :10.0, session_pid 1043
[2024-08-27T06:57:45.661+0000] [INFO ] Starting session reconnection script on display 10: /etc/xrdp/reconnectwm.sh
[2024-08-27T06:57:45.664+0000] [INFO ] xrdp-sesexec pid 3034 is now logging out

The same session starts and logs out shortly after?

Looking a little deeper using DISPLAY= sh -x /etc/xrdp/startwm.sh it seems like it stops at running /etc/X11/Xsession which then gives errors in ~/.xsession-errors

dbus-update-activation-environment: setting XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop
dbus-update-activation-environment: setting XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1

@alexanderzjs
Copy link

Good catch, but this is not the root cause, this only gives a warning. Login to your TTY, you can type in startx and see what happens. If the Gnome desktop appears then you are fine. Otherwise, check Xorg.0.log to find out the root cause.

@auggie246
Copy link

auggie246 commented Aug 27, 2024

Good catch, but this is not the root cause, this only gives a warning. Login to your TTY, you can type in startx and see what happens. If the Gnome desktop appears then you are fine. Otherwise, check Xorg.0.log to find out the root cause.

I am using nvidia gpu but it is loading nouveau instead of nvidia.
Specifically a GCP VM with nvidia L4 gpu and 550 drivers installed.

[ 992.562] xorgxrdpSetup:
[ 992.562] (II) LoadModule: "fb"
[ 992.562] (II) Module "fb" already built-in
[ 992.562] (II) LoadModule: "xrdpdev"
[ 992.562] (II) Loading /usr/lib/xorg/modules/drivers/xrdpdev_drv.so
[ 992.562] (EE) Failed to load /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: undefined symbol: g_drm_device
[ 992.562] (EE) Failed to load module "xrdpdev" (loader failed, 0)
[ 992.687] (==) Matched nouveau as autoconfigured driver 0
[ 992.687] (==) Matched modesetting as autoconfigured driver 1
[ 992.687] (==) Matched fbdev as autoconfigured driver 2
[ 992.687] (==) Matched vesa as autoconfigured driver 3
[ 992.687] (==) Assigned the driver to the xf86ConfigLayout
[ 992.687] (II) LoadModule: "nouveau"
[ 992.688] (II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so
[ 992.688] (II) Module nouveau: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.3, module version = 1.0.17
[ 992.688] Module class: X.Org Video Driver
[ 992.688] ABI class: X.Org Video Driver, version 25.2
[ 992.688] (II) LoadModule: "xrdpmouse"
[ 992.688] (II) Loading /usr/lib/xorg/modules/input/xrdpmouse_drv.so
[ 992.688] (II) Module XRDPMOUSE: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.4, module version = 0.10.2
[ 992.688] Module class: X.Org XInput Driver
[ 992.688] ABI class: X.Org XInput driver, version 24.4
[ 992.688] rdpmousePlug:
[ 992.688] (II) LoadModule: "xrdpkeyb"
[ 992.688] (II) Loading /usr/lib/xorg/modules/input/xrdpkeyb_drv.so
[ 992.688] (II) Module XRDPKEYB: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.4, module version = 0.10.2
[ 992.688] Module class: X.Org XInput Driver
[ 992.688] ABI class: X.Org XInput driver, version 24.4
[ 992.688] rdpkeybPlug:
[ 992.688] (II) NOUVEAU driver Date: Sat Jan 23 12:24:42 2021 -0500
[ 992.688] (II) NOUVEAU driver for NVIDIA chipset families :
[ 992.688] RIVA TNT (NV04)
[ 992.688] RIVA TNT2 (NV05)
[ 992.688] GeForce 256 (NV10)
[ 992.688] GeForce 2 (NV11, NV15)
[ 992.688] GeForce 4MX (NV17, NV18)
[ 992.688] GeForce 3 (NV20)
[ 992.688] GeForce 4Ti (NV25, NV28)
[ 992.688] GeForce FX (NV3x)
[ 992.688] GeForce 6 (NV4x)
[ 992.689] GeForce 7 (G7x)
[ 992.689] GeForce 8 (G8x)
[ 992.689] GeForce 9 (G9x)
[ 992.689] GeForce GTX 2xx/3xx (GT2xx)
[ 992.689] GeForce GTX 4xx/5xx (GFxxx)
[ 992.689] GeForce GTX 6xx/7xx (GKxxx)
[ 992.689] GeForce GTX 9xx (GMxxx)
[ 992.689] GeForce GTX 10xx (GPxxx)
[ 992.694] (EE) [drm] Failed to open DRM device for (null): -2
[ 992.694] (EE) No devices detected.
[ 992.694] (EE)
Fatal server error:
[ 992.694] (EE) no screens found(EE)

@alexanderzjs
Copy link

Good catch, but this is not the root cause, this only gives a warning. Login to your TTY, you can type in startx and see what happens. If the Gnome desktop appears then you are fine. Otherwise, check Xorg.0.log to find out the root cause.

I am using nvidia gpu but it is loading nouveau instead of nvidia. Specifically a GCP VM with nvidia L4 gpu and 550 drivers installed.

[ 992.562] xorgxrdpSetup:
[ 992.562] (II) LoadModule: "fb"
[ 992.562] (II) Module "fb" already built-in
[ 992.562] (II) LoadModule: "xrdpdev"
[ 992.562] (II) Loading /usr/lib/xorg/modules/drivers/xrdpdev_drv.so
[ 992.562] (EE) Failed to load /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: undefined symbol: g_drm_device
[ 992.562] (EE) Failed to load module "xrdpdev" (loader failed, 0)
[ 992.687] (==) Matched nouveau as autoconfigured driver 0
[ 992.687] (==) Matched modesetting as autoconfigured driver 1
[ 992.687] (==) Matched fbdev as autoconfigured driver 2
[ 992.687] (==) Matched vesa as autoconfigured driver 3
[ 992.687] (==) Assigned the driver to the xf86ConfigLayout
[ 992.687] (II) LoadModule: "nouveau"
[ 992.688] (II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so
[ 992.688] (II) Module nouveau: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.3, module version = 1.0.17
[ 992.688] Module class: X.Org Video Driver
[ 992.688] ABI class: X.Org Video Driver, version 25.2
[ 992.688] (II) LoadModule: "xrdpmouse"
[ 992.688] (II) Loading /usr/lib/xorg/modules/input/xrdpmouse_drv.so
[ 992.688] (II) Module XRDPMOUSE: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.4, module version = 0.10.2
[ 992.688] Module class: X.Org XInput Driver
[ 992.688] ABI class: X.Org XInput driver, version 24.4
[ 992.688] rdpmousePlug:
[ 992.688] (II) LoadModule: "xrdpkeyb"
[ 992.688] (II) Loading /usr/lib/xorg/modules/input/xrdpkeyb_drv.so
[ 992.688] (II) Module XRDPKEYB: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.4, module version = 0.10.2
[ 992.688] Module class: X.Org XInput Driver
[ 992.688] ABI class: X.Org XInput driver, version 24.4
[ 992.688] rdpkeybPlug:
[ 992.688] (II) NOUVEAU driver Date: Sat Jan 23 12:24:42 2021 -0500
[ 992.688] (II) NOUVEAU driver for NVIDIA chipset families :
[ 992.688] RIVA TNT (NV04)
[ 992.688] RIVA TNT2 (NV05)
[ 992.688] GeForce 256 (NV10)
[ 992.688] GeForce 2 (NV11, NV15)
[ 992.688] GeForce 4MX (NV17, NV18)
[ 992.688] GeForce 3 (NV20)
[ 992.688] GeForce 4Ti (NV25, NV28)
[ 992.688] GeForce FX (NV3x)
[ 992.688] GeForce 6 (NV4x)
[ 992.689] GeForce 7 (G7x)
[ 992.689] GeForce 8 (G8x)
[ 992.689] GeForce 9 (G9x)
[ 992.689] GeForce GTX 2xx/3xx (GT2xx)
[ 992.689] GeForce GTX 4xx/5xx (GFxxx)
[ 992.689] GeForce GTX 6xx/7xx (GKxxx)
[ 992.689] GeForce GTX 9xx (GMxxx)
[ 992.689] GeForce GTX 10xx (GPxxx)
[ 992.694] (EE) [drm] Failed to open DRM device for (null): -2
[ 992.694] (EE) No devices detected.
[ 992.694] (EE)
Fatal server error:
[ 992.694] (EE) no screens found(EE)

I see, did you set "nvidia_drm.modeset=1" in your grub_cmdline_linux_default? It seems that nvidia_drm modeset is not there. Don't forget to use grub-mkconfig to rebuild your grub entry after editing /etc/default/grub by setting the nvidia_drm.modeset.

@auggie246
Copy link

Good catch, but this is not the root cause, this only gives a warning. Login to your TTY, you can type in startx and see what happens. If the Gnome desktop appears then you are fine. Otherwise, check Xorg.0.log to find out the root cause.

I am using nvidia gpu but it is loading nouveau instead of nvidia. Specifically a GCP VM with nvidia L4 gpu and 550 drivers installed.

[ 992.562] xorgxrdpSetup:
[ 992.562] (II) LoadModule: "fb"
[ 992.562] (II) Module "fb" already built-in
[ 992.562] (II) LoadModule: "xrdpdev"
[ 992.562] (II) Loading /usr/lib/xorg/modules/drivers/xrdpdev_drv.so
[ 992.562] (EE) Failed to load /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: undefined symbol: g_drm_device
[ 992.562] (EE) Failed to load module "xrdpdev" (loader failed, 0)
[ 992.687] (==) Matched nouveau as autoconfigured driver 0
[ 992.687] (==) Matched modesetting as autoconfigured driver 1
[ 992.687] (==) Matched fbdev as autoconfigured driver 2
[ 992.687] (==) Matched vesa as autoconfigured driver 3
[ 992.687] (==) Assigned the driver to the xf86ConfigLayout
[ 992.687] (II) LoadModule: "nouveau"
[ 992.688] (II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so
[ 992.688] (II) Module nouveau: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.3, module version = 1.0.17
[ 992.688] Module class: X.Org Video Driver
[ 992.688] ABI class: X.Org Video Driver, version 25.2
[ 992.688] (II) LoadModule: "xrdpmouse"
[ 992.688] (II) Loading /usr/lib/xorg/modules/input/xrdpmouse_drv.so
[ 992.688] (II) Module XRDPMOUSE: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.4, module version = 0.10.2
[ 992.688] Module class: X.Org XInput Driver
[ 992.688] ABI class: X.Org XInput driver, version 24.4
[ 992.688] rdpmousePlug:
[ 992.688] (II) LoadModule: "xrdpkeyb"
[ 992.688] (II) Loading /usr/lib/xorg/modules/input/xrdpkeyb_drv.so
[ 992.688] (II) Module XRDPKEYB: vendor="X.Org Foundation"
[ 992.688] compiled for 1.21.1.4, module version = 0.10.2
[ 992.688] Module class: X.Org XInput Driver
[ 992.688] ABI class: X.Org XInput driver, version 24.4
[ 992.688] rdpkeybPlug:
[ 992.688] (II) NOUVEAU driver Date: Sat Jan 23 12:24:42 2021 -0500
[ 992.688] (II) NOUVEAU driver for NVIDIA chipset families :
[ 992.688] RIVA TNT (NV04)
[ 992.688] RIVA TNT2 (NV05)
[ 992.688] GeForce 256 (NV10)
[ 992.688] GeForce 2 (NV11, NV15)
[ 992.688] GeForce 4MX (NV17, NV18)
[ 992.688] GeForce 3 (NV20)
[ 992.688] GeForce 4Ti (NV25, NV28)
[ 992.688] GeForce FX (NV3x)
[ 992.688] GeForce 6 (NV4x)
[ 992.689] GeForce 7 (G7x)
[ 992.689] GeForce 8 (G8x)
[ 992.689] GeForce 9 (G9x)
[ 992.689] GeForce GTX 2xx/3xx (GT2xx)
[ 992.689] GeForce GTX 4xx/5xx (GFxxx)
[ 992.689] GeForce GTX 6xx/7xx (GKxxx)
[ 992.689] GeForce GTX 9xx (GMxxx)
[ 992.689] GeForce GTX 10xx (GPxxx)
[ 992.694] (EE) [drm] Failed to open DRM device for (null): -2
[ 992.694] (EE) No devices detected.
[ 992.694] (EE)
Fatal server error:
[ 992.694] (EE) no screens found(EE)

I see, did you set "nvidia_drm.modeset=1" in your grub_cmdline_linux_default? It seems that nvidia_drm modeset is not there. Don't forget to use grub-mkconfig to rebuild your grub entry after editing /etc/default/grub by setting the nvidia_drm.modeset.

Unfortunately, have done so, cat /sys/module/nvidia_drm/parameters/modeset returns Y. I am at my wits end.

@alexleach
Copy link

[ 992.562] (II) Loading /usr/lib/xorg/modules/drivers/xrdpdev_drv.so
[ 992.562] (EE) Failed to load /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: /usr/lib/xorg/modules/drivers/xrdpdev_drv.so: undefined symbol: g_drm_device
[ 992.562] (EE) Failed to load module "xrdpdev" (loader failed, 0)

I would hazard a guess that you configured and built this library twice, but without a make clean in between make runs? I think the built library has been confused between a configure run with the --enable-glamor flag, and once without.

  • g_drm_device is defined in xrdpdev/xrdpdev.c. It is only defined if XORGXRDP_GLAMOR is defined as a CFLAG.
  • g_drm_device is referenced as an extern variable in xrdpdev/xrdpdri3.c - this is where the undefined symbol comes from - but that file is only compiled if WITH_GLAMOR in xrdpdev/Makefile.am

I would suggest in this instance that you should make clean your build directory of xorgxrdp before re-configuring and re-compiling. I've found that if there are built object files, they aren't re-compiled after a new configure run. Ideally, all objects should be recompiled if the configure flags change, but I think there's something missing from the Makefile.am files. I can't say I know exactly what, though.

@Rougnt
Copy link

Rougnt commented Oct 12, 2024

Hi, @Nexarian :
Thank you for providing this script! It has been a great help, and I was able to successfully start xrdp with the NVIDIA GPU.

However, I'm encountering an issue where, after connecting from the client, the mouse can only click within certain areas of the screen, while other areas remain unclickable.
I would really appreciate any guidance or suggestions to resolve this issue!

Thank you again for your help!

Best regards,
Rogunt

I've attached my xorgxrdp.log and xorg_nvidia.conf files below for your reference:

.xorgxrdp.log file in ~/.xorgxrdp.13.log
[  4337.947]
X.Org X Server 1.21.1.11
X Protocol Version 11, Revision 0
[  4337.948] Current Operating System: Linux lxy-ubuntu 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
[  4337.948] Kernel command line: BOOT_IMAGE=/BOOT/ubuntu_0rz91o@/vmlinuz-6.8.0-45-generic root=ZFS=rpool/ROOT/ubuntu_0rz91o ro quiet console=tty0 console=ttyS0,115200 quiet splash vt.handoff=1
[  4337.948] xorg-server 2:21.1.12-1ubuntu1 (For technical support please see http://www.ubuntu.com/support)
[  4337.948] Current version of pixman: 0.42.2
[  4337.948]    Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[  4337.948] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[  4337.948] (++) Log file: ".xorgxrdp.13.log", Time: Sat Oct 12 14:36:08 2024
[  4337.949] (++) Using config file: "/etc/X11/xrdp/xorg_nvidia.conf"
[  4337.949] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[  4337.949] (**) Option "defaultserverlayout" "XRDP GPU Server"
[  4337.949] (**) ServerLayout "XRDP GPU Server"
[  4337.949] (**) |-->Screen "dGPU" (0)
[  4337.950] (**) |   |-->Monitor "<default monitor>"
[  4337.950] (**) |   |-->Device "dGPU"
[  4337.950] (==) No monitor specified for screen "dGPU".
        Using a default monitor configuration.
[  4337.950] (**) |-->Input Device "xrdpMouse"
[  4337.950] (**) |-->Input Device "xrdpKeyboard"
[  4337.950] (**) Option "DontVTSwitch" "on"
[  4337.950] (**) Option "AutoAddDevices" "off"
[  4337.950] (**) Allowing byte-swapped clients
[  4337.950] (**) Not automatically adding devices
[  4337.950] (==) Automatically enabling devices
[  4337.950] (==) Automatically adding GPU devices
[  4337.951] (==) Automatically binding GPU devices
[  4337.951] (==) Max clients allowed: 256, resource mask: 0x1fffff
[  4337.951] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[  4337.951]    Entry deleted from font path.
[  4337.951] (==) FontPath set to:
        /usr/share/fonts/X11/misc,
        /usr/share/fonts/X11/100dpi/:unscaled,
        /usr/share/fonts/X11/75dpi/:unscaled,
        /usr/share/fonts/X11/Type1,
        /usr/share/fonts/X11/100dpi,
        /usr/share/fonts/X11/75dpi,
        built-ins
[  4337.951] (==) ModulePath set to "/usr/lib/xorg/modules"
[  4337.951] (II) Loader magic: 0x5a129e3ff020
[  4337.951] (II) Module ABI versions:
[  4337.951]    X.Org ANSI C Emulation: 0.4
[  4337.951]    X.Org Video Driver: 25.2
[  4337.951]    X.Org XInput driver : 24.4
[  4337.951]    X.Org Server Extension : 10.0
[  4337.952] (--) using VT number 2

[  4337.952] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[  4337.953] (II) xfree86: Adding drm device (/dev/dri/card0)
[  4337.953] (II) Platform probe for /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/drm/card0
[  4337.959] (--) PCI:*(1@0:0:0) 10de:1bb3:10de:1206 rev 161, Mem @ 0x82000000/16777216, 0xc000000000/268435456, 0x80000000/33554432
[  4337.959] (II) "glx" will be loaded by default.
[  4337.959] (II) LoadModule: "xorgxrdp"
[  4337.960] (II) Loading /usr/lib/xorg/modules/libxorgxrdp.so
[  4337.960] (II) Module XORGXRDP: vendor="X.Org Foundation"
[  4337.960]    compiled for 1.21.1.11, module version = 0.9.80
[  4337.960]    ABI class: X.Org Video Driver, version 25.2
[  4337.960] xorgxrdpSetup:
[  4337.960] (II) LoadModule: "glx"
[  4337.960] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[  4337.962] (II) Module glx: vendor="X.Org Foundation"
[  4337.962]    compiled for 1.21.1.11, module version = 1.0.0
[  4337.962]    ABI class: X.Org Server Extension, version 10.0
[  4337.962] (II) LoadModule: "nvidia"
[  4337.962] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[  4337.963] (II) Module nvidia: vendor="NVIDIA Corporation"
[  4337.963]    compiled for 1.6.99.901, module version = 1.0.0
[  4337.963]    Module class: X.Org Video Driver
[  4337.963] (II) LoadModule: "xrdpmouse"
[  4337.963] (II) Loading /usr/lib/xorg/modules/input/xrdpmouse_drv.so
[  4337.963] (II) Module XRDPMOUSE: vendor="X.Org Foundation"
[  4337.963]    compiled for 1.21.1.11, module version = 0.9.80
[  4337.964]    Module class: X.Org XInput Driver
[  4337.964]    ABI class: X.Org XInput driver, version 24.4
[  4337.964] rdpmousePlug:
[  4337.964] (II) LoadModule: "xrdpkeyb"
[  4337.964] (II) Loading /usr/lib/xorg/modules/input/xrdpkeyb_drv.so
[  4337.964] (II) Module XRDPKEYB: vendor="X.Org Foundation"
[  4337.964]    compiled for 1.21.1.11, module version = 0.9.80
[  4337.964]    Module class: X.Org XInput Driver
[  4337.965]    ABI class: X.Org XInput driver, version 24.4
[  4337.965] rdpkeybPlug:
[  4337.965] xorgxrdpCheckWrap: NVIDIA driver found
[  4337.965] (II) NVIDIA dlloader X Driver  535.161.08  Tue Mar  5 22:18:44 UTC 2024
[  4337.965] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[  4337.965] xorgxrdpDriverFunc:
[  4337.965] xorgxrdpPlatformProbe:
[  4337.965] (II) Loading sub module "fb"
[  4337.965] (II) LoadModule: "fb"
[  4337.965] (II) Module "fb" already built-in
[  4337.966] (II) Loading sub module "wfb"
[  4337.966] (II) LoadModule: "wfb"
[  4337.966] (II) Loading /usr/lib/xorg/modules/libwfb.so
[  4337.966] (II) Module wfb: vendor="X.Org Foundation"
[  4337.966]    compiled for 1.21.1.11, module version = 1.0.0
[  4337.966]    ABI class: X.Org ANSI C Emulation, version 0.4
[  4337.967] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[  4337.967] xorgxrdpPreInit:
[  4337.967] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[  4337.967] (==) NVIDIA(0): RGB weight 888
[  4337.967] (==) NVIDIA(0): Default visual is TrueColor
[  4337.967] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[  4337.967] (**) NVIDIA(0): Option "DPI" "96 x 96"
[  4337.967] (**) NVIDIA(0): Option "ConnectToAcpid" "false"
[  4337.967] (**) NVIDIA(0): Enabling 2D acceleration
[  4337.968] (II) Loading sub module "glxserver_nvidia"
[  4337.968] (II) LoadModule: "glxserver_nvidia"
[  4337.968] (II) Loading /usr/lib/xorg/modules/extensions/libglxserver_nvidia.so
[  4337.981] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[  4337.981]    compiled for 1.6.99.901, module version = 1.0.0
[  4337.981]    Module class: X.Org Server Extension
[  4337.981] (II) NVIDIA GLX Module  535.161.08  Tue Mar  5 22:19:53 UTC 2024
[  4337.981] (II) NVIDIA: The X server supports PRIME Render Offload.
[  4337.984] (--) NVIDIA(0): Valid display device(s) on GPU-0 at PCI:1:0:0
[  4337.984] (--) NVIDIA(0):     DFP-0
[  4337.984] (--) NVIDIA(0):     DFP-1
[  4337.984] (--) NVIDIA(0):     DFP-2
[  4337.984] (--) NVIDIA(0):     DFP-3
[  4337.985] (II) NVIDIA(0): NVIDIA GPU GRID P4-4Q (GP104GL-A) at PCI:1:0:0 (GPU-0)
[  4337.985] (--) NVIDIA(0): Memory: 4194304 kBytes
[  4337.986] (--) NVIDIA(0): VideoBIOS: 00.00.00.00.00
[  4337.986] (--) NVIDIA(GPU-0): NVIDIA VGX (DFP-0): connected
[  4337.986] (--) NVIDIA(GPU-0): NVIDIA VGX (DFP-0): External TMDS
[  4337.986] (WW) NVIDIA(GPU-0): Mode (15360 x 8640) larger than per-head max resolution
[  4337.986] (WW) NVIDIA(GPU-0):     supported (7680 x 4320)
[  4337.986] (WW) NVIDIA(GPU-0): Mode (15360 x 8640) larger than per-head max resolution
[  4337.986] (WW) NVIDIA(GPU-0):     supported (7680 x 4320)
[  4337.987] (==) NVIDIA(0):
[  4337.987] (==) NVIDIA(0): No modes were requested; the default mode "nvidia-auto-select"
[  4337.987] (==) NVIDIA(0):     will be used as the requested mode.
[  4337.987] (==) NVIDIA(0):
[  4337.987] (II) NVIDIA(0): Validated MetaModes:
[  4337.987] (II) NVIDIA(0):     "DFP-0:nvidia-auto-select"
[  4337.987] (**) NVIDIA(0): Virtual screen size configured to be 1920 x 1080
[  4337.989] (**) NVIDIA(0): DPI set to (96, 96); computed from "DPI" X config option
[  4337.989] xorgxrdpScreenInit:
[  4337.989] (WW) NVIDIA: Failed to bind sideband socket to
[  4337.989] (WW) NVIDIA:     '/var/run/nvidia-xdriver-bb8f38fb' Permission denied
[  4337.989] (II) NVIDIA: Reserving 24576.00 MB of virtual memory for indirect memory
[  4337.989] (II) NVIDIA:     access.
[  4338.025] (II) NVIDIA(0): Setting mode "DFP-0:nvidia-auto-select"
[  4338.039] (==) NVIDIA(0): Disabling shared memory pixmaps
[  4338.039] (==) NVIDIA(0): Backing store enabled
[  4338.039] (==) NVIDIA(0): Silken mouse enabled
[  4338.040] (==) NVIDIA(0): DPMS enabled
[  4338.040] (II) Loading sub module "dri2"
[  4338.040] (II) LoadModule: "dri2"
[  4338.040] (II) Module "dri2" already built-in
[  4338.040] (II) NVIDIA(0): [DRI2] Setup complete
[  4338.040] (II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
[  4338.040] xorgxrdpScreenInit: width 1920 height 1080
[  4338.040] rdpClientConInit: disconnect idle session after [0] sec
[  4338.041] rdpClientConInit: kill disconnected [0] timeout [0] sec
[  4338.041] rdpSimdInit: assigning yuv functions
[  4338.041] rdpSimdInit: cpuid ax 1 cx 0 return ax 0x00800f12 bx 0x01100800 cx 0xfef83203 dx 0x178bfbff
[  4338.041] rdpSimdInit: sse2 amd64 yuv functions assigned
[  4338.041] (II) Initializing extension Generic Event Extension
[  4338.041] (II) Initializing extension SHAPE
[  4338.041] (II) Initializing extension MIT-SHM
[  4338.041] (II) Initializing extension XInputExtension
[  4338.042] (II) Initializing extension XTEST
[  4338.042] (II) Initializing extension BIG-REQUESTS
[  4338.042] (II) Initializing extension SYNC
[  4338.042] (II) Initializing extension XKEYBOARD
[  4338.042] (II) Initializing extension XC-MISC
[  4338.042] (II) Initializing extension SECURITY
[  4338.043] (II) Initializing extension XFIXES
[  4338.043] (II) Initializing extension RENDER
[  4338.043] (II) Initializing extension COMPOSITE
[  4338.043] (II) Initializing extension DAMAGE
[  4338.043] (II) Initializing extension MIT-SCREEN-SAVER
[  4338.043] (II) Initializing extension DOUBLE-BUFFER
[  4338.044] (II) Initializing extension RECORD
[  4338.044] (II) Initializing extension DPMS
[  4338.044] (II) Initializing extension Present
[  4338.044] (II) Initializing extension DRI3
[  4338.044] (II) Initializing extension X-Resource
[  4338.045] (II) Initializing extension XVideo
[  4338.045] (II) Initializing extension XVideo-MotionCompensation
[  4338.045] (II) Initializing extension SELinux
[  4338.045] (II) SELinux: Disabled on system
[  4338.045] (II) Initializing extension GLX
[  4338.045] (II) Initializing extension GLX
[  4338.045] (II) Indirect GLX disabled.
[  4338.045] (II) GLX: Another vendor is already registered for screen 0
[  4338.045] (II) Initializing extension XFree86-VidModeExtension
[  4338.045] (II) Initializing extension XFree86-DGA
[  4338.046] (II) Initializing extension XFree86-DRI
[  4338.046] (II) Initializing extension DRI2
[  4338.046] (II) Initializing extension NV-GLX
[  4338.046] (II) Initializing extension NV-CONTROL
[  4338.046] (II) Initializing extension XINERAMA
[  4338.046] rdpCreateScreenResources:
[  4338.107] (II) Using input driver 'XRDPMOUSE' for 'xrdpMouse'
[  4338.107] (**) Option "CorePointer"
[  4338.107] (**) xrdpMouse: always reports core events
[  4338.107] rdpmousePreInit: drv 0x5a129fbcf7e0 info 0x5a12a030dd70, flags 0x0
[  4338.107] (II) XINPUT: Adding extended input device "xrdpMouse" (type: Mouse, id 6)
[  4338.108] rdpmouseControl: what 0
[  4338.108] rdpmouseDeviceInit:
[  4338.108] rdpmouseCtrl:
[  4338.108] rdpRegisterInputCallback: type 1 proc 0x7a79fd47e610
[  4338.108] (**) xrdpMouse: (accel) keeping acceleration scheme 1
[  4338.108] (**) xrdpMouse: (accel) acceleration profile 0
[  4338.108] (**) xrdpMouse: (accel) acceleration factor: 2.000
[  4338.108] (**) xrdpMouse: (accel) acceleration threshold: 4
[  4338.108] rdpmouseControl: what 1
[  4338.108] rdpmouseDeviceOn:
[  4338.108] (II) Using input driver 'XRDPKEYB' for 'xrdpKeyboard'
[  4338.108] (**) Option "CoreKeyboard"
[  4338.108] (**) xrdpKeyboard: always reports core events
[  4338.109] rdpkeybPreInit: drv 0x5a129fbceef0 info 0x5a12a0311920, flags 0x0
[  4338.109] (II) XINPUT: Adding extended input device "xrdpKeyboard" (type: Keyboard, id 7)
[  4338.109] rdpkeybControl: what 0
[  4338.109] rdpkeybDeviceInit:
[  4338.129] rdpkeybChangeKeyboardControl:
[  4338.129] rdpkeybChangeKeyboardControl: autoRepeat on
[  4338.130] rdpRegisterInputCallback: type 0 proc 0x7a79fd478b40
[  4338.130] rdpkeybControl: what 1
[  4338.130] rdpkeybDeviceOn:
[  4338.130] rdpkeybChangeKeyboardControl:
[  4338.130] rdpkeybChangeKeyboardControl: autoRepeat on
[  4338.155] (II) config/udev: Adding input device Power Button (/dev/input/event0)
[  4338.155] (II) AutoAddDevices is off - not adding device.
[  4338.157] (II) config/udev: Adding input device QEMU QEMU USB Tablet (/dev/input/event2)
[  4338.157] (II) AutoAddDevices is off - not adding device.
[  4338.157] (II) config/udev: Adding input device QEMU QEMU USB Tablet (/dev/input/mouse0)
[  4338.158] (II) AutoAddDevices is off - not adding device.
[  4338.158] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event1)
[  4338.158] (II) AutoAddDevices is off - not adding device.
[  4338.159] (II) config/udev: Adding input device ImExPS/2 Generic Explorer Mouse (/dev/input/event3)
[  4338.159] (II) AutoAddDevices is off - not adding device.
[  4338.159] (II) config/udev: Adding input device ImExPS/2 Generic Explorer Mouse (/dev/input/mouse1)
[  4338.159] (II) AutoAddDevices is off - not adding device.
[  4338.168] xorgxrdpDeferredStartup:
[  4338.168] rdpLRRInit: AddCallback ok
[  4338.168] rdpLRRInit: AddExtension ok
[  4338.168] xorgxrdpSetupDamage: DamageRegister ok
[  4338.231] rdpInDeferredRepeatCallback:
[  4338.231] rdpkeybChangeKeyboardControl:
[  4338.231] rdpkeybChangeKeyboardControl: autoRepeat off
[  4338.231] rdpInDeferredRepeatCallback:
[  4338.231] rdpkeybChangeKeyboardControl:
[  4338.231] rdpkeybChangeKeyboardControl: autoRepeat off
[  4338.947] rdpClientConGotConnection:
[  4338.948] rdpClientConGotConnection: g_sck_accept ok new_sck 9
[  4338.948] rdpClientConGetConnection: idle_disconnect_timeout set to non-positive value, idle timer turned off
[  4338.948] rdpAddClientConToDev: adding first clientCon 0x5a12a03692b0
[  4338.948] rdpClientConProcessMsgVersion: version 0 0 0 1
[  4338.949] rdpClientConProcessScreenSizeMsg: set width 1920 height 1080 bpp 32
[  4338.949] rdpClientConAllocateSharedMemory: shmemid 47 shmemptr 0x7a73f2c17000 bytes 8294400
[  4338.949] rdpClientConProcessMsgClientInput: invalidate x 0 y 0 cx 1920 cy 1080
[  4338.949] KbdSync: toggling num lock
[  4338.949] rdpkeybChangeKeyboardControl:
[  4338.949] rdpkeybChangeKeyboardControl: autoRepeat off
[  4338.950] rdpClientConProcessMsgClientInfo:
[  4338.950]   got client info bytes 7192
[  4338.950]   jpeg support 0
[  4338.950]   offscreen support 1
[  4338.950]   offscreen size 10485760
[  4338.950]   offscreen entries 100
[  4338.950] rdpClientConProcessMsgClientInfo: got H264 capture
[  4338.950]   cap_width 1920 cap_height 1088
[  4338.951] rdpClientConAllocateSharedMemory: shmemid 48 shmemptr 0x7a73f3004000 bytes 4177920
[  4338.951]   client can not do offscreen to offscreen blits
[  4338.951]   client can do new(color) cursor
[  4338.951]   client can not do multimon
[  4338.951] rdpLoadLayout: keylayout 0x00000804 variant  display 13
[  4338.951] rdpkeybChangeKeyboardControl:
[  4338.951] rdpkeybChangeKeyboardControl: autoRepeat on
[  4338.952] rdpkeybChangeKeyboardControl:
[  4338.952] rdpkeybChangeKeyboardControl: autoRepeat on
[  4338.958] rdpClientConProcessMsgClientInfo: started helper pid 134627
[  4339.051] rdpInDeferredRepeatCallback:
[  4339.051] rdpkeybChangeKeyboardControl:
[  4339.051] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.053] rdpInDeferredRepeatCallback:
[  4339.053] rdpkeybChangeKeyboardControl:
[  4339.053] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.222] ProcLRRSelectInput:                 client 0x5a12a0342140 adding pClient to list
[  4339.351] rdpPutImage: setting conNumber 1, monitor num 0 to pixmap 0x5a12a035a980
[  4339.361] rdpClientConProcessMsgClientInput: invalidate x 0 y 0 cx 1920 cy 1088
[  4339.432] remove_client:                      client 0x5a12a0342140 found pClient, removing
[  4339.610] ProcLRRSelectInput:                 client 0x5a12a0342140 adding pClient to list
[  4339.611] remove_client:                      client 0x5a12a0342140 found pClient, removing
[  4339.611] ProcLRRSelectInput:                 client 0x5a12a0342140 adding pClient to list
[  4339.723] rdpkeybChangeKeyboardControl:
[  4339.723] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.723] rdpkeybChangeKeyboardControl:
[  4339.723] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.724] rdpkeybChangeKeyboardControl:
[  4339.724] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.724] rdpkeybChangeKeyboardControl:
[  4339.724] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.730] ProcLRRDispatch: returning Success, data 26
[  4339.730] ProcLRRDispatch: returning Success, data 30
[  4339.730] ProcLRRDispatch: returning Success, data 13
[  4339.742] rdpkeybChangeKeyboardControl:
[  4339.743] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.743] rdpkeybChangeKeyboardControl:
[  4339.743] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.743] rdpkeybChangeKeyboardControl:
[  4339.743] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.744] rdpkeybChangeKeyboardControl:
[  4339.744] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.771] rdpkeybChangeKeyboardControl:
[  4339.771] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.771] rdpkeybChangeKeyboardControl:
[  4339.771] rdpkeybChangeKeyboardControl: autoRepeat on
[  4339.803] ProcLRRSelectInput:                 client 0x5a12a04f0950 adding pClient to list
[  4339.823] rdpInDeferredRepeatCallback:
[  4339.823] rdpkeybChangeKeyboardControl:
[  4339.823] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.824] rdpInDeferredRepeatCallback:
[  4339.824] rdpkeybChangeKeyboardControl:
[  4339.824] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.824] rdpInDeferredRepeatCallback:
[  4339.824] rdpkeybChangeKeyboardControl:
[  4339.824] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.824] rdpInDeferredRepeatCallback:
[  4339.824] rdpkeybChangeKeyboardControl:
[  4339.824] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.843] rdpInDeferredRepeatCallback:
[  4339.843] rdpkeybChangeKeyboardControl:
[  4339.843] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.843] rdpInDeferredRepeatCallback:
[  4339.843] rdpkeybChangeKeyboardControl:
[  4339.843] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.844] rdpInDeferredRepeatCallback:
[  4339.845] rdpkeybChangeKeyboardControl:
[  4339.845] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.845] rdpInDeferredRepeatCallback:
[  4339.845] rdpkeybChangeKeyboardControl:
[  4339.845] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.871] rdpInDeferredRepeatCallback:
[  4339.871] rdpkeybChangeKeyboardControl:
[  4339.871] rdpkeybChangeKeyboardControl: autoRepeat off
[  4339.871] rdpInDeferredRepeatCallback:
[  4339.871] rdpkeybChangeKeyboardControl:
[  4339.871] rdpkeybChangeKeyboardControl: autoRepeat off
[  4340.335] ProcLRRSelectInput:                 client 0x5a12a04c8900 adding pClient to list
[  4340.410] ProcLRRSelectInput:                 client 0x5a12a04c8cc0 adding pClient to list
[  4340.423] ProcLRRSelectInput:                 client 0x5a12a052f520 adding pClient to list
[  4340.426] ProcLRRSelectInput:                 client 0x5a12a05338c0 adding pClient to list
[  4340.438] ProcLRRSelectInput:                 client 0x5a12a0540340 adding pClient to list
[  4340.439] ProcLRRSelectInput:                 client 0x5a12a053c050 adding pClient to list
[  4340.458] ProcLRRSelectInput:                 client 0x5a12a0555560 adding pClient to list
[  4340.459] ProcLRRSelectInput:                 client 0x5a12a0555820 adding pClient to list
[  4340.474] ProcLRRSelectInput:                 client 0x5a12a0575c70 adding pClient to list
[  4340.512] rdpkeybChangeKeyboardControl:
[  4340.512] rdpkeybChangeKeyboardControl: autoRepeat off
[  4340.512] rdpkeybChangeKeyboardControl:
[  4340.512] rdpkeybChangeKeyboardControl: autoRepeat off
[  4340.612] ProcLRRSelectInput:                 client 0x5a12a057a420 adding pClient to list
[  4341.517] ProcLRRSelectInput:                 client 0x5a12a05ecf00 adding pClient to list
[  4341.660] ProcLRRSelectInput:                 client 0x5a12a042fd80 adding pClient to list
[  4341.967] ProcLRRSelectInput:                 client 0x5a12a078a550 adding pClient to list
[  4342.308] ProcLRRSelectInput:                 client 0x5a12a0792b10 adding pClient to list
[  4342.805] remove_client:                      client 0x5a12a04c8900 found pClient, removing
[  4376.679] remove_client:                      client 0x5a12a05ecf00 found pClient, removing
[  4400.841] ProcLRRSelectInput:                 client 0x5a12a04c8a40 adding pClient to list
[  4400.843] ProcLRRSelectInput:                 client 0x5a12a04c8900 adding pClient to list
[  4400.888] remove_client:                      client 0x5a12a04c8900 found pClient, removing
[  4400.889] remove_client:                      client 0x5a12a04c8a40 found pClient, removing
xorg_nvidia.conf file in /etc/X11/xrdp/xorg_nvidia.conf
Section "ServerLayout"
  Identifier "XRDP GPU Server"
  Screen 0 "dGPU"
  InputDevice "xrdpMouse" "CorePointer"
  InputDevice "xrdpKeyboard" "CoreKeyboard"
EndSection

Section "ServerFlags"
  # This line prevents "ServerLayout" sections in xorg.conf.d files
  # overriding the "XRDP GPU Server" layout (xrdp #1784)
  Option "DefaultServerLayout" "XRDP GPU Server"
  Option "DontVTSwitch" "on"
  Option "AutoAddDevices" "off"
EndSection

Section "Module"
  Load "xorgxrdp"
EndSection

Section "InputDevice"
  Identifier "xrdpKeyboard"
  Driver "xrdpkeyb"
EndSection

Section "InputDevice"
  Identifier "xrdpMouse"
  Driver "xrdpmouse"
EndSection

Section "Screen"
  Identifier "dGPU"
  Device "dGPU"
  Option "DPI" "96 x 96"
# T4 needs an entry here, this is not the desktop size
  SubSection "Display"
    Virtual 1920 1080
  EndSubSection
EndSection

Section "Device"
  Identifier "dGPU"
  Driver "nvidia"
# T4 may need to comment out next line
#  Option "UseDisplayDevice" "none"
  Option "ConnectToAcpid" "false"
  BusID "PCI:1:0:0"
EndSection
Image: Only this area can be clicked

image

@auggie246
Copy link

Hi, @Nexarian : Thank you for providing this script! It has been a great help, and I was able to successfully start xrdp with the NVIDIA GPU.

However, I'm encountering an issue where, after connecting from the client, the mouse can only click within certain areas of the screen, while other areas remain unclickable. I would really appreciate any guidance or suggestions to resolve this issue!

Thank you again for your help!

Best regards, Rogunt

I've attached my xorgxrdp.log and xorg_nvidia.conf files below for your reference:
.xorgxrdp.log file in ~/.xorgxrdp.13.log

xorg_nvidia.conf file in /etc/X11/xrdp/xorg_nvidia.conf

Image: Only this area can be clicked

I faced this issue when using L4 GPU on a GCP VM.

I had to comment out this section in "Screen"

  SubSection "Display"
    Virtual 1920 1080
  EndSubSection

@Rougnt
Copy link

Rougnt commented Oct 12, 2024

Hi, @Nexarian : Thank you for providing this script! It has been a great help, and I was able to successfully start xrdp with the NVIDIA GPU.
However, I'm encountering an issue where, after connecting from the client, the mouse can only click within certain areas of the screen, while other areas remain unclickable. I would really appreciate any guidance or suggestions to resolve this issue!
Thank you again for your help!
Best regards, Rogunt
I've attached my xorgxrdp.log and xorg_nvidia.conf files below for your reference:
.xorgxrdp.log file in ~/.xorgxrdp.13.log
xorg_nvidia.conf file in /etc/X11/xrdp/xorg_nvidia.conf
Image: Only this area can be clicked

I faced this issue when using L4 GPU on a GCP VM.

I had to comment out this section in "Screen"

  SubSection "Display"
    Virtual 1920 1080
  EndSubSection

Hello @auggie246,

Thank you so much for your quick response! My GPU is P4, I followed your solution, and I'm happy to report that it successfully resolved my issue. I really appreciate your help!

Best regards,
Rogunt

@ghoulich
Copy link

ghoulich commented Nov 6, 2024

I followed your instructions to compile and install xrdp step by step, but when I connected to my workstation by remmina, this window pop-up:
Screenshot_select-area_20241106090843
then I checked rdp-sesman.log:
Screenshot_select-area_20241106090950
I have no idea about this error:
pre_session_list_check_wait_objs: trans_check_wait_objs(2) failed, removing trans

@rmGFW
Copy link

rmGFW commented Dec 18, 2024

Why is it necessary to install CUDA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment