Desktop issue with startx not working

What is the problem?

I've installed octoprint and everything works fine in the terminal however I want to use the desktop view occasionally as well but not permanently so I installed the desktop using the built in sudo /home/pi/scripts/install-desktop and set it to no for auto boot into desktop however when I run startx in the terminal the command isn't found and I can't boot into the desktop any help would be appreciated!

1 Like

I noticed this myself recently. I have a Raspberry Pi that was installed with the OctoPi image, ran the script you mentioned and like you, said "no" to the autoboot. There's no startx script in the path.

What I would do in a case like this would be to "go to school" on the raspi-config script itself. If you did select boot -> autoboot to Desktop as pi from that menu then it would do something behind-the-scenes to change something. I would first do a which raspi-config to find out where it lives, then a nano somepath/raspi-config using the information that I'd just found.

I would then review the contents of that rather large script and find out what happens when I might select that option from the menu. It will likely put something in one of the configuration files that kickoff during bootup. I may do this later but I've just shutdown my Raspi so I'll let you do a little detective work first.

Update: It may be necessary to run sudo apt-get -y install xinit

I know this is pretty old, but was there ever any resolution? I'm wanting the same thing as the OP, to be able to use the GUI on occasion when I'm not printing anything, but don't see how to launch it manually.

I just did my 1st Octoprint setup yesterday and did the upgrade via the web interface so I should be at the most current version.

Following the last reply, I found the correct raspi-config in /usr/bin and did a search for "desktop". I found several references to lightdm, but don't seem to have it actually installed, even after running the install script multiple times.

The 1st instance shows a line 'pointing' to /etc/lightdm/lightdm.conf but that directory doesn't exist.

The next is the "menu" and following the choices, I see there are paths to /etc/init.d/lightdm but that doesn't exist either.

Would I be safe in assuming the desktop installation script is 'broken'? I'm not seeing any error messages when it runs...

I'm not averse to more digging, just need to know where to point my shovel next.

Thx!

[EDIT] For giggles, I ran raspi-config and selected boot to desktop and require user login. I was met with a message to install lightdm - so I did. Rebooted and the GUI came up, however, it won't let me log in. No errors, just goes blank and kicks me right back to the login screen..

I had to SSH in and set start to CLI to gain access again.

Still no 'startx' though.

Like I said, you might want to try that.

Solved, but not quite sure how... I can now start/stop the GUI at will.

From my initial Octopi/Octoprint install, I did all the OS updates, installed lightdm, installed Xinit and tried sudo startx. Desktop started, but with no menu and only a terminal window open telling me Octoprint was running.

Did sudo /home/pi/scripts/install-desktop again, but this time I chose boot to desktop with auto login instead of opting not to.

Desktop came right up. I opened a terminal window and did sudo raspi-config again and set it to boot to CLI with auto login. As soon as it rebooted, I just typed startx and voila! Desktop came right up.

Exited to command prompt and all is good!

2 Likes

You forgot to mention that the desktop install took a long time. ha Yeah, there's lot of stuff packed into that.

Myself, I'm running a lean version of the x windows system on a kiosk-style project. Kivy needs access to an x windows system but I don't want the desktop and all its burden. It took a while but I managed to make that work. In my case, I used nodm, having installed the bare minimum...

sudo apt-get -y install xserver-xorg libpam0g-dev help2man libx11-dev debhelper
1 Like

This whole thing took a long time.. I haven't done anything "Linux" in a LONG time, so I had to dig deep into the memory banks and make a few attempts to get it all working.

Thx for the assist!

1 Like