-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
boo#1213156: systemd-xdg-autostart-generator cannot start several existing desktop files in Leap 15.5 #79
base: SLE15-SP4
Are you sure you want to change the base?
Conversation
This introduces `ExitType=main|cgroup` for services. Similar to how `Type` specifies the launch of a service, `ExitType` is concerned with how systemd determines that a service exited. - If set to `main` (the current behavior), the service manager will consider the unit stopped when the main process exits. - The `cgroup` exit type is meant for applications whose forking model is not known ahead of time and which might not have a specific main process. The service will stay running as long as at least one process in the cgroup is running. This is intended for transient or automatically generated services, such as graphical applications inside of a desktop environment. Motivation for this is #16805. The original PR (#18782) was reverted (#20073) after realizing that the exit status of "the last process in the cgroup" can't reliably be known (#19385) This version instead uses the main process exit status if there is one and just listens to the cgroup empty event otherwise. The advantages of a service with `ExitType=cgroup` over scopes are: - Integrated logging / stdout redirection - Avoids the race / synchronisation issue between launch and scope creation - More extensive use of drop-ins and thus distro-level configuration: by moving from scopes to services we can have drop ins that will affect properties that can only be set during service creation, like `OOMPolicy` and security-related properties - It makes systemd-xdg-autostart-generator usable by fixing [1], as obviously only services can be used in the generator, not scopes. [1] https://bugs.kde.org/show_bug.cgi?id=433299
This fixes a bug[1] with some generated autostart app services which fork and exit immediately after main application process start, that caused them not to launch during session startup, as the entire cgroup was immediately killed by systemd. This can also happen with apps such as file browsers, whose initial process will exit after the window is closed, but who intend to leave a daemon child running. Since the forking model of a .desktop application cannot be known at service generation time otherwise, ExitType=cgroup is the only effective way to fix this bug. [1] https://bugs.kde.org/show_bug.cgi?id=433299
…esktops Autostart files which contain the line gnome-autostart-phase are currently completely skipped by systemd. This is because these are handled internally by gnome startup through other means. The problem is a number of desktop files that need to run on KDE too have this flag set. Ideally they should just create systemd user units, but we're not at this point universally yet. This patch changes the logic so if the flag is set, we set NotShowIn-gnome, which in turn would just not load decided at runtime. As an optimisation if we would get conflicting OnlyShowIn lines we still skip the file completely. Example: $ rg 'Exec|Autostart-Phase' /etc/xdg/autostart/gnome-keyring-pkcs11.desktop Exec=/usr/bin/gnome-keyring-daemon --start --components=pkcs11 X-GNOME-Autostart-Phase=PreDisplayServer $ cat '/tmp/xxx/app-gnome\x2dkeyring\[email protected]' [Unit] SourcePath=/etc/xdg/autostart/gnome-keyring-pkcs11.desktop ... [Service] ... ExecCondition=/usr/lib/systemd/systemd-xdg-autostart-condition "Unity:MATE" "GNOME" Co-authored-by: Zbigniew Jędrzejewski-Szmek <[email protected]>
The current start + stop timeouts for xdg autostart files are *very* short with 5s. On a busy system this might be too easy to hit even in unintended case. Apparently, the intention here was to cut the shutdown logic short. (systemd/systemd#27919 (comment)) Let's hence stick to the very short timeout for that (under the assumption that apps are written in a safe enough style to not lose data if killed too early). But for starting XGD autostrat services, use our regular timeouts. See: #27919
waiting "core: fix race condition during startup of a service with ExitType=cgroup" is merged |
…roup This commit allows service_sigchld_event() is executed before service_dispatch_exec_io(), which might happen when a main process exits very quickly. Also do not check PID for service goodness because the main process have already been exited in this case. Fix: #27919
The target branch should be Also the upstream commits should be backported with If you get conflict when cherry-picking the upstream commits, please explain succinctly what you did and why. For trivial context adaptions, "adjust context" is fine. Please have a look at how this is formatted in the other commits. |
That said we're still considering whether it's safe to backport this. |
Back ports a series of patches to resolve xdg-autostart-generator cannot start some desktop files derived from 15.4 (boo#1213156)