Bug 461280 - Autostart entires with binaries in ~/.local/bin (or other user-added PATH locations) fail
Summary: Autostart entires with binaries in ~/.local/bin (or other user-added PATH loc...
Status: RESOLVED UPSTREAM
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_autostart (other bugs)
Version First Reported In: 5.26.2
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Nicolas Fella
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-01 09:12 UTC by pditchev
Modified: 2022-11-08 15:53 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pditchev 2022-11-01 09:12:01 UTC
Autostart apps are currently added through .desktop entries. Said entries work when starting them manually, though fail, since systemd does not use the user defined PATH. That results in unexpected behavior, that's non-obvious to debug. Since  fixing the issue may not be feasible - it would at least be nice to have the error info be available in the Autostart config UI.
Comment 1 Bug Janitor Service 2022-11-01 09:33:49 UTC
Thank you for the bug report!

Please note that Plasma 5.25.5 is not supported for much longer by KDE; supported versions are 5.24, and 5.26 or newer.

If at all possible please upgrade to a supported version and verify that the bug is still happening there.

If you're unsure how to do this, contact your distributor about it.
Comment 2 Nate Graham 2022-11-02 18:19:08 UTC
This is a bug in systemd itself which was fixed with https://github.com/systemd/systemd/pull/24658. It wasn't expanding tildes; now it is. In the meantime, you can work around the systemd issue until you get the fix by using the full absolute path (/home/[user]/blabla...)
Comment 3 pditchev 2022-11-02 21:21:16 UTC
Thanks for the tip, I'd applied that workaround. The bug should not be related to the tilde expansion though. My path contains the absolute path `/home/[user]/.local/bin`
Comment 4 Nate Graham 2022-11-04 16:21:25 UTC
Can you attach the desktop file for the autostart entries in question that aren't autostarting?
Comment 5 pditchev 2022-11-04 21:37:21 UTC
/home/[user]/.config/autostart/workday_timelapse.desktop : 
```
[Desktop Entry]
Comment[en_US]=A program to make timelapses of your screen(s) automatically
Comment=A program to make timelapses of your screen(s) automatically
Exec=workday-timelapse /home/[user]/screen_timelapses --log
GenericName[en_US]=
GenericName=
Hidden=false
Icon=accessories-camera
MimeType=
Name[en_US]=Workday timelapse
Name=Workday timelapse
Path=
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
```
workday-timelapse is located in /home/[user]/.local/bin (which is in PATH).
Comment 6 Nate Graham 2022-11-07 18:23:22 UTC
Can you paste the output of running `journalctl -u systemd-xdg-autostart-generator`?

And also `/usr/lib/systemd/user-generators/systemd-xdg-autostart-generator`?
Comment 7 pditchev 2022-11-08 09:53:07 UTC
For some reason `journalctl -u systemd-xdg-autostart-generator` gave no output, but with `journalctl -b | grep autostart-generator` (filtered only ones referring to workday_timelapse:
ное 08 11:45:31 p10-laptop systemd-xdg-autostart-generator[1430]: Configuration file /home/[user]/.config/autostart/workday_timelapse.desktop is marked executable. Please remove executable permission bits. Proceeding anyway.
ное 08 11:45:31 p10-laptop systemd-xdg-autostart-generator[1430]: /home/[user]/.config/autostart/workday_timelapse.desktop:15: Unknown key name 'TerminalOptions' in section 'Desktop Entry', ignoring.
ное 08 11:45:31 p10-laptop systemd-xdg-autostart-generator[1430]: Exec binary 'workday-timelapse' does not exist: No such file or directory
ное 08 11:45:32 p10-laptop systemd-xdg-autostart-generator[1475]: Configuration file /home/[user]/.config/autostart/workday_timelapse.desktop is marked executable. Please remove executable permission bits. Proceeding anyway.
ное 08 11:45:32 p10-laptop systemd-xdg-autostart-generator[1475]: /home/[user]/.config/autostart/workday_timelapse.desktop:15: Unknown key name 'TerminalOptions' in section 'Desktop Entry', ignoring.
ное 08 11:45:32 p10-laptop systemd-xdg-autostart-generator[1475]: Exec binary 'workday-timelapse' does not exist: No such file or directory
ное 08 11:45:32 p10-laptop systemd-xdg-autostart-generator[1475]: /home/[user]/.config/autostart/workday_timelapse.desktop: not generating unit, error parsing Exec= line: No such file or directory
Comment 8 Nate Graham 2022-11-08 15:17:08 UTC
Okay, so here's the problem:

> ное 08 11:45:32 p10-laptop systemd-xdg-autostart-generator[1475]: /home/[user]/.config/autostart/workday_timelapse.desktop: not generating unit, error parsing Exec= line: No such file or directory

Is `workday-timelapse` available in $PATH? What does `which workday-timelapse` say?

If it gives you the expected path, then this is indeed a systemd issue--but a different one! You can file a bug about it at https://github.com/systemd/systemd/issues/. In 

If it doesn't give you the expected path, then there's a problem with your $PATH variable.
Comment 9 pditchev 2022-11-08 15:34:37 UTC
Precisely, the binary is in ~/.local/bin , which is in PATH. 
As commented here: https://stackoverflow.com/questions/60977834/systemd-user-service-exec-command-not-in-path , systemd does not reslove PATH by default (if the info in the thread is correct).
And as per the Arch Wiki: https://wiki.archlinux.org/title/systemd/User#PATH
PATH can be substituted for systemd in .bash_profile via `systemctl --user import-environment PATH` (which will affect units started after that point. IDK about the autostart ones).

So I might file a bug upstream, but initially it seems to be expected behavior.
Comment 10 Nate Graham 2022-11-08 15:53:08 UTC
Yep, this sounds like a systemd issue indeed.