hissingshark / retrOSMCmk2

RetroPie installer for OSMC on the RPi, Vero4k/4K+ and the VeroV
GNU General Public License v2.0
34 stars 7 forks source link

Install fails on latest OSMC 2022.09-1 on Pi3 #21

Closed workingmanrob closed 1 year ago

workingmanrob commented 1 year ago

I do use an NFS root for my OSMC installs so I am going to try a regular install to SD card today to see if I have better luck but I had errors about mupen64plus not installing and the kodi addon fails to launch. It does seem like emulation station installed ok as I was able to exit kodi and launch that directly via the shell script.

Will update with error messages as fast as I can generate them.

workingmanrob commented 1 year ago

./setup.sh: line 129: /tmp/app-switcher.fifo: Permission denied

  echo "dump" > $FIFO &
  sleep 0.1                
  session_count=$(cat $FIFO)

Right now there are definitely no sessions because I have nothing installed yet so after a ctrl-c I remove that blurb and set

  session_count=0

and the setup was able to proceed.

~/retrOSMCmk2$ ls -la /tmp/app-switcher.fifo 
prw-r--r-- 1 osmc osmc 0 Oct 10 14:24 /tmp/app-switcher.fifo
workingmanrob commented 1 year ago

sdl2 install failed with the hard coded version so I hard coded a new version.

vi submodule/RetroPie-Setup/scriptmodules/supplementary/sdl2.sh

change 2.0.10 -> 2.0.20

function get_ver_sdl2() {
    echo "2.0.20"
}
workingmanrob commented 1 year ago

And the sdl2 build also fails due to missing package that will be installed later but too late for sdl2.

dpkg-buildpackage: info: source version 2.0.20+5rpi
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by Jools Wills <buzz@exotica.org.uk>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture armhf
dpkg-checkbuilddeps: error: Unmet build dependencies: libsamplerate0-dev

Build of mupen64plus pulled it in so I am trying again.

$ sudo apt install libsamplerate0-dev
libsamplerate0-dev is already the newest version (0.2.1+ds0-1).
workingmanrob commented 1 year ago

This is where the mupen64 build bombs out on me.

../../src/Combiner.cpp: In member function ‘UpdateCombiner’:
../../src/DecodedMux.h:53:19: note: at offset 0 to object ‘aRGB0’ with size 1 declared here
   53 |             uint8 aRGB0;
      |                   ^
g++: fatal error: Killed signal terminated program lto1
compilation terminated.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [Makefile:469: mupen64plus-video-rice.so] Error 1
make: Leaving directory '/home/osmc/retrOSMCmk2/submodule/RetroPie-Setup/tmp/build/mupen64plus/mupen64plus-video-gles2rice/projects/unix'
current revision "2973f53"
last build revision 
/home/osmc/retrOSMCmk2/submodule/RetroPie-Setup/tmp/build/mupen64plus/GLideN64/projects/cmake /home/osmc/retrOSMCmk2/submodule/RetroPie-Setup/tmp/build/mupen64plus /home/osmc/retrOSMCmk2

and still it builds... slowly

workingmanrob commented 1 year ago

And the ncurses screen wouldn't let me copy this text.. which is annoying.

Could not successfully build mupen64plus - N64 emulate MUPEN64Plus
(mupen64plus-video-gles2rice/projects/unix/mupen64plus-video-rice.so not found).
workingmanrob commented 1 year ago

Finally testing the addon to launch retropie and things are working.

Configured the basic settings for the addon and tried to launch. No sign of life except a message in the kodi.log

2022-10-10 23:37:46.876 T:870      INFO <general>: initializing python engine.
2022-10-10 23:37:48.656 T:870      INFO <general>: retrOSMCmk2 Launcher: "/home/osmc/.kodi/userdata/addon_data/script.launch.retropie/data.xml" missing or corrupt on this run

Tried a blank file and then it just complained it couldn't parse it.

2022-10-10 23:41:13.198 T:918     ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'xml.etree.ElementTree.ParseError'>
                                                   Error Contents: no element found: line 1, column 0
                                                   Traceback (most recent call last):
                                                     File "/home/osmc/.kodi/addons/script.launch.retropie/addon.py", line 286, in <module>
                                                       data_file = ET.parse(DATA)
                                                     File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1229, in parse
                                                       tree.parse(source, parser)
                                                     File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 580, in parse
                                                       self._root = parser._parse_whole(source)
                                                   xml.etree.ElementTree.ParseError: no element found: line 1, column 0
                                                   -->End of Python script error report<--

2022-10-10 23:41:13.267 T:918      INFO <general>: Python interpreter stopped

data.xml apparently got created when I enabled a gamepad hotkey exit but now the addon only throws this in the log: INFO <general>: initializing python engine. but still no launch button.

workingmanrob commented 1 year ago

I noticed the data.xml file also had a changelog date value <changelog-date>2022-10-10</changelog-date>

Tried to use the check for updates option in the addon settings page and that crashed kodi.

2022-10-11 00:44:25.705 T:932     ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ValueError'>
                                                   Error Contents: invalid literal for int() with base 10: 'hangelog read'
                                                   Traceback (most recent call last):
                                                     File "/home/osmc/.kodi/addons/script.launch.retropie/addon.py", line 427, in <module>
                                                       slots_master = int(labels_master.pop(0))
                                                   ValueError: invalid literal for int() with base 10: 'hangelog read'
                                                   -->End of Python script error report<--

2022-10-11 00:44:25.772 T:932      INFO <general>: Python interpreter stopped

actually it was the second run that crashed kodi and the error changes slightly

2022-10-11 00:44:49.879 T:958   WARNING <general>: CPythonInvoker(4): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
2022-10-11 00:44:52.288 T:940     ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: function takes at most 5 arguments (6 given)
                                                   Traceback (most recent call last):
                                                     File "/home/osmc/.kodi/addons/script.launch.retropie/addon.py", line 758, in <module>
                                                       view = dialog.yesno("retrOSMCmk2", "An new update to the addon is available.\n", "\n", "View changelog or Ignore it for now?", "Ignore", "View")
                                                   TypeError: function takes at most 5 arguments (6 given)
                                                   -->End of Python script error report<--

I can see some pretty obvious errors but I'm not great at python so I will not likely be able to fix it.

int() with base 10: 'hangelog read' < oops

workingmanrob commented 1 year ago

I made an attempt using 2to3 today since the addon works on my buster install but fails on bullseye (which does not have python2)

Still no joy. Seems like all the problems stem from the fast-switching stuff that I can't use anyway since I'm on a Pi3.

I did have to fix some sudo errors but emulation station launches from the command line just fine after I did that.

markferry commented 1 year ago

'Invalid literal for base 10' is usually around where the script is trying to read data from the app-switcher fifo.

See the app-switcher journal:

$ journalctl -u app-switcher
...
Oct 25 20:49:40 lounge app-switcher.sh[29664]: /home/osmc/RetroPie/scripts/app-switcher.sh: line 177: /tmp/app-switcher.fifo: Permission denied

Recent kernels (4.19+) don't allow a user (even root) to write to files owned by another user in /tmp.

$ ls -l /tmp/app-switcher.fifo
prw-r--r-- 1 osmc osmc 0 Oct 25 20:48 /tmp/app-switcher.fifo

Because app-switcher.service runs as root you can workaround this by giving root ownership of the fifo and allowing the osmc group to write to it:

sudo chown root:osmc /tmp/app-switcher.fifo
sudo chmod 660 /tmp/app-switcher.fifo

(Your security concerns are your own!)

workingmanrob commented 1 year ago

I'll give that a try as soon as I get a chance and let you know how it goes.

Did a fresh osmc install so it will be a while before I know.

And I did figure out any build issues were just retropie problems and have nothing to do with the appswitch issue here in osmc.

workingmanrob commented 1 year ago

That worked a treat - and since I have no security concerns whatsoever - I just need to figure out how to make that change survive a reboot. Pretty sure this mod to RetroPie/scripts/app-switcher.sh will do just that.

  #sudo -u osmc mkfifo $FIFO                                   
  mkfifo $FIFO    
  chgrp osmc $FIFO                                                            
  chmod 660 $FIFO

and it did too. Thanks @markferry !!

markferry commented 1 year ago

Perhaps a more canonical way to manage service FIFOs is with a SystemD socket unit. SystemD takes care of creation and cleanup.

Here's an example: https://serverfault.com/a/823973

workingmanrob commented 1 year ago

I'll try that after I get mupen64 to build... just figured out how to get mupen64plus-video-rice.so which is where it was bombing out on me.

markferry commented 1 year ago

mupen64 dies for me too. I didn't bother much since I don't happen to have any N64 ROMs

a SystemD socket unit

I meant that for @hissingshark, but I'm sure they'd appreciate a pull request all the same ;)

markferry commented 1 year ago

And the ncurses screen wouldn't let me copy this text.. which is annoying.

Could not successfully build mupen64plus - N64 emulate MUPEN64Plus
(mupen64plus-video-gles2rice/projects/unix/mupen64plus-video-rice.so not found).

This is the link failure that results from the earlier compilation failure:

../../src/Combiner.cpp: In member function ‘UpdateCombiner’: ../../src/DecodedMux.h:53:19: note: at offset 0 to object ‘aRGB0’ with size 1 declared here 53 | uint8 aRGB0; | ^ g++: fatal error: Killed signal terminated program lto1

Unfortunately I think you're missing a few lines before that. Looks like a low-priority GCC warning (a note) which is being treated as an error.

markferry commented 1 year ago

(Slightly) relevant: RetroPie/RetroPie-Setup#767

Given the age of some of the upstream issues either RetroPie-Setup's mupen64plus is very old, or recent gcc is now stricter. (I think it's the latter...)

workingmanrob commented 1 year ago

hmmm well I was able to build rice video with a minor flag change but I'm not sure where to drop that to make the whole mupen build complete correctly.

All I had to do was cd to RetroPie-Setup/tmp/build/mupen64plus/mupen64plus-video-gles2rice/projects/unix

LDFLAGS=-fno-lto make all

dropped the flag into the Makefile in that folder too but the mupen build still bombed. ¯_(ツ)_/¯

workingmanrob commented 1 year ago

So my latest successful build had some extra steps including an extra package needed to build sdl2

sudo apt install git libsamplerate0-dev git clone https://github.com/hissingshark/retrOSMCmk2.git

  1. create the fifo file before starting sudo mkfifo /tmp/app-switcher.fifo sudo chgrp osmc /tmp/app-switcher.fifo sudo chmod 660 /tmp/app-switcher.fifo
  2. cd retrOSMCmk2 sudo ./setup.sh and modify the RetroPie/scripts/app-switcher.sh script like in the post above

    sudo -u osmc mkfifo $FIFO

    mkfifo $FIFO
    chgrp osmc $FIFO
    chmod 660 $FIFO

  3. before running Retropie-Setup modify sdl2.sh version changing 2.0.10 -> 2.0.20 sudo vi ~/retrOSMCmk2/submodule/RetroPie-Setup/scriptmodules/supplementary/sdl2.sh
  4. when it starts building mupen64plus replace the mupen64plus-video-gles2rice with the version from https://github.com/mupen64plus/mupen64plus-video-rice/releases/tag/2.5.9 wget https://github.com/mupen64plus/mupen64plus-video-rice/releases/download/2.5.9/mupen64plus-video-rice-src-2.5.9.tar.gz cd ~/retrOSMCmk2/submodule/RetroPie-Setup/tmp/build/mupen64plus/ sudo rm -rf mupen64plus-video-gles2rice sudo tar xvzf ~/mupen64plus-video-rice-src-2.5.9.tar.gz sudo mv mupen64plus-video-rice-src-2.5.9 mupen64plus-video-gles2rice

Still using a modified app-switcher.sh - I looked at that systemd stuff, shuddered and ran.

Have yet to test the mupen64 build but at least this did let it build correctly.

workingmanrob commented 1 year ago

And with November comes the October release of OSMC... just tried a brand fresh install to see if anything had changed.

So far I have seen the system fail to create a swap file (NFS root - it won't be able to) and then run itself out of memory while trying to compile mupen64plus/GLideNHQ.

When this attempt finishes I will add a bit of hard drive space temporarily at /home/osmc/retrOSMCmk2/submodule/RetroPie-Setup/tmp/ so it won't fail to create the swap space at least.. :crossed_fingers:

markferry commented 1 year ago

Given that it seems N64 emulation on RPi3 (my hardware) is widely considered not to work very well I'm probably not going to pursue it.

See if you can pull out upstream-able issues though - they're likely to get far more attention in RetroPie or OSMC.

workingmanrob commented 1 year ago

Ah well it was a nice place to keep track of progress and may be handy in the future for others.

It did build properly with the added swap space and the replacement rice video is actually fantastic.

Drop in the hires textures for mario64 and the game looks amazing. Gameplay is smooth enough for me so far.

Cheers - case closed - :beers:

hissingshark commented 1 year ago

I'm glad you've been making progress amongst yourselves here. I don't have time to be very active on this project presently. But am trying to look in. This is particularly true of RPi installs, as the product was intended for Vero4k, and I have infrequent access to an RPi3. The RPi4 I don't have access to at all.

  1. The issue identified with the FIFO is correct.
  2. OSMC moved to the GL drivers on RPi as standard now, which RetroPie do not officially support. Issues are reported with Emulation Station and perhaps others. I don't know if the built-in game support for Kodi might be the best way in the future? Unless GL comes.
  3. I'm not sure why you were doing any building at all as I supply binaries for all of the core and basic modules, plus a few others. I don't think RetroPie themselves host these at all (if only because all of ours are GL versions now).
workingmanrob commented 1 year ago

No idea why it builds everything from source but I wish it wouldn't... takes ages.

What/how does it determine whether or not to pull binary or build from source? I always picked basic install or whatever the first menu item is called and it just does it's thing.

I do run NFS root and have noticed some differences even just with the OSMC setup wizard (which I have seen quite a bit recently).

If you can point me to the bit of code/logic that makes the binary / source decision I'd be happy to test. Lots of Pi3s here and I even have me a Pi4 if we want to dive down that rabbit hole too.