[SOLVED] Pre launch / post launch script not working [Steam Deck]

I have Lutris installed on Steam Deck. Tried to make a simple pre launch script to disable networking when I launch my game, but it’s not running. The script is just:

#!usr/bin/bash
nmcli networking off

There’s a similar script to turn networking back on once the game exits. I can run both scripts just fine outside of Lutris, but can’t seem to get any information as to why they’re not running when I launch the game :confused: The pre/post launch script options are just set to the script paths; all troubleshooting I could find suggested this was all that was needed. The Lutris logs don’t show anything relevant, and I’m not able to run lutris -d for more information.

Lutris version: 0.5.17 (Flatpak)

Managed to get the following output from terminal (flatpak run net.lutris.Lutris -d ), this is after exiting the game:

INFO     2025-01-18 16:38:42,615 [game.on_game_quit:973]:Running post-exit command: /home/deck/Games/scripts/enable-networking.sh
DEBUG    2025-01-18 16:38:42,617 [game.on_game_quit:983]:Assassin's Creed III stopped at Sat, 18 Jan 2025 16:38:42
DEBUG    2025-01-18 16:38:42,625 [application.on_game_stopped:793]:Removing 77 from running IDs
DEBUG    2025-01-18 16:38:42,723 [path_cache.add_to_path_cache:47]:Adding Assassin's Creed III (wine) to path cache
Traceback (most recent call last):
  File "/app/share/lutris/bin/lutris-wrapper", line 205, in <module>
    main()
  File "/app/share/lutris/bin/lutris-wrapper", line 132, in main
    process_pid = subprocess.Popen(args).pid
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/deck/Games/scripts/enable-networking.sh'
WARNING  2025-01-18 16:38:42,796 [monitored_command.get_return_code:218]:No file /tmp/lutris-a5e4bacb-9061-4edd-a35f-71b6a3bfa936
DEBUG    2025-01-18 16:38:42,796 [monitored_command.on_stop:228]:Process 287 has terminated with code 

Seems like the major error here is error 13, permission denied; it’s not able to run the script at all.

Figured it out! Several overlapping issues here:

  1. I needed to check Properties->Permissions->Is executable for the .sh files I created. This fixed the permission error.
  2. To actually use nmcli in my script, I had to modify the PATH and LD_LIBRARY_PATH used within Lutris when running the script. Final script is here:
#!/usr/bin/bash
export PATH=$PATH:/var/run/host/usr/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/run/host/usr/lib
nmcli networking off
  1. FInally, for the Network Manager to actually work, I had to go into Flatseal and enable all options. No idea which of these options are actually needed to fix the issue. But enabling them allowed the script to access the Network Manager already existing on the system. Without it, trying to use nmcli returned errors about the Network Manager not being started and having the wrong version.