I am trying to start the desktop with Raspbian Stretch, but I'm not able to run startx.

I install: RASPBIAN STRETCH WITH DESKTOP from https://www.raspberrypi.org/downloads/raspbian/

and then:

sudo raspi-config

I2C: enable, SSH: enable

localisation: prague

hostname: opensprinkler

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install git // github
sudo apt-get install mc // midnight commander
sudo apt-get install i2c-tools // for support I2C
sudo apt-get install python-smbus // for smbus support 

(I followed the instructons from here)

When I type startx, I get back:

bash-: startx command not found

Please do you have any suggestions?

(I want to continue with OpenSprinkler)

  • 1
    Odd, I thought the GUI started automatically with Raspbian. Are you absolutely sure this is the desktop version? Is there any output from dpkg -l | grep raspberrypi-ui-mods?
    – Aurora0001
    Jun 9, 2018 at 9:24
  • 1
    I am not 100% sure because I download by mistake both version :( Pls how can I see which Version I installed?
    – palo
    Jun 9, 2018 at 11:30
  • @palo Please try running the command I gave you; it'll tell you whether the Pi has the GUI package installed as expected (if there's no output, the GUI isn't installed)
    – Aurora0001
    Jun 9, 2018 at 11:58
  • here webshare.cz/#/file/5qg4cl5c24 you can see photo. (how can I copy or send linux text from raspberry to mail or windows?)
    – palo
    Jun 9, 2018 at 12:04
  • @Aurora0001 here is webshare.cz/#/file/3G13zd78z7 photo of my screen. it is ok?
    – palo
    Jun 9, 2018 at 12:13

2 Answers 2


The fact that dpkg -l | grep raspberrypi-ui-mods doesn't output anything indicates that you probably do not have the desktop version installed. You certainly don't have the default Raspbian PIXEL packages on your system.

Since you have no GUI, you don't have startx either. The GUI starts automatically on the full version of Stretch with Desktop, so it is another suspicious sign that no GUI starts on your installation.

You can either:

  • -- I tried: Adding GUI -- sudo apt-get install -y raspberrypi-ui-mods rpi-chromium-mods sudo reboot -- ok? -- and result from my screen :( webshare.cz/group/4sC177Lk64
    – palo
    Jun 9, 2018 at 13:39
  • Try running sudo apt-get -y install xinit too, that package definitely contains startx.
    – Aurora0001
    Jun 9, 2018 at 13:40
  • :( webshare.cz/#/file/7f1Y0zl2fe unable to fetch some archives. how can I try ... with --fix missing?
    – palo
    Jun 9, 2018 at 13:54
  • @palo "Temporary failure resolving ..." sounds like a potential network issue; is your network working normally?
    – Aurora0001
    Jun 9, 2018 at 14:40
  • yes! exactly network. Thank you! Cable Network was interrupted. Now after: startx webshare.cz/group/7h31l02pv1 -- how can I continue to start webrowser? -- Then I will follow the instructons from: pihrt.com/elektronika/248-moje-rapsberry-pi-zavlazovani-zahrady -*- RaspbianStretchLiteOSPy_7_9_2017.img
    – palo
    Jun 9, 2018 at 14:47

I've run into this problem not because I wanted startx, but because startlxde caused cannot open DISPLAY error.

To solve that, just install the package that contains startx with the command:

 apt-get install xinit

and then use startx instead of startlxde.

You might need to configure your ~/.xinitrc.

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.