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

Dynamic and Fixed Resolution Issues in KDE Plasma with XRDP #3395

Open
unmanarc opened this issue Jan 13, 2025 · 8 comments
Open

Dynamic and Fixed Resolution Issues in KDE Plasma with XRDP #3395

unmanarc opened this issue Jan 13, 2025 · 8 comments
Labels

Comments

@unmanarc
Copy link

unmanarc commented Jan 13, 2025

xrdp version

0.10.1-1

Detailed xrdp version, build options

xrdp 0.10.1
  A Remote Desktop Protocol Server.
  Copyright (C) 2004-2024 Jay Sorg, Neutrino Labs, and all contributors.
  See https://github.com/neutrinolabs/xrdp for more information.

  Configure options:
      --build=x86_64-redhat-linux-gnu
      --host=x86_64-redhat-linux-gnu
      --program-prefix=
      --disable-dependency-tracking
      --prefix=/usr
      --exec-prefix=/usr
      --bindir=/usr/bin
      --sbindir=/usr/sbin
      --sysconfdir=/etc
      --datadir=/usr/share
      --includedir=/usr/include
      --libdir=/usr/lib64
      --libexecdir=/usr/libexec
      --localstatedir=/var
      --runstatedir=/run
      --sharedstatedir=/var/lib
      --mandir=/usr/share/man
      --infodir=/usr/share/info
      --enable-fuse
      --enable-pixman
      --enable-painter
      --enable-vsock
      --enable-ipv6
      --with-socketdir=/run/xrdp
      --with-imlib2
      build_alias=x86_64-redhat-linux-gnu
      host_alias=x86_64-redhat-linux-gnu
      CC=gcc
      CFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 
      LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes 
      CXX=g++
      CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 
      LT_SYS_LIBRARY_PATH=/usr/lib64:
      PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig

  Compiled with OpenSSL 3.2.2 4 Jun 2024

Operating system & version

Fedora Linux 41 (KDE Plasma)

Installation method

dnf / apt / zypper / pkg / etc

Which backend do you use?

tigervnc-server-1.14.1-3.fc41.x86_64

What desktop environment do you use?

KDE Plasma 6

Environment xrdp running on

Testing VM

What's your client?

remmina

Area(s) with issue?

Graphic glitches

Steps to reproduce

Install xrdp on fedora 41 KDE:

sudo dnf install -y tigervnc-server xrdp
sudo systemctl enable --now xrdp
ln -s /usr/bin/startplasma-wayland .xsession

✔️ Expected Behavior

  1. When connecting with dynamic resolution, KDE Plasma should resize properly to match the XRDP session resolution without issues.
  2. When connecting with a fixed resolution (e.g., 1920x1080), KDE Plasma should adjust its desktop resolution to match the client resolution sent by XRDP.

❌ Actual Behavior

  1. Dynamic Resolution: KDE Plasma fails to resize correctly when connecting to XRDP with dynamic resolution. The desktop does not adapt as expected.
  2. Fixed Resolution: When connecting with a fixed resolution (e.g., 1920x1080):
  • KDE Plasma remains locked at 1024x768.
  • XRDP successfully adjusts to the client’s resolution, but KDE Plasma does not reflect the change.
  • Exceeding the 1024x768 resolution area results in the appearance of the "X" pointer from the VNC server, and any area outside 1024x768 is rendered as a black screen.

Anything else?

  1. KDE plasmashell 6.2.4 on KDE Neon with XRDP XRDP 0.9.24-4 functions correctly under the same setup.
  2. In Fedora the problem occurs with Plasmashell Version: 6.2.5

Relevant logs (from xrdp.log):

[2025-01-13T23:33:49.800+0200] [DEBUG] dynamic_monitor_data: received width 1740, received height 1291.
[2025-01-13T23:33:49.811+0200] [DEBUG] dynamic_monitor_process_queue: Not allowing resize due to invalid dimensions (w: 0 x h: 0)

More Complete log:

[2025-01-13T23:33:49.787+0200] [DEBUG] libxrdp_process_monitor_stream: The number of monitors received is: 1
[2025-01-13T23:33:49.800+0200] [DEBUG] dynamic_monitor_data: received width 1740, received height 1291.
[2025-01-13T23:33:49.811+0200] [DEBUG] dynamic_monitor_process_queue: Not allowing resize due to invalid dimensions (w: 0 x h: 0)
[2025-01-13T23:33:49.823+0200] [DEBUG] xrdp_egfx_close_response: egfx deleted.
[2025-01-13T23:33:49.835+0200] [DEBUG] VNC setting screen id to 1804289383 from server
[2025-01-13T23:33:49.846+0200] [DEBUG] Changing server layout
[2025-01-13T23:33:49.858+0200] [DEBUG] VNC Sending SetDesktopSize
[2025-01-13T23:33:49.869+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.882+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.893+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.905+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.916+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.927+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.940+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.951+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.963+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.985+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:49.997+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:50.808+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:50.201+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:50.317+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:50.424+0200] [DEBUG] Skipping RFB_ENC_RAW encoding
[2025-01-13T23:33:50.550+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=2010x1420
[2025-01-13T23:33:50.662+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=2010x1420
[2025-01-13T23:33:50.781+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=2010x1420
[2025-01-13T23:33:50.893+0200] [DEBUG] VNC matched ExtendedDesktopSize rectangle x=1, y=0 geom=2010x1420
[2025-01-13T23:33:50.101+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=2010x1420
[2025-01-13T23:33:50.114+0200] [DEBUG] VNC server successfully resized
[2025-01-13T23:33:50.124+0200] [INFO ] Layout from NewLayout (geom=2010x1420 #screens=1) : 1804289383:(2010x1420+0+0)
[2025-01-13T23:33:50.137+0200] [INFO ] server_monitor_resize_done: Advancing server monitor resized.
[2025-01-13T23:33:50.151+0200] [INFO ] Client supports single-screen resizes by xrdp
[2025-01-13T23:33:50.163+0200] [INFO ] xrdp_caps_process_pointer: client supports new(color) cursor
[2025-01-13T23:33:50.174+0200] [INFO ] xrdp_process_offscreen_bmpcache: support level 1 cache size 7864320 MB cache entries 2000
[2025-01-13T23:33:50.185+0200] [INFO ] xrdp_caps_process_codecs: RemoteFX(76772F12-BD72-4463-AFB3-B73C9C6F7886), codec id [3], properties len [49]
[2025-01-13T23:33:50.196+0200] [WARN ] Client Capability: not enough orders supported by client, client wants off screen bitmap but offscreen bitmaps disabled
[2025-01-13T23:33:50.207+0200] [INFO ] Client Capability: LARGE_POINTER_FLAG_96x96 supported
[2025-01-13T23:33:50.219+0200] [INFO ] xrdp_mm_up_and_running: Core reset done.
[2025-01-13T23:33:50.238+0200] [INFO ] xrdp_egfx_create: error 0 channel_id 1
[2025-01-13T23:33:50.249+0200] [INFO ] xrdp_mm_egfx_caps_advertise:
[2025-01-13T23:33:50.261+0200] [INFO ]   version 0x00080004 flags 0x00000002 (index: 0)
[2025-01-13T23:33:50.271+0200] [INFO ]   version 0x00080105 flags 0x00000002 (index: 1)
[2025-01-13T23:33:50.282+0200] [INFO ]   version 0x000a0002 flags 0x00000022 (index: 2)
[2025-01-13T23:33:50.292+0200] [INFO ]   version 0x000a0200 flags 0x00000022 (index: 3)
[2025-01-13T23:33:50.303+0200] [INFO ]   version 0x000a0301 flags 0x00000020 (index: 4)
[2025-01-13T23:33:50.313+0200] [INFO ]   version 0x000a0400 flags 0x00000022 (index: 5)
[2025-01-13T23:33:50.324+0200] [INFO ]   version 0x000a0502 flags 0x00000022 (index: 6)
[2025-01-13T23:33:50.335+0200] [INFO ]   version 0x000a0600 flags 0x00000022 (index: 7)
[2025-01-13T23:33:50.346+0200] [INFO ]   version 0x000a0601 flags 0x00000022 (index: 8)
[2025-01-13T23:33:50.356+0200] [INFO ] unknown version 0x000a0601
[2025-01-13T23:33:50.367+0200] [INFO ]   version 0x000a0701 flags 0x00000022 (index: 9)
[2025-01-13T23:33:50.377+0200] [INFO ]   replying version 0x000a0701 flags 0x00000022
[2025-01-13T23:33:50.388+0200] [DEBUG] xrdp_egfx_send_capsconfirm: xrdp_egfx_send_s error 0
[2025-01-13T23:33:50.399+0200] [INFO ] xrdp_mm_egfx_caps_advertise: xrdp_egfx_send_capsconfirm error 0 best_index 9
[2025-01-13T23:33:50.410+0200] [INFO ] xrdp_egfx_reset_graphics:
[2025-01-13T23:33:50.420+0200] [INFO ] xrdp_egfx_reset_graphics: (index 0) monitor left 0 top 0 right 2009 bottom 1419 is_primary 1
[2025-01-13T23:33:50.431+0200] [INFO ] xrdp_egfx_reset_graphics: width 2010 height 1420 monitorcount 1
[2025-01-13T23:33:50.442+0200] [DEBUG] xrdp_egfx_send_reset_graphics: xrdp_egfx_send_s error 0
[2025-01-13T23:33:50.453+0200] [INFO ] xrdp_mm_egfx_caps_advertise: xrdp_egfx_send_reset_graphics error 0 monitorCount 1
[2025-01-13T23:33:50.465+0200] [DEBUG] xrdp_egfx_send_map_surface: xrdp_egfx_send_s error 0
[2025-01-13T23:33:50.476+0200] [INFO ] xrdp_mm_egfx_create_surfaces: map surface_id 0 left 0 top 0 width 2010 height 1420
[2025-01-13T23:33:50.487+0200] [INFO ] xrdp_encoder_create: starting gfx rfx pro codec session
[2025-01-13T23:33:50.497+0200] [INFO ] xrdp_mm_egfx_invalidate_wm_screen:
[2025-01-13T23:33:50.508+0200] [INFO ] xrdp_mm_egfx_caps_advertise: egfx created.
[2025-01-13T23:33:50.536+0200] [INFO ] dynamic_monitor_process_queue: Clearing completed resize (w: 2010 x h: 1420). It took 714 milliseconds.
[2025-01-13T23:33:50.547+0200] [INFO ] xrdp_mm_egfx_frame_ack: encoder is nil
[2025-01-13T23:33:50.586+0200] [DEBUG] VNC setting screen id to 1804289383 from server
[2025-01-13T23:33:50.597+0200] [DEBUG] Changing server layout
[2025-01-13T23:33:50.608+0200] [DEBUG] VNC Sending SetDesktopSize
[2025-01-13T23:33:50.659+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=1740x1291
[2025-01-13T23:33:50.670+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=1740x1291
[2025-01-13T23:33:50.681+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=1740x1291
[2025-01-13T23:33:50.692+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=1740x1291
[2025-01-13T23:33:50.703+0200] [DEBUG] VNC matched ExtendedDesktopSize rectangle x=1, y=0 geom=1740x1291
[2025-01-13T23:33:50.715+0200] [DEBUG] Skipping RFB_ENC_EXTENDED_DESKTOP_SIZE encoding x=0, y=0 geom=1740x1291
[2025-01-13T23:33:50.727+0200] [DEBUG] VNC server successfully resized
[2025-01-13T23:33:50.737+0200] [INFO ] Layout from NewLayout (geom=1740x1291 #screens=1) : 1804289383:(1740x1291+0+0)
[2025-01-13T23:33:50.749+0200] [INFO ] server_monitor_resize_done: Advancing server monitor resized.
[2025-01-13T23:33:50.762+0200] [INFO ] Client supports single-screen resizes by xrdp
[2025-01-13T23:33:50.773+0200] [INFO ] xrdp_caps_process_pointer: client supports new(color) cursor
[2025-01-13T23:33:50.784+0200] [INFO ] xrdp_process_offscreen_bmpcache: support level 1 cache size 7864320 MB cache entries 2000
[2025-01-13T23:33:50.794+0200] [INFO ] xrdp_caps_process_codecs: RemoteFX(76772F12-BD72-4463-AFB3-B73C9C6F7886), codec id [3], properties len [49]
[2025-01-13T23:33:50.805+0200] [WARN ] Client Capability: not enough orders supported by client, client wants off screen bitmap but offscreen bitmaps disabled

image

Same with rdesktop:

image

@unmanarc unmanarc added the bug label Jan 13, 2025
@matt335672
Copy link
Member

Hi @unmanarc

You've got two problems here. Let's look at the first one first.

The first thing to so is identify the package where the fault is. It could be in one of three places:-

  1. xrdp
  2. The TigerVNC X server
  3. the Plasma desktop

It's relatively easy to remove 3) from the system to play around with dynamic resizing with xrdp and the X server alone. Here's one way to do it:-

  1. dnf install xterm xsetroot xorg-x11-xbitmaps
  2. Edit /usr/libexec/xrdp/startwm.sh. You'll find the following lines near the top:-
    # Uncomment the following line for debug:
    # exec xterm
    Uncomment the exec xterm line. This will disable the desktop and run a session with xrdp, the X server and an xterm only.
  3. Log in to the machine with xrdp. You should get a black screen with an xterm in it.
  4. Create a tiled background with the following command in the xterm:-
    xsetroot -bitmap /usr/include/X11/bitmaps/icon
    
  5. Try varying resizes of the X server. After each one, check for screen corruption. You can verify the resize has happened with this command in the xterm:-
    xdpyinfo | grep -i dim
    

I've tried this myself on a Fedora 41 VM, and I'm unable to find any problems in this area. There may be some difference between my setup and yours however, so I think this would be a useful first step for you to try.

@unmanarc
Copy link
Author

Image

This task you sent me works perfectly.

The background pattern is displayed correctly even after resizing, and when I resize, the different resolutions are shown with the command.

The problem occurs with KDE6, which doesn't seem to understand those dimensions and is limited to 1024x768...

(I launched it with startplasma)

Image

@matt335672
Copy link
Member

The desktop is responsible for subscribing to the screen change notify events generated by the X server and actioning them. It looks like (for some reason) your desktop is ignoring these events.

Can you create a new user account with an empty config and try that? It's possible you've got a KDE setting stuck somewhere.

@unmanarc
Copy link
Author

unmanarc commented Jan 21, 2025

I faced the same issue with the new user, but I managed to resolve it. Here's a breakdown of the problem and how I fixed it:


Problem Overview

  1. Out-of-the-box Fedora KDE Spin Issue: Plasma does not launch via RDP.
  2. Following this guide, I created a startwm.sh file with the following content:
    dbus-launch --exit-with-session /usr/bin/startplasma-wayland
    This did work to some extent but was limited to a 1024x768 resolution, which made it far from functional (our problem).
  3. After digging deeper, I discovered that the real issue lies in the Xsession script:

Root Cause

In /etc/X11/xinit/Xsession, line 63 explicitly calls for startplasma-x11:

kde|kde1|kde2|kdeplasma)
    exec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"startplasma-x11\""
    ;;

However, startplasma-x11 is not installed by default in the Fedora KDE Spin. This absence is the root cause of why Plasma fails to launch over RDP.


The Fix

  1. Install the missing plasma-workspace-x11 package:

    sudo dnf -y install plasma-workspace-x11
  2. Remove the custom ~/startwm.sh file:

    rm ~/startwm.sh
  3. Restart the RDP connection. Plasma should now work out of the box, and also without the resolution limitation of startplasma-wayland.


Final Recommendation

If you're using Fedora 41 KDE Spin and want to set up XRDP, the following command will ensure everything is installed correctly:

sudo dnf -y install plasma-workspace-x11 xrdp xorgxrdp

Proposed Fix for Fedora Maintainers

Fedora maintainers should consider making plasma-workspace-x11 a required dependency when xrdp is installed on systems with plasma-workspace. This would make Plasma work seamlessly over RDP without additional user intervention.


Now it works perfectly! 🎉

Image

@unmanarc
Copy link
Author

The question that remains is: Why does startplasma-wayland not handle resizing properly? That’s another problem to solve.

@matt335672
Copy link
Member

@unmanarc - at present xrdp doesn't support wayland. That it works at all is quite astonishing!

I can understand your comment regarding Fedora maintainers, but from what little I know of packaging RPMs, your proposed fix above would be a challenge.

@bsmojver - you may be interested in this thread.

@bsmojver
Copy link

I could add a conditional dependency (with if, documented here: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html), but I think this is probably better done in the documentation. I can add a section into the readme file of the package, so that plasma users know what to do.

I would guess that plasma wayland falls back to X11 in some form, which is then presents a resolution limitation. Probably something folks that maintain plasma should be asked (I am not familiar with KDE at all, to be honest).

@matt335672
Copy link
Member

Thanks bojan.

The readme makes sense, as that's necessary for the pam file too.

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

No branches or pull requests

3 participants