I recently setup VNC Viewer both on my Pi (3b+) and my laptop (Ubuntu 16.04 LTS). Using Stretch Lite. Installed lightdm. Using RealVNC. Followed the guide on raspberrypi.org

After I connect to the Pi using VNC it asks for username and password

I have never change the username or password to my pi so I enter the default ones and login is successful but then the VNC Says cannot show Desktop and returns back to the login screen

What to do ?

  • Presumably because the Pi doesn’t have a Desktop.
    – Milliways
    Feb 25, 2019 at 21:27
  • Then how do I get one @Milliways Feb 25, 2019 at 21:32
  • You have to boot to GUI, or run startx on the Pi. Due to the way RealVNC works the Desktop wll be small if no screen attached, you need to set default size. See raspberrypi.stackexchange.com/a/94052/8697 or raspberrypi.stackexchange.com/a/93278/8697
    – Milliways
    Feb 25, 2019 at 22:50
  • If you want informed Answers you should include detail of what you did in your question not in Comments. As it stands this question is too vague, and only encourages speculation.
    – Milliways
    Feb 26, 2019 at 3:58

2 Answers 2


If your Pi has no physical display but you want to force it to create a graphical desktop environment, edit /boot/config.txt (as root).

In that file, look for hdmi_force_hotplug=1 and make sure that line is not commented (remove the '#'). Then reboot.

  • This will NOT start a Desktop, merely force HDMI output.
    – Milliways
    Feb 26, 2019 at 0:30
  • You would need packages for X11 & related desktop ... but this would be the default if you were to install the typical Raspbian (non-lite) image. Another way to think about it... if the Pi were connected via HDMI to a display, would it create a desktop in those conditions? If no, then something else is mis-configured. If yes, then /boot/config.txt will likely resolve the issue. Feb 26, 2019 at 1:25

As mentioned, VNC requires some X11 stuff to be installed. Perhaps you could describe your configuration: Lite vs Full vs Noobs vs ???, what desktop-related packages you have installed, what display manager (lightdm vs kdm vs xdm, etc).

Finally, what VNC server software did you install on the Pi? There is RealVNC (which comes installed as part of Stretch Full, I believe), and TigerVNC. Maybe TightVNC also. And, with a few of these there are multiple ways to start and use them.

  • Using Stretch Lite. Installed lightdm. Using RealVNC. Followed the guide on raspberrypi.org Feb 26, 2019 at 3:39
  • RealVNC (default in Raspbian) DOES NOT require ANYTHING to be installed. It does require that you use the RealVNC Viewer on clients. Even tightvnc DOES NOT require anything, but only displays a Virtual Desktop.
    – Milliways
    Feb 26, 2019 at 3:52
  • Tanmay, as I read the docs, Stretch 'Lite' doesn't include a desktop. LightDM is a display manager and will start X11... but it doesn't install X11 for you. If you do not have X11 installed, you'll need that. X11 is very generic, but requires some type of window-manager or display-manager to be useful. See: wiki.debian.org/Xorg Feb 26, 2019 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.