rricharz
Posts: 57
Joined: Tue Apr 19, 2016 8:46 am
Location: Switzerland
Contact: Website

Remote desktop (xrdp) on stretch: Some menu items do not work

Sun Sep 24, 2017 5:33 am

Remote desktop on Raspbian Stretch works quite well after installing it with

Code: Select all

sudo apt-get purge realvnc-vnc-server
sudo apt-get install xrdp
Unfortunately, some menu items do not work, such as
Shutdown->Shutdown
Preferences->Raspberry Pi Configuration
Nothing happens if these menu items are executed.

Using
sudo shutdown -h now
sudo raspbi-config
works fine.

The command line for Raspberry Pi Configuration is
env SUDO_ASKPASS=/usr/bin/pwdrcg.sh sudo -A rc_gui

Executing this in a terminal window gives
No protocol specified
Cannot open display: 10.0

The same happens actually with other commands in the terminal window
leafpad works
but sudo leafpad gives the above error.

This makes stretch on a headless pizerow almost unusable.

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sun Sep 24, 2017 9:35 pm

xrdp hasn't worked that well since wheezy (on the Pi - works fine on my Debian8 VTL), hence the inclusion of RealVNC (which actually reflects what the Pi is displaying, rather than open a new session - useful if you want to preview the camera as that goes to the Pi's screen regardless).

rricharz
Posts: 57
Joined: Tue Apr 19, 2016 8:46 am
Location: Switzerland
Contact: Website

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Mon Sep 25, 2017 10:05 am

Thanks for your valuable input.

For me xrdp has actually worked well in Jessie.

I have a setup with 7 different Raspberry PI systems, with various screens (some very small, some headless). I have used xrdp to maintain all these systems, for example to clone sd cards using the desktop sd card copier. The advantage of xrdp is that you can set the screen resolution for the xrdp session on the client side.

Realvnc does the job in certain configurations, but not in others:

On headless pi zero systems:
- requires "boot to desktop" activated
- requires screen resolution to be set in menu > Raspberry Pi Configuration > Resolution
This probably means that precious resources are used up on the pi zero even if no remote access happens during normal operation.

On systems with small screens (such as Adafruit pi tft's):
- comes up with a small and useless screen on the client
- requires "boot to desktop" activated

That's why I would really like xrdp to work properly for maintenance on Stretch, unless somebody has a solution for the realvnc limitations.

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Sep 26, 2017 11:14 pm

rricharz wrote:
Mon Sep 25, 2017 10:05 am
That's why I would really like xrdp to work properly for maintenance on Stretch, unless somebody has a solution for the realvnc limitations.
That depends on what your maintenance requires. I just ssh in once a month and update, upgrade and reboot them (I could put those into cron, but I like to manually check that it's all still OK - everything else can be done via a web interface on my setups).

SADPi
Posts: 3
Joined: Fri Oct 06, 2017 1:36 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Fri Oct 06, 2017 2:45 pm

Hi all,

First post so please be gentle with me.

I'm having similar problems with menu items and have done a bit of digging.

Running
Preferences->Raspberry Pi Configuration

Nothing happens.

Works fine on the console.

Looking at the properties of the menu item I notice:

Code: Select all

env SUDO_ASKPASS=/usr/bin/pwdrcg.sh sudo -A rc_gui
Running this from a terminal window:

Code: Select all

> env SUDO_ASKPASS=/usr/bin/pwdrcg.sh sudo -A rc_gui
No protocol specified
(rc_gui:1843): Gtk-WARNING **: cannot open display: :10.0
Bit of googling found
https://unix.stackexchange.com/question ... -specified

indicates thte problem is not with Remote Dexktop or XRDP but with X itself.

Running the following from the remote desktop

Code: Select all

> env | grep XAUT
> sudo env | grep XAUT
Gives no output i.e. $XAUTHORITY is not set for either pi or root.

Returning to the console

Code: Select all

> env | grep XAUT
XAUTHORITY=/home/pi/.Xauthority
> sudo env | grep XAUT
XAUTHORITY=/home/pi/.Xauthority
I've not tested any of the proposed solutions as I would rather understand why the XAUTHORITY environment variable is set when launching the GUI from the console but not via VNC (i.e. RDP)....

Workarounds gleaned from stackexchange:
1) A simple BUT DANGEROUS "fix" is to run

Code: Select all

> xhost +
in a terminal from the remote desktop. Good for testing if you want to pinpoint this as the problem but something tha I would rather avoid as a permanent solution.

2) A better soluton might be to explicity grant root and pi access to the display in question (usually display #10) using

Code: Select all

> xhost si:localuser:pi
> xhost si:localuser:root
Although I am not convinced that would work/or is necessary.

3) A third option is

Code: Select all

> export XAUTHORITY=~/.Xauthority
Again I am not conviced this alone would work. it may require a combination of 2 and 3 above

Will follow up once I have done a bit more digging.

rricharz
Posts: 57
Joined: Tue Apr 19, 2016 8:46 am
Location: Switzerland
Contact: Website

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Fri Oct 06, 2017 5:49 pm

That's a very good description of what I am struggling with. I hope somebody can find a solution.

SADPi
Posts: 3
Joined: Fri Oct 06, 2017 1:36 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sat Oct 07, 2017 10:54 am

Tested the following:

Disabled access control using:

Code: Select all

> xhost +
This allowed me to run
Preferences->Raspberry Pi Configuration
But as mentioned this is not recommended so re-enabled access control using

Code: Select all

> xhost -
Unsurprislingly no longer able to run
Preferences->Raspberry Pi Configuration

Then exlicitly added root to

Code: Select all

> xhost si:localuser:root
That also allowed me to run
Preferences->Raspberry Pi Configuration

My understanding of xrdp is that it uses a RDP connection to a VNC session runnning on the pi. VNC handles the communcation with X.

Also I noticed that my keyboard mapping does not work properly through XRDP seems to default to US layout even though I have specified UK in raspi-config.

I suspect the problem is that when starting the GUI through VNC, it is not running the same startup scripts as it does when starting the GUI from the terminal.

Rather than throwing 'random' commands at the pi to get things working in different clientsI would prefer have the same environment set regardless of whether I access the GUI from the console, VNC or XRDP.

More digging required...

cstrunk
Posts: 1
Joined: Sat Oct 07, 2017 11:16 am

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sat Oct 07, 2017 11:46 am

My understanding of xrdp is that it uses a RDP connection to a VNC session runnning on the pi. VNC handles the communcation with X.
As far as I understand after you uninstalled the realvnc-vnc-server and installed xrdp, it has also automatically installed xorgxrdp, and by default, xrdp uses an Xorg session, not a VNC session.

I ran into the same problem and so far have found no better solution than what you pointed out with xhost, but I would guess the solution lies within Xorg or maybe Xsession rather than VNC.

fruitoftheloom
Posts: 17300
Joined: Tue Mar 25, 2014 12:40 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sat Oct 07, 2017 12:03 pm

IMO RealVNC is the way forward, it is the original VNC, they worked with the RPF to optimise their product, and they offer good support:

https://www.realvnc.com/en/connect/docs ... ry-pi.html

https://www.raspberrypi.org/blog/get-ba ... c-connect/
Adieu

SADPi
Posts: 3
Joined: Fri Oct 06, 2017 1:36 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Oct 10, 2017 10:50 am

Done a bit mroe digging and and these are the conclusions I have reached [or jumped to]
My understanding of xrdp is that it uses a RDP connection to a VNC session runnning on the pi. VNC handles the communcation with X.
This is incorrect, as pointed out by cstrunk.

xrdp can use VNC but the default behavior on RPI is to use Xorg

As an aside, I did a clean install of stretch and was able to get xrdp running without messing about uninstalling/installing the various flavours of VNC...

Code: Select all

sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get clean
sudo apt-get -y install xrdp

I think the isssue is that when starting X on the console xstart is called. This sets

Code: Select all

XAUTHORITY=/home/pi/.Xauthority
amongst other things then calls xinit
What appears to be happening with xrdp is that it is calling xinit directly, thus bypassing startx which is why $XAUTHORTY is not set.

I beleive the "best" solution would be to figure out where/how xrdp calls xinit and point it to startx instead. I just hope it isn't hardcoded.
Anther option may be to set $XAUTHRITY in /etc/X11/xinit/xinitrc, /etc/X11/Xsession or /etc/xrdp/startwm.sh but I don't particularly like this approach as it seems like a bit of a kludge and I've no idea what the impact might be.

As for using VNC, despite my love/hate relationship with MS and their products there are good reasons to use RDP over VNC.
1) VNC is a bit "heavy" in terms of network usage and performance
2) RDP is available on every windows desktop (unless you are using a very old version)
3) No additional installation required on windows clients - useful in business environments if the IT dept don't permit software installation by users or to maintain a clean/performant environment.*

* My background is in tech support in the 90's where every 3rd party product you installed exponentially increased the chances of a problem and the complexity of resolving it while simultaneously negatively impacting the performance. As such I still try to avoid installing products on my windows machines unless they offer particular functionality that is not already provided by the existing software already installed. I will even periodically rebuild my desktop environments simply to get a clean install and elimnate software I no longer need/use. This may be a bit "old skool" way of thinking but it has served me well.

Don't get me wrong. I think VNC is a useful tool, and if I had never heard of RDP/xrdp I would happily use VNC. But for many use cases RDP may be the "better" option.

UPDATE 2017-10-20
Corrected typos in sudo apt-get snippet above

Have tested the above snippet with a brand new install of 2017-09-07-raspbian-stretch and it works! (apart from the xauthority/root issue discussed and the keyboard has gone all "yankee doodle" on me).
Last edited by SADPi on Fri Oct 20, 2017 10:25 am, edited 3 times in total.

pixxx
Posts: 25
Joined: Sun Oct 08, 2017 4:12 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Oct 10, 2017 3:20 pm

fruitoftheloom wrote:
Sat Oct 07, 2017 12:03 pm
IMO RealVNC is the way forward, it is the original VNC, they worked with the RPF to optimise their product, and they offer good support:

https://www.realvnc.com/en/connect/docs ... ry-pi.html

https://www.raspberrypi.org/blog/get-ba ... c-connect/
I think I like RealVNC too, however, with Stretch the session screen resolution is too small and I cannot do anything about it. The same problem can be easily fixed with Pixel by editing the /boot/config.txt like so:
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=85

Do you have any idea why? thanks

fruitoftheloom
Posts: 17300
Joined: Tue Mar 25, 2014 12:40 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Oct 10, 2017 5:55 pm

pixxx wrote:
Tue Oct 10, 2017 3:20 pm
fruitoftheloom wrote:
Sat Oct 07, 2017 12:03 pm
IMO RealVNC is the way forward, it is the original VNC, they worked with the RPF to optimise their product, and they offer good support:

https://www.realvnc.com/en/connect/docs ... ry-pi.html

https://www.raspberrypi.org/blog/get-ba ... c-connect/
I think I like RealVNC too, however, with Stretch the session screen resolution is too small and I cannot do anything about it. The same problem can be easily fixed with Pixel by editing the /boot/config.txt like so:
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=85

Do you have any idea why? thanks

What is Pixel ????
Adieu

jtmoderate876
Posts: 29
Joined: Sat Dec 05, 2015 9:38 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Thu Oct 19, 2017 12:25 pm

I too have been using XRDP for a couple years and until now I have preferred it for the reasons @SADPi points out.

When I upgraded to stretch I was happy to see that Mouse wheel scrolling began to work - yay!

I found this thread because I tried to run "sd card copy" (piclone) from the menu item and it never executed.
I tried uninstalling piclone, reinstalling, executing from command line - no good.
I rebuilt the pi image from scratch thinking something got fouled up - no good.
I logged in from console and "sd card copy" (piclone) worked - which made me realize it was something to do with the combination of stretch and XRDP.

So all this worked fine until stretch - which giveth "mouse wheel" while it taketh piclone (and apearently raspi-config and other things I haven't yet realized).

Hope someone figures out how to get stretch back to working with XRDP.

jagoliveira
Posts: 1
Joined: Tue Oct 31, 2017 4:35 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Oct 31, 2017 4:47 pm

Remote Desktop XRDP with Xorg is working well on Stretch after a fresh install.

In order to run 'Raspberry PI Configuration' tool and others that need 'sudo' to run in Remote GUI, I inserted X authorization of 'xhost' for 'root' in:

/home/pi/.config/lxsession/LXDE-pi/autostart --> Insert '@xhost si:localuser:root' as last line.

jtmoderate876
Posts: 29
Joined: Sat Dec 05, 2015 9:38 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Fri Nov 17, 2017 5:49 pm

Thanks @jagoliveira
That seems to be the best band-aid.
I wonder what changed and why.

I have added your fix to my setup script as an "append" to the file you mention:
echo '@xhost si:localuser:root' | sudo tee -a /home/pi/.config/lxsession/LXDE-pi/autostart

There are some things I wish I didn't have to learn.

jtmoderate876
Posts: 29
Joined: Sat Dec 05, 2015 9:38 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Fri Nov 17, 2017 6:23 pm

I should also point out that I no longer have to remove vnc server.

ie. this is NO LONGER REQUIRED WITH STRETCH as it was with jessie:
sudo apt-get purge realvnc-vnc-server


You may still want to do it to free up space but you no longer have to for XRDP to work.
I also like that XRDP now supports mouse scroll wheel, copy & paste - these were really needed and welcome improvements.

clint67
Posts: 1
Joined: Thu May 12, 2016 3:31 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Jan 16, 2018 9:29 am

jagoliveira wrote:
Tue Oct 31, 2017 4:47 pm
Remote Desktop XRDP with Xorg is working well on Stretch after a fresh install.

In order to run 'Raspberry PI Configuration' tool and others that need 'sudo' to run in Remote GUI, I inserted X authorization of 'xhost' for 'root' in:

/home/pi/.config/lxsession/LXDE-pi/autostart --> Insert '@xhost si:localuser:root' as last line.
Hi,
I tried your solution and it is working with the 'Raspberry PI Configuration'.
I still have the 'Reboot options' not working (as the 'shutdown option')
I get the three buttons form but nothing happens when I click on them from the Xrdp session...
It works when I type 'sudo reboot' from LXterminal from the xrdp session

Somebody states that the xrdp open a new session on the RPi with no right on rebooting, but I do not have problem on others RPi running Jessie...

ktm_91
Posts: 3
Joined: Tue Feb 20, 2018 8:53 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Tue Feb 20, 2018 8:58 pm

clint67 wrote:
Tue Jan 16, 2018 9:29 am
jagoliveira wrote:
Tue Oct 31, 2017 4:47 pm
Remote Desktop XRDP with Xorg is working well on Stretch after a fresh install.

In order to run 'Raspberry PI Configuration' tool and others that need 'sudo' to run in Remote GUI, I inserted X authorization of 'xhost' for 'root' in:

/home/pi/.config/lxsession/LXDE-pi/autostart --> Insert '@xhost si:localuser:root' as last line.
Hi,
I tried your solution and it is working with the 'Raspberry PI Configuration'.
I still have the 'Reboot options' not working (as the 'shutdown option')
I get the three buttons form but nothing happens when I click on them from the Xrdp session...
It works when I type 'sudo reboot' from LXterminal from the xrdp session

Somebody states that the xrdp open a new session on the RPi with no right on rebooting, but I do not have problem on others RPi running Jessie...
Hi, I'm in this same exact situation: adding the mentioned line in the autostart file fixes the Raspberry PI Configuration tool launching, but I still cannot shutdown/reboot the Raspberry.. Of course running poweroff/reboot with sudo from the terminal could be a no-effort solution, but I wanted to understand why the same user has less privileges via xrdp. Has anyone figured it out?

ktm_91
Posts: 3
Joined: Tue Feb 20, 2018 8:53 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Fri Mar 02, 2018 8:05 pm

ktm_91 wrote:
Tue Feb 20, 2018 8:58 pm
clint67 wrote:
Tue Jan 16, 2018 9:29 am
jagoliveira wrote:
Tue Oct 31, 2017 4:47 pm
Remote Desktop XRDP with Xorg is working well on Stretch after a fresh install.

In order to run 'Raspberry PI Configuration' tool and others that need 'sudo' to run in Remote GUI, I inserted X authorization of 'xhost' for 'root' in:

/home/pi/.config/lxsession/LXDE-pi/autostart --> Insert '@xhost si:localuser:root' as last line.
Hi,
I tried your solution and it is working with the 'Raspberry PI Configuration'.
I still have the 'Reboot options' not working (as the 'shutdown option')
I get the three buttons form but nothing happens when I click on them from the Xrdp session...
It works when I type 'sudo reboot' from LXterminal from the xrdp session

Somebody states that the xrdp open a new session on the RPi with no right on rebooting, but I do not have problem on others RPi running Jessie...
Hi, I'm in this same exact situation: adding the mentioned line in the autostart file fixes the Raspberry PI Configuration tool launching, but I still cannot shutdown/reboot the Raspberry.. Of course running poweroff/reboot with sudo from the terminal could be a no-effort solution, but I wanted to understand why the same user has less privileges via xrdp. Has anyone figured it out?
up

Pi_DD
Posts: 10
Joined: Thu Feb 08, 2018 10:34 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Fri Mar 02, 2018 8:45 pm

I had the parallel problem with SD Card Copier as well as Raspi Config (running Stretch)

In a separate thread I was given the following suggestion as a change to the menu item via Main Menu Editor ...

Code: Select all

env SUDO_ASKPASS=/usr/bin/pwdpic.sh sudo -AE dbus-launch piclone
The change is adding the “E”.

I did the same thing for Raspi Config and that now works too, I’ve never had a problem with shutdown, reboot etc from the GUI.

BTW - this change works with both Xrdp and VNC. I have both running as it happens but it works just fine if only one is installed.

For what my 1/2 penny is worth on VNC vs. Xrdp ........

Until I worked out how to fix the screen dimensions for VNC via Raspi Config “set resolution”, after fixing the problem above, I preferred Xrdp because at least the screen was usable, even if it did not have all the additional arrow keys etc readily available. Now incline to VNC.

fbe
Posts: 329
Joined: Thu Aug 17, 2017 9:08 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sat Mar 03, 2018 6:31 am

Code: Select all

env SUDO_ASKPASS=/usr/bin/pwdpic.sh sudo -AE dbus-launch piclone
was my cheap workaround in another thread. Good enough for SD Card Copier but it may have surprising side effects. The wanted side effect is, that ~/.Xauthority is found as HOME is still /home/pi when running your command as root. If your program would write something to HOME you would get files in your HOME, owned by root...

Rereading this thread I think

Code: Select all

env XAUTHORITY=$HOME/.Xauthority env SUDO_ASKPASS=/usr/bin/pwdpic.sh sudo -A dbus-launch piclone
is better for common use.

ktm_91
Posts: 3
Joined: Tue Feb 20, 2018 8:53 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sat Mar 03, 2018 10:03 am

Thanks Pi_DD and thanks fbe,
this method is actually working, but it is only a workaround to what in my opinion is the real problem: the same user has less privileges if it is connected through xrdp. Don't you know a method to resolve the problem at the root?

Pi_DD
Posts: 10
Joined: Thu Feb 08, 2018 10:34 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sat Mar 03, 2018 11:01 am

As you can tell, well out of my depth here, but learning slowly! Spending a lot of time reading manuals to understand the advice.

Somehow the change fbe suggested has vanished without apparent action by me! But all still works from VNC.

For that, and because VNC provides much better virtual keyboard and controls from tablets than Xrdp, I’m going to abandon the latter.

jtmoderate876
Posts: 29
Joined: Sat Dec 05, 2015 9:38 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sun Apr 15, 2018 11:19 pm

something about recent raspbian stretch or xrdp updates once again breaks xrdp.
I'm now getting the black screen if up update && upgrade existing, working rpi's

and if I install the latest 3/15/2018 raspbian I and
sudo apt-get install xrdp

I get the black screen.

I was ONCE able to login and then had my earlier problem with items not working/permissions stuff.

but now I just get black screen and I retried from scratch several times so I'm not sure how I got RDP'd once

jtmoderate876
Posts: 29
Joined: Sat Dec 05, 2015 9:38 pm

Re: Remote desktop (xrdp) on stretch: Some menu items do not work

Sun Apr 15, 2018 11:58 pm

Feels like xrdp is no longer practical on rpi.
serious bummer.

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 24 guests