Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4 Issue - Launch button does not seem to work (Linux, Steam) #1151

Closed
Tracked by #1164
Slayer5934 opened this issue Mar 31, 2024 · 28 comments
Closed
Tracked by #1164

v0.4 Issue - Launch button does not seem to work (Linux, Steam) #1151

Slayer5934 opened this issue Mar 31, 2024 · 28 comments
Assignees
Labels
Bug Something isn't working os-linux This affects Linux related code. User Raised

Comments

@Slayer5934
Copy link

Slayer5934 commented Mar 31, 2024

Bug Report

Summary

When trying to launch Stardew the Launch button does not seem to work. It says Running... then eventually turns back to Launch.

Steps to reproduce

...

What is the expected behaviour?

It launches.

Other information

It is worth noting that I installed SMAPI (and other mods) outside of the Nexus Mods App before getting it.
I installed one mod, applied, then launched through steam directly and everything worked fine.

@erri120
Copy link
Member

erri120 commented Apr 1, 2024

Are you on Windows or on Linux? Also, can you attach some logs?

Windows: %LOCALAPPDATA%\NexusMods.App\Logs
Linux: ~/.local/state/NexusMods.App/Logs

@Slayer5934
Copy link
Author

nexusmods.app.current.log

I do not see anything in the log that would suggest a problem... I could run a dev build or run in debug mode or something if you needed it though

@erri120
Copy link
Member

erri120 commented Apr 2, 2024

nexusmods.app.current.log

I do not see anything in the log that would suggest a problem... I could run a dev build or run in debug mode or something if you needed it though

You can try running this command manually:

xdg-open steam://rungameid/413150

On Linux, we currently only support running the game through Steam. The only thing the launch button does is run the command above.

private async Task RunThroughSteam(uint appId, CancellationToken cancellationToken)
{
var existingReaperProcesses = Process.GetProcessesByName("reaper");
// https://developer.valvesoftware.com/wiki/Steam_browser_protocol
await _osInterop.OpenUrl(new Uri($"steam://rungameid/{appId.ToString(CultureInfo.InvariantCulture)}"), cancellationToken);
if (OSInformation.Shared.IsWindows)
{
// TODO:
} else if (OSInformation.Shared.IsLinux)
{
var steam = await WaitForProcessToStart("steam", Array.Empty<Process>(), TimeSpan.FromMinutes(1), cancellationToken);
if (steam is null) return;
// NOTE(erri120): Reaper is a custom tool for cleaning up child processes
// See https://github.com/sonic2kk/steamtinkerlaunch/wiki/Steam-Reaper for details.
var reaper = await WaitForProcessToStart("reaper", existingReaperProcesses, TimeSpan.FromMinutes(1), cancellationToken);
if (reaper is null) return;
await reaper.WaitForExitAsync(cancellationToken);
}
else
{
throw OSInformation.Shared.CreatePlatformNotSupportedException();
}
}

@Al12rs Al12rs mentioned this issue Apr 3, 2024
4 tasks
@Slayer5934
Copy link
Author

xdg-open steam://rungameid/413150 works as expected
Running through the mod manager doesn't seem to work, not sure why, it says running tool so perhaps its because I installed Smapi outside of the manager? Just trying to guess
image

@erri120
Copy link
Member

erri120 commented Apr 4, 2024

@Slayer5934 can you try one of the latest builds at https://github.com/Nexus-Mods/NexusMods.App/actions/runs/8551545718 and check the logs afterwards?

@Slayer5934
Copy link
Author

@Slayer5934 can you try one of the latest builds at https://github.com/Nexus-Mods/NexusMods.App/actions/runs/8551545718 and check the logs afterwards?

i will see

@Slayer5934
Copy link
Author

Slayer5934 commented Apr 8, 2024

same result, i see the launcher did try running the command, nothing happened
nexusmods.app.current.log

this is me running it through konsole
image

@erri120
Copy link
Member

erri120 commented Apr 8, 2024

00:00:04.422 [INFO] (NexusMods.CrossPlatform.Process.ProcessFactory) Executing command `xdg-open steam://rungameid/413150`
00:01:04.809 [INFO] (NexusMods.DataModel.ToolManager) Ingesting loadout 393DE461B37E144BB2457E56E9F2B829 from Stardew Valley 1.6.3.24087

It looks like we tried to start the process and then waited for a minute for it to start. For some reason, either steam or the reaper process didn't start within a minute.

@LukeNexusMods LukeNexusMods changed the title Launch button does not seem to work (0.4) Apr 10, 2024
@erri120 erri120 self-assigned this Apr 11, 2024
@erri120
Copy link
Member

erri120 commented Apr 11, 2024

I've got a PR #1206 open that should improve this, or at least give us more information.

@Slayer5934
Copy link
Author

nexusmods.app.main.current.log
app log ^

SystemJournal.txt
system log for extra info ^

@erri120
Copy link
Member

erri120 commented Apr 15, 2024

@Slayer5934 looks like debug logging wasn't enabled. I've fixed that here: https://github.com/Nexus-Mods/NexusMods.App/actions/runs/8687979869

Can you explain what actually happens on screen? What's supposed to happen is,

  1. we start xdg-open steam://rungameid/413150,
  2. Steam should open and launch the game,
  3. we wait for the steam process to appear,
  4. we wait for the reaper process to appear,
  5. we wait until the reaper process exists.
@Slayer5934
Copy link
Author

Slayer5934 commented Apr 16, 2024

@Slayer5934 looks like debug logging wasn't enabled. I've fixed that here: https://github.com/Nexus-Mods/NexusMods.App/actions/runs/8687979869

Can you explain what actually happens on screen?

I will download and run the new one,
When I press launch nothing happens, the only indicator it tried to do anything is it saying launching, steam is already open usually when I try as well

@erri120
Copy link
Member

erri120 commented Apr 16, 2024

00:00:07.244 [INFO] (NexusMods.Abstractions.Games.RunGameTool) Starting Run Stardew Valley
00:00:07.268 [INFO] (NexusMods.CrossPlatform.Process.ProcessFactory) Executing command `xdg-open steam://rungameid/413150`
00:00:07.272 [DEBUG] (NexusMods.Abstractions.Games.RunGameTool) Waiting for process `steam` to start within `0:05:00` second(s)
00:00:07.279 [DEBUG] (NexusMods.Abstractions.Games.RunGameTool) Waiting for process `reaper` to start within `0:05:00` second(s)
00:05:07.401 [WARN] (NexusMods.Abstractions.Games.RunGameTool) Process `reaper` failed to start within `0:05:00` second(s)

I think that xdg-open steam://rungameid/413150 might not do anything. How did you install Steam? Are you using the Steam flatpak or something else?

Just be sure, running xdg-open steam://rungameid/413150 in your terminal works just fine? It's weird if that works but this doesn't.

@Al12rs Al12rs changed the title v0.4 Issue - Launch button does not seem to work (0.4) Apr 17, 2024
@Slayer5934
Copy link
Author

Slayer5934 commented Apr 17, 2024

steam is installed from the arch repositories
image
image

@erri120
Copy link
Member

erri120 commented Apr 18, 2024

@Slayer5934 can you run the following commands in your terminal:

  • echo $SHELL (expected: either /usr/bin/bash or /usr/bin/zsh)
  • which disown (expected: disown: shell built-in command)
  • which xdg-open (expected: /usr/bin/xdg-open)
  • xdg-open --version (expected: xdg-open 1.2.1)
@Slayer5934
Copy link
Author

Slayer5934 commented Apr 19, 2024

image
I use this https://github.com/akinomyoga/ble.sh
I tested "disown" on a background job and it seemed to work fine, though that output definitely does not match what you expected

@erri120
Copy link
Member

erri120 commented May 6, 2024

#1151 (comment) @l0b0 can you run these commands as well?

@l0b0
Copy link

l0b0 commented May 6, 2024

@Slayer5934 can you run the following commands in your terminal:

* `echo $SHELL` (expected: either `/usr/bin/bash` or `/usr/bin/zsh`)

* `which disown` (expected: `disown: shell built-in command`)

* `which xdg-open` (expected: `/usr/bin/xdg-open`)

* `xdg-open --version` (expected: `xdg-open 1.2.1`)

#1151 (comment) @l0b0 can you run these commands as well?

I think you meant type disown; which doesn't detect built-ins.

echo $SHELL
/run/current-system/sw/bin/bashwhich disown
which: no disown in (/nix/store/[omitted giant PATH])type disown
disown is a shell builtinwhich xdg-open
/run/current-system/sw/bin/xdg-openxdg-open --version
xdg-open 1.2.1
@LukeNexusMods LukeNexusMods added the Bug Something isn't working label May 29, 2024
@erri120
Copy link
Member

erri120 commented May 29, 2024

@l0b0 and @Slayer5934 how did you install Steam? Did you use flatpak, your system package manager, or something else? Also, can you check if links in diagnostics or in the changelog are clickable? This might either be an issue with how we use xdg-open in general or just Steam.

I'm really perplexed by this issue because xdg-open appears to be working fine if you run it in a normal terminal but fails when we spawn a process with the same command.

If there isn't anything obvious that we've somehow missed, I'll probably rework how we do this entirely.

@l0b0
Copy link

l0b0 commented May 31, 2024

[…] how did you install Steam? Did you use flatpak, your system package manager, or something else?

I basically just set programs.steam.enable = true; in my NixOS configuration and run nixos-rebuild to build the system.

Also, can you check if links in diagnostics or in the changelog are clickable? This might either be an issue with how we use xdg-open in general or just Steam.

The test process:

  1. Check out nexusmods-app: init at 0.4.1 NixOS/nixpkgs#270372
  2. Rebase onto upstream master
  3. Build with nix-build --attr pkgs.nexus-mods-app
  4. Run ./result/bin/NexusMods.App
  5. Try to run Skyrim

CLI logs:

00:03:35.903 [INFO] Executing command `/home/victor/.local/share/Steam/steamapps/common/Skyrim Special Edition/skse64_loader.exe `
00:03:35.905 [ERROR] Encountered an exception published to an object with an unobserved ThrownExceptions property|System.ComponentModel.Win32Exception (0x80004005): Failed to start a process with file path '/home/victor/.local/share/Steam/steamapps/common/Skyrim Special Edition/skse64_loader.exe'. Target file or working directory doesn't exist, or the provided credentials are invalid.
 ---> System.ComponentModel.Win32Exception (8): An error occurred trying to start process '/home/victor/.local/share/Steam/steamapps/common/Skyrim Special Edition/skse64_loader.exe' with working directory '/home/victor/.local/share/Steam/steamapps/common/Skyrim Special Edition'. Exec format error
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at CliWrap.Utils.ProcessEx.Start() in /_/CliWrap/Utils/ProcessEx.cs:line 56
   at CliWrap.Utils.ProcessEx.Start() in /_/CliWrap/Utils/ProcessEx.cs:line 68
   at CliWrap.Command.ExecuteAsync(CancellationToken forcefulCancellationToken, CancellationToken gracefulCancellationToken) in /_/CliWrap/Command.Execution.cs:line 307
   at CliWrap.Command.ExecuteAsync(CancellationToken cancellationToken) in /_/CliWrap/Command.Execution.cs:line 326
   at NexusMods.CrossPlatform.Process.ProcessFactory.ExecuteAsync(Command command, CancellationToken cancellationToken) in /build/source/src/NexusMods.CrossPlatform/Process/ProcessFactory.cs:line 26
   at NexusMods.Abstractions.Games.RunGameTool`1.RunCommand(CancellationToken cancellationToken, AbsolutePath program) in /build/source/src/Abstractions/NexusMods.Abstractions.Games/RunGameTool.cs:line 134
   at NexusMods.Abstractions.Games.RunGameTool`1.Execute(Loadout loadout, CancellationToken cancellationToken) in /build/source/src/Abstractions/NexusMods.Abstractions.Games/RunGameTool.cs:line 101
   at NexusMods.DataModel.ToolManager.RunTool(ITool tool, Loadout loadout, Nullable`1 generatedFilesMod, CancellationToken token) in /build/source/src/NexusMods.DataModel/ToolManager.cs:line 51
   at NexusMods.App.UI.LeftMenu.Items.LaunchButtonViewModel.<>c__DisplayClass19_0.<<LaunchGame>b__0>d.MoveNext() in /build/source/src/NexusMods.App.UI/LeftMenu/Items/LaunchButtonViewModel.cs:line 42
--- End of stack trace from previous location ---
   at NexusMods.App.UI.LeftMenu.Items.LaunchButtonViewModel.LaunchGame(CancellationToken token) in /build/source/src/NexusMods.App.UI/LeftMenu/Items/LaunchButtonViewModel.cs:line 40

The diagnostics panel doesn't show anything, and I can't see a changelog button anywhere. Where is it? Will check this in v0.5.

I'm really perplexed by this issue because xdg-open appears to be working fine if you run it in a normal terminal but fails when we spawn a process with the same command.

Doesn't xdg-open rely on variables such as PATH and XDG_…, to determine either which program to run, or where to find those programs? Could it be that those are changed/unset in the context of NMA?


I'll try to upgrade to v0.5 to see if that changes anything.

@Sewer56
Copy link
Member

Sewer56 commented May 31, 2024

 ---> System.ComponentModel.Win32Exception (8): An error occurred trying to start process '/home/victor/.local/share/Steam/steamapps/common/Skyrim Special Edition/skse64_loader.exe' with working directory '/home/victor/.local/share/Steam/steamapps/common/Skyrim Special Edition'. Exec format error
 

I'm presuming it tried to start a Windows binary as a regular Linux one, but Wine is not present or set as the default handler, i.e. sudo xdg-mime default.

More importantly, I'd guess we're probably not handling running of tools (SKSE) via a WINEPREFIX, regardless of whether we need to run it via Proton or Wine.

That's a problem yet to be resolved. Skyrim is also currently unsupported and hasn't been touched since an eternity ago.

Try Stardew Valley for the time being, see how that goes.

@l0b0
Copy link

l0b0 commented Jun 1, 2024

That's a problem yet to be resolved. Skyrim is also currently unsupported and hasn't been touched since an eternity ago.

Try Stardew Valley for the time being, see how that goes.

I don't have that game, so I don't think I'll be able to contribute much more to this issue.

@erri120
Copy link
Member

erri120 commented Jun 3, 2024

Doesn't xdg-open rely on variables such as PATH and XDG_…, to determine either which program to run, or where to find those programs? Could it be that those are changed/unset in the context of NMA?

@l0b0 We inherit the environment variables from the environment the App is running in. If you're starting the App from the shell, then it would inherit all environment variables that are present in the current shell session.

@erri120 erri120 added the os-linux This affects Linux related code. label Jun 4, 2024
@Greg-Nexus
Copy link
Contributor

nexusmods.app.main.current.log

I'm able to reproduce this on my Steam Deck, I think this is the correct log file.

@erri120
Copy link
Member

erri120 commented Jun 5, 2024

This issue might be fixed with #1533.

@erri120
Copy link
Member

erri120 commented Jun 7, 2024

Fixed with #1533, confirmed by two testers.

@erri120 erri120 closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working os-linux This affects Linux related code. User Raised
7 participants