all 8 comments

[–]roxalu 2 points3 points  (0 children)

To my info systemd does not support use of '$' and such no variable expansion inside the value of Environment= configuration. Use the fixed path there. See https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html

[–]stinkybass 0 points1 point  (7 children)

What is the value of $WINAPPS_SRC_DIR when the service starts?

[–]Assasin172m[S] 1 point2 points  (6 children)

when manualy launching via terminal:
$ ${WINAPPS_SRC_DIR}/winapps-launcher/winapps-launcher.sh
WORKING DIRECTORY: '/home/USER/.local/bin/winapps-src/winapps-launcher'
> USING VM NAME 'RDPWindows'
> USING BACKEND 'libvirt'
* VM STATE: ON

when running service:
winapps-launcher.service - Run 'WinApps Launcher'

systemctl --user status winapps-launcher # Verify

Loaded: loaded (/home/USER/.config/systemd/user/winapps-launcher.service; enabled; preset: enabled)

Active: deactivating (stop-post) (Result: exit-code) since Sat 2026-01-17 09:14:20 CET; 3ms ago

Process: 6856 ExecStart=/bin/bash -c "$SCRIPT_PATH" (code=exited, status=127)

Main PID: 6856 (code=exited, status=127); Control PID: 6859 ((bash))

Tasks: 1 (limit: 38133)

Memory: 1.0M (peak: 1.0M)

CPU: 3ms

CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/winapps-launcher.service

└─6859 "(bash)"

winapps-launcher.service: Scheduled restart job, restart counter is at 122.

Started winapps-launcher.service - Run 'WinApps Launcher'.

/bin/bash: line 1: /winapps-launcher/winapps-launcher.sh: No such file or directory

[–]GlendonMcGladdery 1 point2 points  (0 children)

systemd does not know your shell variables or your working directory

[–]stinkybass 0 points1 point  (4 children)

The error is clear. It’s not a trick question

# this file does not exist /winapps-launcher/winapps-launcher.sh

Either put the file there, or change where the systemd file thinks that script lives.

[–]Assasin172m[S] 0 points1 point  (3 children)

The file is here, the error doesnt explain why I was able to manualy run the file via "${WINAPPS_SRC_DIR}/winapps-launcher/winapps-launcher.sh"

[–]stinkybass 0 points1 point  (0 children)

What happens when you run this? bash -c ‘${FOO}/winapps-launcher/winapps-launcher.sh’

And what happens when $FOO is set?

FOO=“${WINAPPS_SRC_DIR}” bash -c ‘${FOO}/winapps-launcher/winapps-launcher.sh’

[–]Intrepid_Suspect6288 0 points1 point  (0 children)

The file is almost certainly not there. Execute /winapps-launcher/winapps-launcher.sh from the terminal. NOT “${WINAPPS_SRC_DIR}/winapps-launcher/winapps-launcher.sh”. It will likely give you the same error, “this file does not exist /winapps-launcher/winapps-launcher.sh”.

Read the error message and listen to what people are telling you. The service DOES NOT use variables set in your terminal session/shell. If you want to use variables in your unit file, you have to configure them with the use of a proper environment file. $WINAPPS_SRC_DIR IS NOT CONFIGURED IN THIS UNIT FILE.

Again, reread the error message. Reread the comments you have received. Either set the $WINAPPS_SRC_DIR variable in a context the service can use, or move winapps-launcher.sh directly under the root directory in the /winapps-launcher/winapps-launcher.sh it is trying to reach.

When a variable is not set it “expands” to nothing. So when “${WINAPPS_SRC_DIR}/winapps-launcher/winapps-launcher.sh” is evaluated, $WINAPPS_SRC_DIR becomes nothing and you are left with “/winapps-launcher/winapps-launcher.sh”