RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Possible to run an x session through runcommand?

    Scheduled Pinned Locked Moved Help and Support
    startxruncommand
    29 Posts 5 Posters 2.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • quicksilverQ
      quicksilver
      last edited by

      Ive been experimenting lately with compiling and running source ports for games that can be run on raspberry pi. Some of them however seem to run with better performance and more accuracy when run with the command startxor other commands for starting an x session (openra, openrct2, and dhewm3 for example). I have been launching them straight from the terminal successfully, however when I try to set them up to be launched through emulation station and runcommand I get the following error and the game will not load:

      Fatal server error:
      (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
      

      If I remove the startx command the game will launch properly through runcommand but then I have performance and accuracy issues with the game. I am a bit out of my depth with this "x session" stuff but I am anxious to learn if anyone has pointers to share. Thanks in advance!

      BuZzB 1 Reply Last reply Reply Quote 0
      • BuZzB
        BuZz administrators @quicksilver
        last edited by BuZz

        @quicksilver edit the emulators.cfg entry and prefix launch command line with "XINIT:" and runcommand will do the required magic.

        Install lincity-ng and check its config as an example.

        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

        1 Reply Last reply Reply Quote 2
        • quicksilverQ
          quicksilver
          last edited by quicksilver

          Thank you for this! What a simple solution and it works great (I should have asked sooner!). Video mode switching through runcommand works too so I can actually reduce the resolution for better performance and get a full screen image. Only issue Im having is that xinit isnt closing and returning to emulation station properly. When I exit Doom 3 for example the game closes but Im stuck on a blank screen with a cursor. I have to killall xinit through ssh to get back to ES. Any thoughts on what could be the issue or a config I should check? Is it something I may have configured wrong in my setup? Thanks again, I very much appreciate your help.

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            Post your launch command and the runcommand log file, maybe there's a hint there.

            quicksilverQ 1 Reply Last reply Reply Quote 0
            • quicksilverQ
              quicksilver @mitu
              last edited by

              @mitu emulators.cfg:

              dhewm3 = "XINIT:/home/pi/Doom3/dhewm3"
              default = "dhewm3"
              

              runcommand.log
              https://pastebin.com/e0SPrG56

              1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator
                last edited by

                It might be the resolution change command, can you remove any video mode setup and then configure the resolution from the game ? Being that you're running in an X session, doom3 should be able to do a resolution switch by itself.

                quicksilverQ 1 Reply Last reply Reply Quote 0
                • quicksilverQ
                  quicksilver @mitu
                  last edited by quicksilver

                  @mitu I removed the resolution change in runcommand and used just the in game configuration (previously I had both runcommand set to 640x480 and Doom 3 set to 640x480) now the game starts in a small window. I tried exiting the game but unfortunately xinit is still running.

                  Next I tried the same thing but I changed the in game setting from windowed mode to fullscreen mode. This time when I launched the game I saw that it switched to 640x480, but then the screen flickered for a moment and then it launched the game at 1080p and the game window is stuck down in a small window in the corner of the screen. Exiting the game still results with xinit still running.

                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by

                    The log posted shows that X stopped ok, but maybe there are some stray processes left ? Can you check with pstree from a ssh session if there are any processes launched via runcommand that are still running ?

                    quicksilverQ 1 Reply Last reply Reply Quote 0
                    • quicksilverQ
                      quicksilver @mitu
                      last edited by

                      @mitu said in Possible to run an x session through runcommand?:

                      The log posted shows that X stopped ok

                      I have been using ssh to force xinit to close in order to get back to emulation station. Could that be why its showing in the log that closed? Does the runcommand.log generate in real-time or not until after the engine/emulator closes? I will checkpstree now.

                      1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator
                        last edited by

                        @quicksilver said in Possible to run an x session through runcommand?:

                        Could that be why its showing in the log that closed?

                        Probably, the log records the programs' output - it doesn't matter how the program gets its shutdown signal.

                        Does the runcommand.log generate in real-time or not until after the engine/emulator closes?

                        Should be showing messages in 'real-time', there's no buffering or filtering taking place.

                        1 Reply Last reply Reply Quote 0
                        • quicksilverQ
                          quicksilver
                          last edited by

                          Here is the result of pstreeafter closing Doom 3 and when xinit is stuck running

                          pi@pi4:~ $ pstree
                          systemd─┬─agetty
                                  ├─alsactl
                                  ├─avahi-daemon───avahi-daemon
                                  ├─bluetoothd
                                  ├─cron
                                  ├─dbus-daemon
                                  ├─dhcpcd
                                  ├─hciattach
                                  ├─login───bash───bash───emulationstatio───emulationstatio───emulationst+
                                  ├─mono───4*[{mono}]
                                  ├─mount.exfat
                                  ├─nmbd
                                  ├─python3─┬─sh
                                  │         └─2*[{python3}]
                                  ├─rngd───3*[{rngd}]
                                  ├─rsyslogd───3*[{rsyslogd}]
                                  ├─smbd─┬─cleanupd
                                  │      ├─lpqd
                                  │      └─smbd-notifyd
                                  ├─sshd─┬─sshd───sftp-server
                                  │      ├─2*[sshd───sshd───bash]
                                  │      ├─2*[sshd───sshd───sftp-server]
                                  │      └─sshd───sshd───bash───pstree
                                  ├─systemd───(sd-pam)
                                  ├─systemd─┬─(sd-pam)
                                  │         └─dbus-daemon
                                  ├─systemd-journal
                                  ├─systemd-logind
                                  ├─systemd-timesyn───{systemd-timesyn}
                                  ├─systemd-udevd
                                  ├─thd
                                  ├─unattended-upgr───{unattended-upgr}
                                  └─2*[wpa_supplicant]
                          

                          I just configured openrct2 to launch through runcommand using XINIT: and when I close the game I am returned to ES properly. It looks like this might be an issue caused by dhewm3 perhaps?

                          1 Reply Last reply Reply Quote 0
                          • mituM
                            mitu Global Moderator
                            last edited by

                            The right portion of the output is cut, so there's no telling if any processes are there.

                            It's definitely a game issue - try using the +set fs_basepath $HOME/Doom3 parameter and see if you get rid of the warnings in the logs.

                            quicksilverQ 1 Reply Last reply Reply Quote 0
                            • quicksilverQ
                              quicksilver @mitu
                              last edited by quicksilver

                              @mitu like this? dhewm3 = "XINIT:/home/pi/Doom3/dhewm3 +set fs_basepath $HOME/Doom3"

                              When I launch it that way the game fails to load and Im stuck on a black screen.

                              Id also like to report the issue upstream. Is saying that the game is exiting but not the x session enough of a description? Or should I post my logs there as well?

                              mituM 1 Reply Last reply Reply Quote 0
                              • mituM
                                mitu Global Moderator @quicksilver
                                last edited by

                                @quicksilver said in Possible to run an x session through runcommand?:

                                Id also like to report the issue upstream. Is saying that the game is exiting but not the x session enough of a description? Or should I post my logs there as well?

                                Only if using it from a normal desktop session exhibits the same issue. Use startx to start the desktop, then run the game from an xterm/terminal and see if it's the same problem.

                                quicksilverQ 1 Reply Last reply Reply Quote 1
                                • quicksilverQ
                                  quicksilver
                                  last edited by

                                  Thank you again for all your help. I have learned a lot from you guys. I am hoping to continue to learn more, so my next task is to start teaching myself some basic bash scripting in the hopes that I can start putting together some script modules for people to try out. If I am successful at it, I would eventually like to try submitting some pull requests to get them added to retropie. I am curious what the criteria are for getting PRs for new ports accepted? I can understand that the more script modules accepted, the more the maintenance burden becomes for you guys.

                                  1 Reply Last reply Reply Quote 0
                                  • mituM
                                    mitu Global Moderator
                                    last edited by

                                    @quicksilver said in Possible to run an x session through runcommand?:

                                    I am curious what the criteria are for getting PRs for new ports accepted?

                                    Besides the technical aspects of the new script adding the port (correctness, syntax, upstream support, gamepad support), I'm not sure there's a definitive answer to this.

                                    I can understand that the more script modules accepted, the more the maintenance burden becomes for you guys.

                                    Yes, that's true for all additions. It depends on how complicated is the setup/configuration/installation of the Port (emulator). It helps if there is an upstream project that offers support (forums, issues, bug reports, etc.).

                                    1 Reply Last reply Reply Quote 1
                                    • quicksilverQ
                                      quicksilver
                                      last edited by

                                      Just for posterity, if anyone encounters the same issue with dhewm3 not closing properly. You can cntrl-alt-backspace to close the x session and return to emulation station.

                                      1 Reply Last reply Reply Quote 0
                                      • quicksilverQ
                                        quicksilver @mitu
                                        last edited by

                                        @mitu so before I even loaded up the desktop environment I ran dhewm3 through the terminal using the startx command and when I exit the game, the game and x session terminate correctly and take me back to the terminal. I guess in this case it's not likely an upstream issue then right? Are there any other options that I could run with XINIT: to try to get correct closing behavior?

                                        1 Reply Last reply Reply Quote 0
                                        • mituM
                                          mitu Global Moderator
                                          last edited by

                                          @quicksilver said in Possible to run an x session through runcommand?:

                                          I guess in this case it's not likely an upstream issue then right?

                                          No, it doesn't look like it.

                                          Are there any other options that I could run with XINIT: to try to get correct closing behavior?

                                          For runcommand, that's pretty much all the configuration to get a game running via X. Where exactly - in the log file - does the game gets stuck, before you kill it ?

                                          quicksilverQ 1 Reply Last reply Reply Quote 0
                                          • quicksilverQ
                                            quicksilver @mitu
                                            last edited by

                                            @mitu here is the log after I have closed doom 3 but xinit is still running

                                            Hello logfile - runcommand-onstart checking in here
                                            Parameters: 
                                            Executing: xinit /dev/shm/retropie_xinitrc -- vt1 -keeptty
                                            
                                            
                                            X.Org X Server 1.20.4
                                            X Protocol Version 11, Revision 0
                                            Build Operating System: Linux 4.15.0-48-generic armv8l Raspbian
                                            Current Operating System: Linux pi4 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l
                                            Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=64M snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 cma=256M video=HDMI-A-1:1920x1080M@60 smsc95xx.macaddr=DC:A6:32:02:9B:85 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=0096c5d2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait consoleblank=0 plymouth.enable=0 usbhid.mousepoll=0
                                            Build Date: 05 June 2019  12:49:54PM
                                            xorg-server 2:1.20.4-1+rpt1 (https://www.debian.org/support) 
                                            Current version of pixman: 0.36.0
                                            	Before reporting problems, check http://wiki.x.org
                                            	to make sure that you have the latest version.
                                            Markers: (--) probed, (**) from config file, (==) default setting,
                                            	(++) from command line, (!!) notice, (II) informational,
                                            	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
                                            (==) Log file: "/home/pi/.local/share/xorg/Xorg.0.log", Time: Wed Jun 10 12:09:13 2020
                                            (==) Using system config directory "/usr/share/X11/xorg.conf.d"
                                            (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
                                            Set mode 640x480@60Hz on HDMI-1
                                            
                                            Executing (via xinit): SDL_VIDEO_KMSDRM_CRTCID=49 SDL_VIDEO_KMSDRM_MODEID=48 /home/pi/Doom3/dhewm3
                                            
                                            dhewm3 1.5.1pre.1304 linux-armv7l Jun  5 2020 13:34:05 using SDL v2.0.10
                                            Running in background, disabling terminal support.
                                            pid: 16739
                                            1936 MB System Memory
                                            found interface lo - loopback
                                            found interface wlan0 - 192.168.1.175/255.255.255.0
                                            WARNING: base path '/usr/local/share/dhewm3' does not exist
                                            WARNING: using path of executable: /home/pi/Doom3
                                            ----- Initializing File System -----
                                            Loaded pk4 /home/pi/Doom3/base/pak000.pk4 with checksum 0x28d208f1
                                            Loaded pk4 /home/pi/Doom3/base/pak001.pk4 with checksum 0x40244be0
                                            Loaded pk4 /home/pi/Doom3/base/pak002.pk4 with checksum 0xc51ecdcd
                                            Loaded pk4 /home/pi/Doom3/base/pak003.pk4 with checksum 0xcd79d028
                                            Loaded pk4 /home/pi/Doom3/base/pak004.pk4 with checksum 0x765e4f8b
                                            Loaded pk4 /home/pi/Doom3/base/pak005.pk4 with checksum 0x8ffc3621
                                            Loaded pk4 /home/pi/Doom3/base/pak006.pk4 with checksum 0x95b65ab
                                            Loaded pk4 /home/pi/Doom3/base/pak007.pk4 with checksum 0x666bdb3c
                                            Loaded pk4 /home/pi/Doom3/base/pak008.pk4 with checksum 0x23ae5993
                                            Current search path:
                                            /home/pi/.config/dhewm3/base
                                            /home/pi/.local/share/dhewm3/base
                                            /home/pi/Doom3/base
                                            /home/pi/Doom3/base/pak008.pk4 (3 files)
                                            /home/pi/Doom3/base/pak007.pk4 (38 files)
                                            /home/pi/Doom3/base/pak006.pk4 (48 files)
                                            /home/pi/Doom3/base/pak005.pk4 (63 files)
                                            /home/pi/Doom3/base/pak004.pk4 (5137 files)
                                            /home/pi/Doom3/base/pak003.pk4 (4676 files)
                                            /home/pi/Doom3/base/pak002.pk4 (6120 files)
                                            /home/pi/Doom3/base/pak001.pk4 (8972 files)
                                            /home/pi/Doom3/base/pak000.pk4 (2698 files)
                                            Addon pk4s:
                                            ----- Initializing Decls -----
                                            5206 strings read from strings/english.lang
                                            Couldn't open journal files
                                            execing editor.cfg
                                            execing default.cfg
                                            execing dhewm.cfg
                                            couldn't exec autoexec.cfg
                                            5206 strings read from strings/english.lang
                                            ----- Initializing OpenAL -----
                                            Setup OpenAL device and context
                                            OpenAL: found device 'ALSA Default'
                                            OpenAL: found device 'bcm2835 HDMI 1, bcm2835 HDMI 1 (CARD=b1,DEV=0)'
                                            OpenAL: found device 'bcm2835 Headphones, bcm2835 Headphones (CARD=Headphones,DEV=0)'
                                            OpenAL vendor: OpenAL Community
                                            OpenAL renderer: OpenAL Soft
                                            OpenAL version: 1.1 ALSOFT 1.19.1
                                            OpenAL: found extensions for resetting disconnected devices
                                            OpenAL: found EFX extension
                                            OpenAL: found 256 hardware voices
                                            ----- Initializing OpenGL -----
                                            Initializing OpenGL subsystem
                                            Using 8 color bits, 24 depth, 8 stencil display
                                            OpenGL vendor: Broadcom
                                            OpenGL renderer: V3D 4.2
                                            OpenGL version: 2.1 Mesa 19.3.2
                                            ...using GL_ARB_multitexture
                                            ...using GL_ARB_texture_env_combine
                                            ...using GL_ARB_texture_cube_map
                                            ...using GL_ARB_texture_env_dot3
                                            ...using GL_ARB_texture_env_add
                                            ...using GL_ARB_texture_non_power_of_two
                                            ...using GL_ARB_texture_compression
                                            X..GL_EXT_texture_compression_s3tc not found
                                            X..GL_EXT_texture_filter_anisotropic not found
                                            ...using GL_1.4_texture_lod_bias
                                            X..GL_EXT_shared_texture_palette not found
                                            ...using GL_EXT_texture3D
                                            ...using GL_EXT_stencil_wrap
                                            ...using GL_EXT_stencil_two_side
                                            ... got GL2.0+ glStencilOpSeparate()
                                            ...using GL_ARB_vertex_buffer_object
                                            ...using GL_ARB_vertex_program
                                            ...using GL_ARB_fragment_program
                                            X..EXT_depth_bounds_test not found
                                            ARB2 renderer: Available.
                                            ----- R_ReloadARBPrograms -----
                                            glprogs/test.vfp
                                            glprogs/test.vfp
                                            glprogs/interaction.vfp
                                            glprogs/interaction.vfp
                                            glprogs/bumpyEnvironment.vfp
                                            glprogs/bumpyEnvironment.vfp
                                            glprogs/ambientLight.vfp
                                            glprogs/ambientLight.vfp
                                            glprogs/shadow.vp
                                            glprogs/environment.vfp
                                            glprogs/environment.vfp
                                            glprogs/arbVP_glasswarp.txt: File not found
                                            glprogs/arbFP_glasswarp.txt: File not found
                                            using ARB_vertex_buffer_object memory
                                            using ARB2 renderSystem
                                            loaded game library '/home/pi/Doom3/base.so'.
                                            ----- Initializing Game -----
                                            gamename: baseDOOM-1
                                            gamedate: Jun  5 2020
                                            Initializing event system
                                            ...473 event definitions
                                            Initializing class hierarchy
                                            ...142 classes, 382184 bytes for event callbacks
                                            Initializing scripts
                                            Compiled 'weapon_rocketlauncher': 1263 ms
                                            ----- Compile stats -----
                                            Memory usage:
                                                 Strings: 79, 12592 bytes
                                              Statements: 67875, 1357500 bytes
                                               Functions: 2109, 250532 bytes
                                               Variables: 147376 bytes
                                                Mem used: 2579384 bytes
                                             Static data: 2477552 bytes
                                               Allocated: 3484640 bytes
                                             Thread size: 13212 bytes
                                            ...6 aas types
                                            ----- Initializing Session -----
                                            ----- Warnings -----
                                            during dhewm 3 initialization...
                                            WARNING: base path '/usr/local/share/dhewm3' does not exist
                                            WARNING: using path of executable: /home/pi/Doom3
                                            2 warnings
                                            ----- Game Map Shutdown -----
                                            Shutting down sound hardware
                                            idRenderSystem::Shutdown()
                                            Shutting down OpenGL subsystem
                                            ----- Game Shutdown -----
                                            ----- Game Map Shutdown -----
                                            Shutdown event system
                                            
                                            mituM R 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.