rricharz
Posts: 56
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: 1717
Joined: Mon Dec 31, 2012 12:54 pm
Location: Ealing

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: 56
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: 1717
Joined: Mon Dec 31, 2012 12:54 pm
Location: Ealing

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: 56
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.

User avatar
fruitoftheloom
Posts: 14962
Joined: Tue Mar 25, 2014 12:40 pm
Location: Bognor Regis UK

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/
My only "PC" is an Asus ChromeBit running ChromeOS, cloudcentric at its best !
Rockchip Quad-Core RK3288C SoC as used in ASUS Chromebook C201 & Chromebook Flip C100PA as well as the Tinker SBC

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: 9
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

User avatar
fruitoftheloom
Posts: 14962
Joined: Tue Mar 25, 2014 12:40 pm
Location: Bognor Regis UK

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 ????
My only "PC" is an Asus ChromeBit running ChromeOS, cloudcentric at its best !
Rockchip Quad-Core RK3288C SoC as used in ASUS Chromebook C201 & Chromebook Flip C100PA as well as the Tinker SBC

jtmoderate876
Posts: 16
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: 16
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: 16
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.

Return to “Raspbian”

Who is online

Users browsing this forum: bensimmo, Imperf3kt and 15 guests