neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.6k stars 1.73k forks source link

Raspbian : Can't click icons with screen blanking enabled #1701

Closed Pauduan closed 3 years ago

Pauduan commented 3 years ago

I can't seem to click on any icons on an xrdp session. The issue is specific to a RPi4 running Rasbian Buster. Also the remote session is now different from the main session, windows open in one do not show up in the other. There are no auth problems and display looks okay. but I can't click anything on desktop, start menu or taskbar. The system has been running for about a year now and xrdp was working perfectly. The last I remember it working was before installing Variety. After removing the software it is still not working.

I also have a Tinkerboard running Armbian, which seems unaffected by this issue (everything works perfect). I don't even know where to start troubleshooting. I reinstalled, rebooted, set desktop permissions (I think). Grateful for any help I can get. Apologies for not attaching any logs, I wouldn't know how to generate them.

matt335672 commented 3 years ago

Hi @Pauduan

I don't understand your comment here:-

Also the remote session is now different from the main session, windows open in one do not show up in the other.

XRDP creates a new session by default which is not the same as the console session. Could you add more detail on what you mean?

These kind of things can be very difficult to debug. Here are some general hints to start:-

Try those for starters and let us know how you get on.

Pauduan commented 3 years ago

Hi, I'll try creating a different user. The XVNC server does not work for sure. It says

image

I do seem to remember that the desktop was similar for both remote and local sessions, but I may be mistaken. I don't usually use a monitor on those systems.

Basically if you opened up a window on the desktop locally and left it there, when you logged in remotely you could see those windows open.

matt335672 commented 3 years ago

OK - that's a different thing. I suspect that the session manager you're using is just saving the layout of the windows and replicating it on the XRDP session so it looks like the same session.

The error above is possibly saying that you don't have a VNC server installed on your system, or it's not configured correctly. We can sort that out if you like, but please try the different user first.

Pauduan commented 3 years ago

Hi

I appreciate the help, way more than I've been getting recently 👍

I enabled, disabled and re-enabled the VNC server using raspi-config, rebooting each time. Same error shows up when the server is enabled.

I then created a new user 'temp' and logged in over SSH, which worked. Then I used an xrdp session to log in. Exactly the same issue - I can't click anything. There's a tooltip over the Raspberry, which doesn't seem to disappear as it should when I click anywhere. The pointer moves around fine, just the buttons don't work. In case I forgot to mention, I've already tried other PCs, including a laptop running Ubuntu Studio, and I can confirm issue is replicated across all remote clients.

The other interesting thing is the desktop itself looks completely different from the one I get when logging in through the primary account. This, while normal and expected, has one anomaly - there is a wallpaper from the selections set by Variety. I have a suspicion that Variety somehow messed up the desktop configuration files, and that is breaking my ability to control the desktop.

Is there a way to reset the desktop to factory default over SSH?

matt335672 commented 3 years ago

Thanks for trying the new user. That suggests all is OK with your user config files.

When you say the desktop looks completely different, what do you mean? Is it a different environment maybe (e.g. XFCE or GNOME)? I'm afraid I'm not familiar with Raspbian, so I don't know what the default desktop is, or what is available.

I run variety here on Mint, and as far as I can tell, the config is user-specific. I don't think it messes with any global files when you install it. The config and downloaded files reside in ~/.config/variety for each user. I can't explain the behaviour you're seeing.

I still think it's worth trying to get the Xvnc option working so we can see if this is an X server issue or not. Can you do the following for me:-

  1. Make a note of the system time in hours, minutes and seconds (HH:MM:SS) on a ssh connection.
  2. Attempt to connect over XRDP using the Xvnc backend
  3. When this fails, on the ssh connection, enter this command, changing HH:MM:SS to the time you recorded in step 1. This will give us a system log of the login attempt.
    sudo journalctl -S HH:MM:SS
Pauduan commented 3 years ago

Hi Matt,

These are the logs for the login attempt. I can see some permission problems, and this whole behaviour is new. Could it be due to some Linux update?

-- Logs begin at Sat 2020-10-17 10:35:47 IST, end at Tue 2020-10-20 11:52:24 IST. --
Oct 20 11:51:12 PISERVER sudo[25919]: pam_unix(sudo:session): session closed for user root
Oct 20 11:51:13 PISERVER vncserver-x11[536]: AgentInitCheck: agent comms failure
Oct 20 11:51:18 PISERVER vncserver-x11[536]: AgentInitCheck: no response from agent
Oct 20 11:51:21 PISERVER xrdp[595]: (595)(-1225373584)[INFO ] Socket 12: AF_INET6 connection received from ::ffff:192.168.100.101 port 51183
Oct 20 11:51:21 PISERVER xrdp[595]: (595)(-1225373584)[DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.100.130 port 3389)
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[INFO ] Using default X.509 key file: /etc/xrdp/key.pem
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[DEBUG] TLSv1.3 enabled
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[DEBUG] TLSv1.2 enabled
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[DEBUG] Security layer: requested 11, selected 0
Oct 20 11:51:21 PISERVER xrdp[25971]: (25971)(-1225373584)[DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.100.130 port 3389)
Oct 20 11:51:21 PISERVER xrdp[595]: (595)(-1225373584)[INFO ] Socket 12: AF_INET6 connection received from ::ffff:192.168.100.101 port 51184
Oct 20 11:51:21 PISERVER xrdp[595]: (595)(-1225373584)[DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.100.130 port 3389)
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] Using default X.509 key file: /etc/xrdp/key.pem
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] TLSv1.3 enabled
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] TLSv1.2 enabled
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] Security layer: requested 0, selected 0
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] connected client computer name: AUDIO
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] adding channel item name rdpdr chan_id 1004 flags 0x80800000
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] adding channel item name rdpsnd chan_id 1005 flags 0xc0000000
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] adding channel item name cliprdr chan_id 1006 flags 0xc0a00000
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] adding channel item name drdynvc chan_id 1007 flags 0xc0800000
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] Non-TLS connection established from ::ffff:192.168.100.101 port 51184: encrypted with standard RDP security
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] xrdp_00006574_wm_login_mode_event_00000001
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] Cannot find keymap file /etc/xrdp/km-00004009.ini
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] Cannot find keymap file /etc/xrdp/km-00004009.ini
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
Oct 20 11:51:21 PISERVER xrdp[25972]: (25972)(-1225373584)[WARN ] local keymap file for 0x00004009 found and doesn't match built in keymap, using local keymap file
Oct 20 11:51:23 PISERVER vncserver-x11[536]: AgentInitCheck: agent comms failure
Oct 20 11:51:26 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
Oct 20 11:51:26 PISERVER xrdp-sesman[568]: (568)(-1225420944)[INFO ] A connection received from ::1 port 37592
Oct 20 11:51:26 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] xrdp_wm_log_msg: sesman connect ok
Oct 20 11:51:26 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
Oct 20 11:51:26 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] return value from xrdp_mm_connect 0
Oct 20 11:51:26 PISERVER xrdp-sesman[568]: (568)(-1225420944)[INFO ] ++ reconnected session: username pi, display :10.0, session_pid 1382, ip ::ffff:192.168.100.101:51184 - sock
Oct 20 11:51:26 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] xrdp_wm_log_msg: login successful for display 10
Oct 20 11:51:26 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] xrdp_wm_log_msg: started connecting
Oct 20 11:51:26 PISERVER xrdp-sesman[568]: (568)(-1225420944)[DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
Oct 20 11:51:27 PISERVER xrdp[25972]: (25972)(-1225373584)[INFO ] lib_mod_log_peer: xrdp_pid=25972 connected to X11rdp_pid=1386 X11rdp_uid=1000 X11rdp_gid=1000 client_ip=::ffff:
Oct 20 11:51:27 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] xrdp_wm_log_msg: connected ok
Oct 20 11:51:27 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
Oct 20 11:51:27 PISERVER xrdp[25972]: (25972)(-1225373584)[DEBUG] Closed socket 16 (AF_INET6 ::1 port 37592)
matt335672 commented 3 years ago

The permissions issue regarding /etc/xrdp/key.pem is not directly significant here. It's down to the way Debian have decided to package XRDP. Read about it in the wiki. It's worth addressing in any case I think.

Other than that, I can't see any errors in the above log. In fact it looks like a normal reconnection to an existing session.

Can you try a couple of things for me:- 1) Make sure you can start a VNC server normally by entering this command on an ssh session:-

   Xvnc :10

If all is well, the Xvnc program should start and you'll need to CTRL-C it. If this doesn't work, let me know. 2) Reboot the machine so there are no previous sessions to connect to. 3) Retry the procedure in the above comment. Make sure you select 'Xvnc' on the connection dialog rather than 'Xorg'.

Pauduan commented 3 years ago

Hi

When running the command, this is what I get:

pi@PISERVER:~ $ sudo Xvnc :10

Fatal server error:
Server is already active for display 10
        If this server is no longer running, remove /tmp/.X10-lock
        and start again.

This is what I get when rebooting and typing the command:

pi@PISERVER:~ $ sudo Xvnc :10
VNC(R) Server 6.7.2 (r42622) ARMv6 (May 13 2020 19:44:08)
Copyright (C) 2002-2020 RealVNC Ltd.
RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark
registrations and/or pending trademark applications in the European Union,
United States of America and other jurisdictions.
Protected by UK patent 2481870; US patent 8760366; EU patent 2652951.
See https://www.realvnc.com for information on VNC.
For third party acknowledgements see:
https://www.realvnc.com/docs/6/foss.html
OS: Raspbian GNU/Linux 10, Linux 5.4.51, armv7l
<13> 2020-10-23T02:20:43.058Z PISERVER Xvnc[1024]: ServerManager: Server started
Underlying X server release 609000, The X.Org Foundation

error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/TTF/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!

I get the same error as in post no. 3.

Sorry for the long gaps between replies. I'm nursing a rotator cuff injury and can't seem to shake it. Computing is taking a bit of backseat as I can't mouse as much as I need to.

matt335672 commented 3 years ago

I've installed x86 Raspbian on a VM to take a look at this.

By default /usr/X11R6 doesn't exist on Raspbian, so those errors are quite understandable.

From your useful trace above, it seems that the RealVNC package is installed on a standard rPI. I recommend we try to use tigervnc instead, as this is the gold-standard open source VNC server, and it's what we've tested recent changes to VNC support in XRDP against. Furthermore, I need a licence to run it on x86 and I don't have one.

I can't be sure whether realVNC is serving any useful purpose or not on your PI. Regardless, we can install tigervnc alongside realVNC - there's no need to replace it.

Try the following:-

sudo apt install tigervnc-standalone-server
Xtigervnc :10

If that gives you errors, post them and we'll sort them out.

If all is well, edit /etc/xrdp/sesman.ini (NOT xrdp.ini) and replace the line param=Xvnc with param=Xtigervnc - it's line 94 in my file. Then sudo systemctl restart xrdp xrdp-sesman and try to log in again using Xvnc on the login screen.

Don't worry about the gaps - I think your wrist is more important than getting your PI sorted out.

Pauduan commented 3 years ago

Hi matt

Got this done, but I'm still getting the same error as in post nr. 3. It says "some problem" without specifying what the problem is.

I haven't got any errors, and the tigervnc server is started. I changed the lines in the sesman file, restarted the service and everything looked okay.

If you like I can try the log upload process for you to take a look. However I am beginning to think a reinstall is the only option, as everything was working great last I remember. Setting up the system is very painful process for me, but I'll have to get it done.

matt335672 commented 3 years ago

The "some problem" is a catchall which is displayed at the end of the connection sequence if it fails. Is the line before the same, or is it different?

If you can reboot and capture a log from the login sequence I'll be happy to look at it. Let me know what you want to do.

UlTriX commented 3 years ago

Having the same issue of not being able to click in anything on the screen via the rdp client.

This only happens if Screen Blanking is turned to off if on everything works as intended.

Why should this option affect xrdp ?

Thanks

Pedro

Pauduan commented 3 years ago

Hi Matt, I seemed to have fixed the issue after reinstalling. I now have two happy Pi4s with accessible and controllable desktops.

UITriX, that might have saved me before I started. I just got my head back above water after an all-nighter. Yes, I had turned screen blanking off deliberately to check a monitor screen for dead pixels. It's good to know that there is an alternative possible solution to reinstalling which is typically a six-seven hour process for me.

matt335672 commented 3 years ago

Interesting info - thanks for that @UlTriX

I've tried to reproduce this without any luck. I've gone in to Windows "Power and Sleep" Settings and set the screen to not turn off. It doesn't seem to have any effect.

Am I not understanding what you both mean by 'Screen Blanking'?

UlTriX commented 3 years ago

I mean this option:

Raspberry Pi OS will blank the graphical desktop after 10 minutes without user input. You can disable this by changing the 'Screen Blanking' option in the Raspberry Pi Configuration tool, which is available on the Preferences menu. Note that the 'Screen Blanking' option also controls screen blanking when the graphical desktop is not running.

https://www.raspberrypi.org/documentation/configuration/screensaver.md

When set to off I have the issue with xrdp.

I am still trying to understand why and if there is another workaround since i really don't want the screen to turn off.

Let me know if I can be of help in testing

matt335672 commented 3 years ago

The component which is different for Raspbian as opposed to other operating systems is the VNC server.

Raspbian on ARM gets a licensed copy of the RealVNC server (see above) which is installed by default. This is not available for x86 Raspbian users, so at the moment I don't have an easy way to look in to this - I've got a Raspbian VM available, but no PI hardware currently.

I found this link [realvnc.com] which suggests there's some support in the Real VNC server for hardware screen blanking. Maybe this is something to do with it, but that's only a guess.

With that in mind, I can offer you two potential workarounds:-

With a bit of Googling about I also found this link [osmc.tv] where a similar problem was solved by plugging a keyboard in to the PI even though it's not used. To my mind this seems unlikely to be related, but it's a simple thing go to try.

Let me know how it goes, or what assistance I can give you.

Pauduan commented 3 years ago

The screen blanking checkbox is indeed the source of the issue, I can now confirm it. Disabling screen blanking basically removes the ability to use the desktop though it is visible.

I tried this on a fresh install on a different Pi, Raspbian has a configuration utility that I could access using the console. Disabling screen blanking disables the desktop, enabling it allows one to use it as normal. I think the issues is now sorted for me. The topic can be closed with the solution in place.

matt335672 commented 3 years ago

I'll close this for now then - it's findable with an internet search. We can re-open it if more information is provided from someone with a PI.