Bug 433299

Summary: [systemd] Applications meant to autostart do not start after switching to systemd
Product: [Plasma] plasmashell Reporter: Szőts Ákos <szotsaki>
Component: Startup processAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED UPSTREAM    
Severity: normal CC: alex765, katyaberezyaka, kde, kishore96, m.lincetto, nate, openmindead, plasma-bugs, rdieter
Priority: NOR    
Version: 5.23.4   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
URL: https://github.com/systemd/systemd/pull/18782
See Also: https://bugs.kde.org/show_bug.cgi?id=427340
https://bugs.kde.org/show_bug.cgi?id=433987
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Automatic startup screenshot

Description Szőts Ákos 2021-02-20 08:27:38 UTC
Created attachment 135944 [details]
Automatic startup screenshot

SUMMARY

I have some applications which I configured to automatically start during login. The configuration has been done by the KCM, no manual work was involved here.

Now, after switching to systemd many of these applications don't start anymore.

Interestingly, only applications which are manual types don't keep running. In the screenshot they are "redshift", "xbindkeys", and "xhost-add-root".

In the logs I see that they started successfully but in the task manager they don't appear anymore. Logs for "xbindkeys":

febr 20 09:09:35 openSUSE systemd[1499]: Starting xbindkeys...
febr 20 09:09:35 openSUSE systemd[1499]: app-xbindkeys-autostart.service: Succeeded.
febr 20 09:09:35 openSUSE systemd[1499]: Started xbindkeys.

KeePass keeps running but xbindkeys don't for some reason. Their generated unit files are very similar:

$> cat /run/user/1000/systemd/generator.late/app-keepass-autostart.service 
# Automatically generated by systemd-xdg-autostart-generator

[Unit]
Documentation=man:systemd-xdg-autostart-generator(8)
SourcePath=/home/aki/.config/autostart/keepass.desktop
PartOf=graphical-session.target

Description=KeePass
After=graphical-session.target

[Service]
Type=exec
ExecStart=:/usr/bin/keepass
Restart=no
TimeoutSec=5s
Slice=app.slice
WorkingDirectory=-

$> cat /run/user/1000/systemd/generator.late/app-xbindkeys-autostart.service 
# Automatically generated by systemd-xdg-autostart-generator

[Unit]
Documentation=man:systemd-xdg-autostart-generator(8)
SourcePath=/home/aki/.config/autostart/xbindkeys.desktop
PartOf=graphical-session.target

Description=xbindkeys
After=graphical-session.target

[Service]
Type=exec
ExecStart=:/usr/bin/xbindkeys
Restart=no
TimeoutSec=5s
Slice=app.slice
WorkingDirectory=-


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20210217
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.10.16-1-default
OS Type: 64-bit
Graphics Platform: X11
Comment 1 David Edmundson 2021-02-20 15:01:37 UTC
xbindkeys and xhost-add-root aren't meant to keep running though are they?

It's meant to run once, set some things and exit. That's what happens if I run xbindkeys manually from a konsole, so that all sounds correct.

Can you confirm what the legacy boot did for xbindkeys
Comment 2 Szőts Ákos 2021-02-20 15:28:08 UTC
That's strange; if I start xbindkeys, it keeps running for me. Do you have a config file to read from?

You can paste the following into "~/.xbindkeysrc" for a quick test (feel free to reconfigure the buttons):

# Volume down
"pamixer --decrease 6"
 b:6

# Volume up
"pamixer --increase 4"
 b:7

If you start xbindkeys --verbose, does it tell you something? For me it writes the following and keeps running in the foreground:

displayName = :0
rc file = /home/aki/.xbindkeysrc
2 keys in /home/aki/.xbindkeysrc

"pamixer --decrease 6"
    m:0x0 + b:6   (mouse)
"pamixer --increase 4"
    m:0x0 + b:7   (mouse)
starting loop...
Comment 3 Nate Graham 2021-02-22 21:00:39 UTC
xbindkeys stays running for me with systemd startup FWIW.
Comment 4 David Edmundson 2021-03-08 16:49:40 UTC
Aha, xbindkeys forks when it loads.

if you change your .desktop file to be xbindkeys -n 
it should work. Can you confirm?


It should also hopefully be fixed properly by an upstream change we're doing:
https://github.com/systemd/systemd/pull/18782
Comment 5 Nate Graham 2021-04-22 02:34:35 UTC
*** Bug 435947 has been marked as a duplicate of this bug. ***
Comment 6 Vladimir Yerilov 2021-06-10 11:59:47 UTC
*** Bug 438383 has been marked as a duplicate of this bug. ***
Comment 7 Massimiliano L 2021-12-26 13:09:36 UTC
Testing now on Fedora 35 and systemd 249, Skype and Dropbox still fail to autostart. Is anybody able to confirm that this is actually fixed for them?
Comment 8 Szőts Ákos 2021-12-26 13:30:13 UTC
Just last week I thought I give systemd Plasma another spin, but unfortunately this feature still doesn't work for me either so I reverted back.

I have the xbindkeys program mentioned above and a manual bash script which starts redshift, but none of them gets started.

I used the latest Tumbleweed for testing (now I don't have it handy but supposedly it has systemd 249 in it).
Comment 9 David Edmundson 2021-12-31 10:08:41 UTC
>It should also hopefully be fixed properly by an upstream change we're doing:
https://github.com/systemd/systemd/pull/18782

This is in systemd 250. The PR there was reverted then remerged so it looks a bit confusing.
This sounds like the same issue until shown otherwise.
Comment 10 Szőts Ákos 2022-04-11 16:48:46 UTC
I have now systemd 250.4 and unfortunately this bug is still there. Are you sure it's an upstream issue?
Comment 11 David Edmundson 2022-05-02 22:16:08 UTC
The bug mentioned was the upstream issue fixed.

The bug you're reporting is either your script/desktop file or a different upstream bug.
Comment 12 David Edmundson 2022-05-02 22:18:01 UTC
Please check  journalctl --user -b after booting.
Or manually invoke systemd-xdg-autostart-generator and review output.
Comment 13 Massimiliano L 2022-06-06 08:31:30 UTC
Works now for me with systemd 250 on Fedora 36 (Plasma 5.24.5).