rockerbacon / modorganizer2-linux-installer

An easy-to-use Mod Organizer 2 installer for Linux
GNU General Public License v3.0
978 stars 79 forks source link

nxm links aren't working in Firefox despite $PATH and xdg set up properly #170

Closed katawful closed 2 years ago

katawful commented 3 years ago

With everything set up as described in this issue, download links don't appear in MO2. When I try to open up the link directly with xdg, all it does is show the Lutris information for running download.sh without doing anything. The script it tries to run is:

'/path/to/Proton 5.0/proton' run '/path/to/ModOrganizer2/nxmhandler.exe'  'nxm://mod/link'

Firefox complained that it wasn't a proper link, but doesn't seem to do so anymore. The set up is fine and the api is loaded into MO2

$ xdg-mime query default x-scheme-handler/nxm
modorganizer2-nxm-handler.desktop
$ grep -o "$HOME/.local/bin" <<< "$PATH"
/home/kat/.local/bin
hazelnot commented 3 years ago

Yeah I seem to have the exact same issue. I'm on Arch and I know that can cause some weird issues with this thing working, what distro are you using?

monyarm commented 3 years ago

I'm had the same issue on Manjaro

opening download.sh and adding --system-libs fixed it.

Leooow commented 3 years ago

@hazelnot @monyarm Do you both use a different shell besides bash?

katawful commented 3 years ago

I am using zsh

monyarm commented 3 years ago

Same here (zsh) , though it somehow fixed itself at one point

On Fri, Dec 25, 2020, 9:44 PM Kat-NB notifications@github.com wrote:

I am using zsh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rockerbacon/lutris-skyrimse-installers/issues/170#issuecomment-751285153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHJKVZ3Y7UCR4JFZZFRO3SWTTRPANCNFSM4TP7XWSA .

hazelnot commented 3 years ago

I also use zsh

Leooow commented 3 years ago

I installed fsh today and noticed some problems with the nxm links not working, thought there could be some correlation

katawful commented 3 years ago

Fish is not fully compatible with POSIX and bash shells, unlike zsh which is bash compatible. It is likely that fish could be a problem

Leooow commented 3 years ago

Fish is not fully compatible with POSIX and bash shells, unlike zsh which is bash compatible. It is likely that fish could be a problem

Yeah, that's what I found out since I posted :-P You learn something every day. Too bad it's no help for you guys

Leooow commented 3 years ago

I'm had the same issue on Manjaro

opening download.sh and adding --system-libs fixed it.

Where did you append the --system-libs?

MattSturgeon commented 3 years ago

I'd be very surprised if the user's default shell is causing issues since both download.sh and run.sh explicitly set #!/bin/bash, as does proton-launcher.sh. That said I'm also using ZSH so who knows...

For me the issue also occurs even when directly calling xdg-open, and even with --system-libs added to both download.sh and run.sh (incidentally, I couldn't get MO2 to run without adding --system-libs to run.sh).

Example, calling xdg-open while MO2 is already running:

$ xdg-open "nxm://fallout4/mods/21497/files/172180?key=qoK1jCGVCMdjeNNqaJShNw&expires=1608745790&user_id=29649735"
Searching for Steam in '/home/matt/.local/share/Steam'                          
Found Steam
Searching for game in library '/home/matt/.local/share/Steam'
Searching for game in library '/data/lin/matt/Games/Steam Library'
Found game
Searching for 'Proton 5.*' in library '/home/matt/.local/share/Steam'
Searching for 'Proton 5.*' in library '/data/lin/matt/Games/Steam Library'

Found Proton

    PATH='/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/usr/bin:/home/matt/.cache/zsh/zplugin/polaris/bin:/home/matt/.local/share/npm/bin:/home/matt/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/opt/android-sdk/build-tools/27.0.3:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/build-tools/27.0.3:/usr/lib/jvm/default/bin' \
    LD_LIBRARY_PATH='/usr/lib/libfakeroot:/usr/lib32:/usr/lib/openmpi:/usr/lib:/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/dist/lib64:/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/dist/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_32:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_64:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i368-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib' \
    STEAM_COMPAT_DATA_PATH='/data/lin/matt/Games/Steam Library/steamapps/compatdata/377160' \
    SteamGameId=377160 \
    SteamAppId=377160 \
    PROTON_NO_ESYNC=1 WINEDLLOVERRIDES='xaudio2_7=n,b;' PULSE_LATENCY_MSEC=90 \
    \
    '/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/proton' run '/home/matt/Games/Lutris/mod-organizer-2/ModOrganizer2/nxmhandler.exe'  'nxm://fallout4/mods/21497/files/172180?key=qoK1jCGVCMdjeNNqaJShNw&expires=1608745790&user_id=29649735'

Setting breakpad minidump AppID = 377160
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198081415483 [API loaded no]

And running xdg-open with MO2 not running:

$ xdg-open "nxm://fallout4/mods/21497/files/172180?key=qoK1jCGVCMdjeNNqaJShNw&expires=1608745790&user_id=29649735"
Searching for Steam in '/home/matt/.local/share/Steam'                          
Found Steam
Searching for game in library '/home/matt/.local/share/Steam'
Searching for game in library '/data/lin/matt/Games/Steam Library'
Found game
Searching for 'Proton 5.*' in library '/home/matt/.local/share/Steam'
Searching for 'Proton 5.*' in library '/data/lin/matt/Games/Steam Library'

Found Proton

    PATH='/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/usr/bin:/home/matt/.cache/zsh/zplugin/polaris/bin:/home/matt/.local/share/npm/bin:/home/matt/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/opt/android-sdk/build-tools/27.0.3:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/build-tools/27.0.3:/usr/lib/jvm/default/bin' \
    LD_LIBRARY_PATH='/usr/lib/libfakeroot:/usr/lib32:/usr/lib/openmpi:/usr/lib:/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/dist/lib64:/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/dist/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_32:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_64:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i368-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib' \
    STEAM_COMPAT_DATA_PATH='/data/lin/matt/Games/Steam Library/steamapps/compatdata/377160' \
    SteamGameId=377160 \
    SteamAppId=377160 \
    PROTON_NO_ESYNC=1 WINEDLLOVERRIDES='xaudio2_7=n,b;' PULSE_LATENCY_MSEC=90 \
    \
    '/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/proton' run '/home/matt/Games/Lutris/mod-organizer-2/ModOrganizer2/nxmhandler.exe'  'nxm://fallout4/mods/21497/files/172180?key=qoK1jCGVCMdjeNNqaJShNw&expires=1608745790&user_id=29649735'

wineserver: using server-side synchronization.
Setting breakpad minidump AppID = 377160

For completeness, I opened a bash shell and ran xdg-open without MO2 running:

$ /bin/bash
$ xdg-open "nxm://fallout4/mods/21497/files/172180?key=qoK1jCGVCMdjeNNqaJShNw&expires=1608745790&user_id=29649735"
Searching for Steam in '/home/matt/.local/share/Steam'
Found Steam
Searching for game in library '/home/matt/.local/share/Steam'
Searching for game in library '/data/lin/matt/Games/Steam Library'
Found game
Searching for 'Proton 5.*' in library '/home/matt/.local/share/Steam'
Searching for 'Proton 5.*' in library '/data/lin/matt/Games/Steam Library'

Found Proton

    PATH='/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/usr/bin:/home/matt/.cache/zsh/zplugin/polaris/bin:/home/matt/.local/share/npm/bin:/home/matt/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/opt/android-sdk/build-tools/27.0.3:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/build-tools/27.0.3:/usr/lib/jvm/default/bin' \
    LD_LIBRARY_PATH='/usr/lib/libfakeroot:/usr/lib32:/usr/lib/openmpi:/usr/lib:/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/dist/lib64:/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/dist/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_32:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_64:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i368-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu:/home/matt/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib' \
    STEAM_COMPAT_DATA_PATH='/data/lin/matt/Games/Steam Library/steamapps/compatdata/377160' \
    SteamGameId=377160 \
    SteamAppId=377160 \
    PROTON_NO_ESYNC=1 WINEDLLOVERRIDES='xaudio2_7=n,b;' PULSE_LATENCY_MSEC=90 \
    \
    '/data/lin/matt/Games/Steam Library/steamapps/common/Proton 5.13/proton' run '/home/matt/Games/Lutris/mod-organizer-2/ModOrganizer2/nxmhandler.exe'  'nxm://fallout4/mods/21497/files/172180?key=qoK1jCGVCMdjeNNqaJShNw&expires=1608745790&user_id=29649735'

wineserver: using server-side synchronization.
Setting breakpad minidump AppID = 377160
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198081415483 [API loaded no]
Baguettedood commented 3 years ago

Not entirely sure if the issue I experienced and solved is actually the issue here but it's close enough that I'll post I guess.

I had this as well for a while as well, until I looked more into it and noticed that I had set my PATH in .bashrc which isn't read by non-interactive shells - Checking the environment variables in Firefox while it was running made me realize my path didn't include ~/.local/bin. I moved my PATH setting into .bash_profile, which is read by non-interactive shells, and Firefox figured itself out after rebooting. Some of this could be just because my .bashrc has a line to ignore non-interactive shells but either way it works now. Adjust .bash_profile to your appropriate shell's equivalent if you're using zsh or another shell.

I would wonder if modorganizer2-nxm-handler.desktop could instead be amended to include the path to modorganizer2-nxm-broker.sh instead of only giving the command and letting the PATH figure out where it is.

ralgar commented 3 years ago

@katawful @hazelnot @Leooow

I believe you are all experiencing the same issue which I just solved, on Arch Linux with Zsh and Firefox. It's an issue with $PATH, similar to what @Baguettedood posted. To check this for yourself, run Firefox as normal, then in a terminal you can run the following one-liner to dump the environment from the Firefox parent process: $ cat "/proc/$(pgrep firefox | awk '{print $1}')/environ" | tr '\0' '\n'

In my case, I was setting the environment in .zshenv, which should always be sourced as I understood it, but clearly this is not the case. I haven't been able to come up with a proper solution for the $PATH variable, neither .zlogin or .zprofile have worked for me to set $PATH for non-interactive shells.

What I did instead was simply edit the handler file ~/.local/share/applications/modorganizer2-nxm-hander.desktop like so: Change this line: Exec=modorganizer2-nxm-broker.sh To this: Exec=/bin/sh -c "$HOME/.local/bin/modorganizer2-nxm-broker.sh" %u

I'm also working on a fork that will be exclusively SteamPlay focused and is written entirely in bash, so it no longer depends on Lutris. It will be found at basschaser/skyrimse-installers when it is complete. Currently it is working well with SSE, still have to integrate it better with Steam and finish adding support for the other games.

thicccatto commented 2 years ago

Same here. I noticed similar to @basschaser and @Baguettedood that ~/.local/bin wasnt in firefox's path. (I use zsh) I changed the file ~/.local/share/applications/modorganizer2-nxm-hander.desktop according to the suggestion from @basschaser, but to no avail. xdg-open works fine for me, but as soon as i try open it in firefox it doesnt work, so it must be an issue with firefox or the .desktop.

MattSturgeon commented 2 years ago

Looks like I was having the same issue; my gnome session doesn't have the same environment as my login shell, despite experimenting with where I should set my environment variables (I've tried .zshenv, .profile, & .pam_environment)

However

It should be possible to work-around the issue by having your .desktop handler call a wrapper shell-script.

Since it's a shell script it should start in a similar environment to your terminal, although if all else fails you could explicitly set your PATH within your wrapper script (or source your .profile, .zshenv, or whatever else if you prefer).

Personally, I've moved on to using steamtinkerlaunch to run my mod manager, which is working well for me (at least for Vortex, I've been having problems getting UVFS to work properly in newer proton versions with MO2).

otikscypi commented 2 years ago

I have managed to get nxm links to work on my PC.

In my case the problem was in proton-launcher.sh (for FO4):

library_path=$LD_LIBRARY_PATH
if [ -d "$steam_rundir" ] && [ -z "$library_path" ]; then

while it should be:

library_path=$LD_LIBRARY_PATH
if [ -d "$steam_rundir" ] && [ -n "$library_path" ]; then

-z returns true when a variable is null or empty. -n does the opposite. LD_LIBRARY_PATH is being set by steam-runtime.

What I do not understand yet, is why it worked from the terminal, by running xdg-open 'link', but not from .desktop.

rockerbacon commented 2 years ago

The latest version executes the broker using bash -c instead of calling the script directly and no longer relies on $HOME/.local/bin being in the path. I expect this problem should no longer occur.