Raspberry Pi remote desktop black screen

[Image credit: Tom's Hardware]

 It’s a truly frustrating error you may encounter when you try to connect to your Raspberry Pi remotely using VNC. After you’ve done a Raspberry Pi headless install, you try getting remote access to the desktop environment, but VNC viewer [or some other client] gives you a black screen and with the message “Cannot currently show the desktop” on it. 

You may get this error when you attempt to connect to your Raspberry Pi via VNC. [Image credit: Tom's Hardware]

There are a couple of possible solutions for the “Cannot currently show the desktop” error message when connecting to your Raspberry Pi. Try each and see if it resolves the issue. All of the solutions below involve using the command prompt, either by directly connecting a keyboard and mouse to your Raspberry Pi or by using a remote SSH connection to get to the terminal. Massive hat tip to the folks in this forum thread who offered solutions and inspired this article.

 Change Your Screen Resolution

 Even though it should have a working default setting, often changing resolution at the command prompt.will solve the “Cannot currently show the desktop” error. To do this: 

1.  Launch raspi-config. 

sudo raspi-config

2.  Select Advanced Options-> Resolution. 

[Image credit: Tom's Hardware]

3.  Choose a resolution. We recommend at least 1280 x 720, but some users report that choosing the highest possible [usually 1920 x 1080] is what they needed to do. 

[Image credit: Tom's Hardware]

 You’ll need to reboot your Raspberry Pi for this change to take effect. 

 Install or Reinstall LXSession

 One reason that Raspberry Pi might be giving you the “cannot show the desktop” error is that there’s a problem with your session manager or it’s just not installed. 

To install LXsession, type:

sudo apt-get install lxsession

If LXSession is already installed, you should try reinstalling LXSession and the libgtk2.0-0 library: 

sudo apt-get install --reinstall libgtk2.0-0 sudo apt-get install --reinstall lxsession

 Boot to Desktop Mode

 If your Raspberry Pi has LXDE, the desktop environment installed, but it’s set to boot to command prompt, you won’t be able to view the desktop via VNC. To change Raspberry PI’s boot mode:

sudo raspi-config

2.  Select Boot Options->Desktop / ClI-> Desktop Autologin then hit Enter and select Finish to exit the software. 

[Image credit: Tom's Hardware]

3.  Reboot.

[Image credit: Tom's Hardware]

 It’s always possible that your desktop isn’t available, because you’ve run out of disk space. The way to find out is to type the following at the command prompt: 

df -h

 You’ll see a list of partitions and their amount of free space. If your root partition has no or almost no free space, that could be the problem and you should consider uninstalling some stuff or moving to a larger microSD card.

[Image credit: Tom's Hardware]

Today's best Raspberry Pi 4 B [4GB] deals

Having issues with your DietPi installation or found a bug? Post it here.

danmo117 Posts: 19 Joined: Wed Jun 03, 2020 4:01 pm

Post by danmo117 » Wed Jun 03, 2020 4:40 pm

Hi all, I know this has been asked before and I've tried loads of different "solutions" but I'm still experiencing an issue. So I've got dietpi 6.30 installed on a Pi3b+ and it's usually managed via SSH however for some reason I can't get RDP to work. I know VNC has been mentioned but I manage multiple machines and use RDP for all of them so I'd like to do the same with my Pi. From dietpi-software I installed XRDP which subsequently installs LXDE and TigerVNC as part of the process. When I try to connect to the Pi using the official RDP client for Mac it opens with a black screen and if I leave it for a few minutes the attached message is displayed.

Does anyone know how to fix this?

Attachments Screenshot 2020-06-03 at 15.35.58.png [12.77 KiB] Viewed 5644 times

Joulinar Legend Posts: 7730 Joined: Sat Nov 16, 2019 12:49 am

Post by Joulinar » Wed Jun 03, 2020 5:39 pm

Hi,

many thanks for your report. What did you select on the login screen for session? Do you use Xvnc? Looks like you are using Xorg.

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team

danmo117 Posts: 19 Joined: Wed Jun 03, 2020 4:01 pm

Post by danmo117 » Wed Jun 03, 2020 6:48 pm

Joulinar wrote: ↑Wed Jun 03, 2020 5:39 pm Hi,

many thanks for your report. What did you select on the login screen for session? Do you use Xvnc? Looks like you are using Xorg.

Hi Joulinar, Thanks for getting back to me. So you know all the steps.... I initiate the RDP connection and I instantly hit an all black screen, then after a few mins I get the aforementioned message in the screenshot. If I click OK on the message it takes me to the XRDP login page where I can select different session options. If I select the default "Xorg" and input my login credentials I just get a blank teal colour and after a few minutes I get the same message screenshot in the OP. My other session options are; - Xvnc - vnc-any - neutrinordp-any If I select Xvnc I get message attached.

In dietpi-config > AutoStart Options it's current set to number 2 [Desktops - automatic login], does this need to adjusted to anything else? Before tinkering with RDP it was set to 0 [Local Terminal - Manual Login] as I only accessed via SSH.

Attachments Screenshot 2020-06-03 at 17.37.44.png [15.14 KiB] Viewed 5633 times

Joulinar Legend Posts: 7730 Joined: Sat Nov 16, 2019 12:49 am

Post by Joulinar » Wed Jun 03, 2020 7:22 pm

Autostart option can be set to 0 : Manual login [default] . No need to have it set to something else. Even on my test it was not switched and still set to 0. Furthermore VNC is running on a different port than xrdp expects. Let's check

Code: Select all

cat /boot/dietpi.txt | grep SOFTWARE_VNCSERVER_DISPLAY_INDEX cat /etc/xrdp/sesman.ini | grep X11DisplayOffset=

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team

danmo117 Posts: 19 Joined: Wed Jun 03, 2020 4:01 pm

Post by danmo117 » Wed Jun 03, 2020 10:08 pm

Joulinar wrote: ↑Wed Jun 03, 2020 7:22 pm Autostart option can be set to 0 : Manual login [default] . No need to have it set to something else. Even on my test it was not switched and still set to 0. Furthermore VNC is running on a different port than xrdp expects. Let's check

Code: Select all

cat /boot/dietpi.txt | grep SOFTWARE_VNCSERVER_DISPLAY_INDEX cat /etc/xrdp/sesman.ini | grep X11DisplayOffset=

Thanks for confirming, I've set the auto start option back to 0. As for the other checks. SOFTWARE_VNCSERVER_DISPLAY_INDEX=1 X11DisplayOffset=10

Anything else I can check?

Joulinar Legend Posts: 7730 Joined: Sat Nov 16, 2019 12:49 am

Post by Joulinar » Thu Jun 04, 2020 12:02 am

ok let's try to pin xrdp to use correct vnc port

Code: Select all

nano /etc/xrdp/xrdp.ini

down, close to the bottom you will find [Xvnc] section. change port=-1 to port=5901. Once done safe the file and restart xrdp

Code: Select all

systemctl restart xrdp.service

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team

danmo117 Posts: 19 Joined: Wed Jun 03, 2020 4:01 pm

Post by danmo117 » Thu Jun 04, 2020 12:27 am

Joulinar wrote: ↑Thu Jun 04, 2020 12:02 am ok let's try to pin xrdp to use correct vnc port

Code: Select all

nano /etc/xrdp/xrdp.ini

down, close to the bottom you will find [Xvnc] section. change port=-1 to port=5901. Once done safe the file and restart xrdp

Code: Select all

systemctl restart xrdp.service

Hi Joulinar, I've completed these steps however I'm still experiencing the same symptoms.

Joulinar Legend Posts: 7730 Joined: Sat Nov 16, 2019 12:49 am

Post by Joulinar » Thu Jun 04, 2020 12:38 am

are you able to get the selection menu where you can choose xvnc?

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team

danmo117 Posts: 19 Joined: Wed Jun 03, 2020 4:01 pm

Post by danmo117 » Thu Jun 04, 2020 10:34 am

Joulinar wrote: ↑Thu Jun 04, 2020 12:38 am are you able to get the selection menu where you can choose xvnc?

Apologies, I'd not removed the "-" from the port number so it stated "=-5901". I've since rectified this and I was able to see the desktop using the Xvnc option from the Xrdp login page. I still have the black screen issue after the initial connection and I seemingly have to wait for the default connection method to time out [which is about 5 minutes] before I can see the Xrdp login page. Please can you advise how to adjust the default connection method so I don't have the black screen issue, and out of curiosity why does the Xorg option not work? Edit, After running through the recreation steps once more, I now cannot access via Xvnc when I could only a few minutes ago. I've changed no settings in that time and the password is 100% correct. See screenshot. Your time is appreciated.

Thanks.

Attachments

Joulinar Legend Posts: 7730 Joined: Sat Nov 16, 2019 12:49 am

Post by Joulinar » Thu Jun 04, 2020 10:59 am

Hi, ok let's try to sort the topics

  1. You need to use Xvnc because you are trying to connect to a VNC server [TigerVNC]
  2. You are not able to reconnect because you are hit by a Debian Bug
    1. //bugs.debian.org/cgi-bin/bugrepo ... bug=932499
    2. //github.com/TigerVNC/tigervnc/issues/800
    3. As far as I have seen some bugfix was created 2 days ago. But I don't know how log it will take before reaching the Debian software package
    4. However there is a workaround described on the Debian Bug tracker

      Code: Select all

      nano /usr/local/bin/vncserver

      Adjust following line by adding LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1

      Code: Select all

      $BINARY_FP :${DISPLAY:-1} -geometry ${WIDTH:-1280}'x'${HEIGHT:-720} -depth ${DEPTH:-16} || exit 1

      like this

      Code: Select all

      LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1 $BINARY_FP :${DISPLAY:-1} -geometry ${WIDTH:-1280}'x'${HEIGHT:-720} -depth ${DEPTH:-16} || exit 1

      save the file and restart the VNC server

      Code: Select all

      systemctl restart vncserver.service

  3. currently I don't know why you a running into the initial 5 minutes timeout. For me it looks like that your xrdp is trying to connect right from the beginning to a Xorg session. But usually it should display the selection screen first.
    Even on my test I was not able to replicate this behaviour.

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team

Video liên quan

Chủ Đề