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

    Error and GUI terminates back to ES when launching RetroPie-Setup direct on machine (libudev?) - but SSH is ok

    Scheduled Pinned Locked Moved Help and Support
    retropie-setuplibudevubuntussh
    41 Posts 6 Posters 4.6k 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.
    • P
      psyke83 Global Moderator @movisman
      last edited by

      @movisman said in Error and GUI terminates back to ES when launching RetroPie-Setup direct on machine (libudev?) - but SSH is ok:

      @psyke83

      Hey there - thanks for the reply, I actually already just tried points 1 and 3 about ten minutes ago to no avail, but let me try point 2 and will come back to you.

      Seems odd there is another thread which I linked above experiencing the same issue.

      Will let you know in a sec.

      Cool. If you are able to reproduce the issue by hurriedly performing the steps, then perhaps systemd has not finished initializing all of the udev-related services properly. The error you're seeing is definitely coming from the joy2key.py script -- but there haven't been any changes to the file in about a year, so it's likely an issue unique to your installation.

      M 1 Reply Last reply Reply Quote 0
      • M
        movisman @psyke83
        last edited by

        @psyke83

        So, I tried all of the above but unfortunately no change.

        One thing I do want to mention, is that beforehand when I was having mixed success (when the error I pasted above sometimes appeared) - since reinstalling python-pyudev it hasn't worked once since, and i've not seen that error again either. This could be a red herring though. When I retry, RetroPie-Setup just shows it's GUI for a second, then crashes out. Same for config editor, show ip - however runcommand, bluetooth, es-themes will launch without crashing.

        It was all working ok but I did install some general OS updates this evening and update the setup script.

        The other thread I linked does describe a very similar thing and that user is also 18.04.1 and sounds like a similar setup.

        Any other ideas?

        Thanks a lot!

        1 Reply Last reply Reply Quote 0
        • P
          psyke83 Global Moderator
          last edited by psyke83

          Do you see error message if you manually launch joy2key?

          Thsis should be enough:
          /opt/retropie/supplementary/runcommand/joy2key.py /dev/input/js0 kcub1 kcuf1 kcuu1 kcud1 0x0a 0x09

          (This should be able to launch with or without a controller connected, but you shouldn't expect to see any output either way).

          Perhaps a recent update (perhaps a backport, if you've enabled that channel) has caused a python compatibility issue?

          M 2 Replies Last reply Reply Quote 0
          • M
            movisman @psyke83
            last edited by

            @psyke83

            Without a controller connected, I don't get any error messages straight away, the cursor just sits there, which I guess is expected.

            If I switch on my Xbox One controller (no keyboard plugged in) and run again, I don't get any error messages, same happens, however when I push certain buttons (not A/B/X/Y) but others like the d-pad or shoulders I get something like this:

            pi@retropie-pc:~/RetroPie-Setup$ ./scriptmodules/supplementary/runcommand/joy2key.py /dev/input/js0
            Traceback (most recent call last):
              File "./scriptmodules/supplementary/runcommand/joy2key.py", line 269, in <module>
                if process_event(event):
              File "./scriptmodules/supplementary/runcommand/joy2key.py", line 207, in process_event
                hex_chars = axis_codes[3]
            IndexError: list index out of range
            

            The line can differ depending on button pressed.

            FYI, I don't believe I have any backports enabled, the python-pyudev version I have installed is:

            pi@retropie-pc:~/RetroPie-Setup$ apt list python-pyudev 
            Listing... Done
            python-pyudev/bionic,now 0.21.0-1 all [installed]
            

            Running /etc/apt/sources.list I get only these:

            deb http://archive.ubuntu.com/ubuntu bionic main universe
            deb http://archive.ubuntu.com/ubuntu bionic-security main universe
            deb http://archive.ubuntu.com/ubuntu bionic-updates main universe
            

            No backports there? I do have a feeling perhaps some sort of update has caused a compatibility issue maybe, but I am not sure.

            Thanks a lot!

            1 Reply Last reply Reply Quote 0
            • M
              movisman @psyke83
              last edited by movisman

              @psyke83

              Now, randomly, it is back at the state where it will produce the error I mentioned earlier at the base of the retropie_setup.sh GUI, which is constant, however if I drop out of ES to a terminal and run retropie_setup.sh that way, on first launch it fails, but subsequent attempts it then works. One you finally get in, controls are still totally messed up like the other thread mentions, when using the controller to navigate.

              Such a weird problem this. Really have to hit the sack in the next 30 minutes as it's so late in the UK now, but will continue any recommendations you have as soon as I pick them up.

              Cheers for all the help so far.

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

                I have an Ubuntu VM for testing and I see the same behavior - the setup starts, but quickly exits, without doing anything. I'm not sure if it's the same problem, since I don't see the message you reported.
                Btw, running joy2key without any arguments like you did - it's probably ok if you're getting that error.

                What's funny is that if I start the setup script from a simple xterm (and not Gnome Terminal), then the setup script functions normally. Can you try doing the same to see if maybe the terminal is to blame ?

                EDIT: it seems that even if setup works fine from an empty xterm, but if I start ES from the xterm and then access the setup it still doing the same thing - so scratch the test. But for now I know it's not from gnome-terminal.

                M 1 Reply Last reply Reply Quote 0
                • M
                  movisman @mitu
                  last edited by

                  @mitu

                  Hey,

                  Thanks for the reply. Bit of a classic, stayed up so late trying to resolve the issue I was a bit late for work - whoops!

                  That was a really interesting theory with the terminal - I didn't think of trying that. I saw your message this morning and planned to test but then saw your edit, so I haven't done anything with it yet as it doesn't sound terminal related.

                  I am glad you were able to replicate it though, at least it means it is not likely to be something with my setup, also that other thread sounds like a similar thing - I am pretty meticulous about keeping my Ubuntu instance clean for RetroPie - the little machine it runs off doesn't actually do anything else but run Ubuntu Server with RetroPie on top, plus all the emus of course. So it has minimal apps on it as a whole really, and anything I do install which is temporary, I do try to remove as I go.

                  Thanks

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

                    @movisman Yeah, the thing is I don't get the error with

                    Exception AttributeError: "'Context' object has no attribute '_libudev'" in <bound method Context.__del__ of <pyudev.core.Context object at 0x7fb309ef6d50>> ignored
                    

                    but I also don't have a controller installed (it might appear only when a controller is connected ?). I also never started the setup script from ES until now, since it's a test VM for me, so I'm not sure if it's an error that was there from the beginning or just started to happen.

                    I'll keep poking at it - eventually I can test in a real Ubuntu install in the week-end.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      movisman @mitu
                      last edited by

                      @mitu

                      One thing to note, is I don't always get that error either.

                      It is either one or the other, but it doesn't jump between producing an error or not. What I mean, is last night I tried it 20x times and didn't get a single error, it would just load then crash like what you are seeing. Yet on another boot or combination the error would then appear consistently.

                      You might be right about the controller thing, the Xbox One controller powers off itself after 15 minutes or so and that could be a factor.

                      Regarding when I first saw the error, I think it was a few weeks back I noticed it, but once I had updated the setup script, it seemed to go away, or so I thought. I've not seen it since (but to be fair I haven't really been into setup via ES) until last night, when I noticed issues straight after doing an apt get upgrade to grab a handful of OS updates, and updating my setup-script so I could update Retroarch to 1.7.6. I then noticed while I was working on changes to the Chiceulo theme. The fact the controls are totally messed up (when it does load) is new thing too, just like is mentioned in the other thread.

                      Just to clarify though, I have had the Ubuntu Server 18.04.1 instance running since November and this was not an issue up until recently.

                      If you need me to extract or test anything at all, just let me know. Keen to get it resolved but it's a real strange issue, let me know if you find anything.

                      I tagged Jools earlier in the thread as I think he has an Ubuntu instance also, however i'm not sure if it's 16.04/18.04/18.10 or even if he actually still has one. I know he is forever getting bombarded with issues so I won't chase him up. However if you guys have any dialog between yourselves maybe it's worth mentioning to see if he can replicate it also.

                      Thanks for all the help so far!

                      1 Reply Last reply Reply Quote 0
                      • P
                        psyke83 Global Moderator
                        last edited by

                        I can't reproduce the issue, but I do have a few suggestions to help troubleshoot.

                        I added some debugging to my script, and ran it manually with these arguments:
                        /opt/retropie/supplementary/runcommand/joy2key.py /dev/input/js0 0x00 0x00 kich1 kdch1 0x20 0x71

                        It's clear that the get_button_codes function (which is the only function that utilizes the pyudev's Context()) will not be called if there's no device present (in this case, /dev/input/js0).

                        So, try the above command while your controller is connected (making sure to substitute the device name for your actual controller, if it's different).

                        If the script works correctly, nothing will display, but pressing buttons on your controller will trigger control codes to print on the terminal.

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

                          @psyke83 How does the script work without a joystick present ? In my tests I only have a keyboard (mapped as a gamepad in ES) and it's randomly failing or working - similar to how @movisman experienced - and it doesn't matter if it's started from ES or not.

                          The failure is 'consistent' - if it fails once, then it will fail again until either I restart ES or the terminal I'm using to start it.

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

                            It's strange as even if the joy2key fails, it shouldn't cause retropie_setup to exit.

                            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 0
                            • BuZzB
                              BuZz administrators
                              last edited by

                              Might be worth checking if there is anything additional logged in logs/ after it quits.

                              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 0
                              • mituM
                                mitu Global Moderator
                                last edited by

                                It manifests as you press Cancel on the dialog page. @psyke83 can you share your modifications to the script that prints the event codes ? I can repeat the tests tomorrow (I don't have right now access to the Ubuntu machine I was testing today) and see if something is logged.
                                My next line of test would be also to change the DE to something simpler.

                                @buzz In my tests, there's nothing logged, although I see the setup menu screen briefly before closing in.

                                BuZzB P 2 Replies Last reply Reply Quote 0
                                • BuZzB
                                  BuZz administrators @mitu
                                  last edited by

                                  @mitu can you roll back retropie-setup a year and see if that makes a difference ? If so, it's worth bisecting. Just to rule out something in the script triggering it (eg the way we changed how we trap errors and output logs)

                                  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

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

                                    @BuZz I can do that - will try this avenue also. I guess you're thinking of this.

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

                                      @mitu Yes. I don't see why it should be but it's worth a go I guess.

                                      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 0
                                      • P
                                        psyke83 Global Moderator @mitu
                                        last edited by

                                        @mitu said in Error and GUI terminates back to ES when launching RetroPie-Setup direct on machine (libudev?) - but SSH is ok:

                                        It manifests as you press Cancel on the dialog page. @psyke83 can you share your modifications to the script that prints the event codes ? I can repeat the tests tomorrow (I don't have right now access to the Ubuntu machine I was testing today) and see if something is logged.
                                        My next line of test would be also to change the DE to something simpler.

                                        @buzz In my tests, there's nothing logged, although I see the setup menu screen briefly before closing in.

                                        No modifications are needed to print codes - the arguments supplied will map axis and face buttons to keyboard codes. So if you use the arguments I listed in my other reply, pressing up/down/left/right will trigger codes on the terminal.

                                        The debug code I was referencing was merely to print some text in the beginning of get_button_codes; the function will not trigger when the device is not present. I even commented out the from pyudev import Context line, and the script won't complain about pyudev being unavailable if the controller/device is not present.

                                        P.S. Not sure if it was mentioned yet, but @buzz made changes to the script so that joy2key doesn't execute in an SSH session, so you should test the RetroPie script for this issue on a native framebuffer or terminal in a X session.

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

                                          @psyke83 said in Error and GUI terminates back to ES when launching RetroPie-Setup direct on machine (libudev?) - but SSH is ok:

                                          P.S. Not sure if it was mentioned yet, but @buzz made changes to the script so that joy2key doesn't execute in an SSH session, so you should test the RetroPie script for this issue on a native framebuffer or terminal in a X session.

                                          I know, and actually @movisman reported the same thing - running the script via SSH is always fine. My testing was always in the X11 terminal (independent or started from ES) - I don't think there's a framebuffer option for Ubuntu PC (?).

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            movisman
                                            last edited by

                                            Hi all,

                                            Thanks everyone for stepping in to work this issue out. I am away from home this evening as I have plans, however I'll be back in a couple of hours so if you want me to run some tests let me know.

                                            SSH is always working perfectly, it's just via terminal on the machine directly or when it's called within ES. I will add, that on the rare occasions it does load (which hasn't happened for a bit now), it will work consistently until I reboot, but the controls are also messed up on the controller within the GUI (not ES), like the person mentioned on that other thread. Mostly though it just doesn't work and chucks you straight back around a second after the screen content loads (controls don't work at all for that brief moment)

                                            Cheers

                                            1 Reply 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.