2

I have had lots of trouble with running a pygame application such as the pre-installed wormy.py (or any application like lxterminal or minecraft-pi) on a Pi from the command-line. This means without entering the Raspbian desktop.

I have tried all the proposed solutions in the (inevitable) linked questions list:

  • From: Running X11 without Window Manager?
    • The screen turns black for a millisecond but immediately returns to the terminal again with a "server terminated successfully" and a "x server connection lost".
  • From: How can I start X11 only for a single application?
    • This is the same as above (pretty much a duplicate but more specific to Chrome). The .xinitrc doesn't appear to have any effect at all.
  • From: Run GUI app from command line
    • This had no effect. Nothing happened at all when running any app.
  • From: Run a GUI without the desktop
    • I did exactly as the accepted answer says from a fresh Raspbian installation but no dice. Also, that ctrl-alt-backspace trick to kill the GUI didn't work to kill the main Raspbian GUI - maybe I misunderstood or missed something?
  • From: Pygame from command line vs GUI
    • This looked promising until I failed to produce the same results and also got confused with the instructions.
  • From: How to set up "kiosk" mode in Raspbian?
    • Although I eventually want to boot directly to a GUI app from startup (without using the desktop!), I want to be able to run a command from the command-line at first, for testing purposes.

Is there any resource that provides a simple-to-follow step-by-step guaranteed-to-work(!) set of instructions on how I can run a GUI application from the command-line without the window manager (i.e. just X)?

Contents of the .xinitrc:

#!/bin/sh

# /etc/X11/xinit/xinitrc
#
# global xinitrc file, used by all X sessions started by xinit (startx)

# invoke global X session script
. /etc/X11/Xsession
exec /usr/share/raspi-ui-overrides/applications/minecraft-pi
Ahmed Tawfik
  • 121
  • 1
  • 3

1 Answers1

1

I believe the first plan suggested will work, but your .xinitrc needs to be setup correctly. When you start an x server, it will go through your .xinitrc file until completion. Once it completes, the x server closes. Normally, when you start a window manager in your .xinitrc, the window manager stays open and the x server does not close. It is likely that you either aren't even starting the pygame (as in there is no "exec "), or the pygame is running to completion allowing the x server to terminate. Perhaps you have an & at the end of the exec line? That would be causing the results you have.

If you want me to assist further, please paste your .xinitrc (found in your home directory).