fix(agent-sec-core): explicitly enable systemd user unit after install#1322
Open
zhangtaibo wants to merge 1 commit into
Open
fix(agent-sec-core): explicitly enable systemd user unit after install#1322zhangtaibo wants to merge 1 commit into
zhangtaibo wants to merge 1 commit into
Conversation
%systemd_user_post calls systemctl preset, which checks the preset policy. Since no preset rule matches agent-sec-core.service, the default action is disable, leaving the unit disabled after package installation. Add explicit 'systemctl --user enable agent-sec-core.service' after %systemd_user_post to ensure the security daemon is enabled on install. Fixes alibaba#1320
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1320
The
%systemd_user_postmacro callssystemctl preset <unit>, which checks the system preset policy. Since no preset rule matchesagent-sec-core.service, the default action isdisable, leaving the unitdisabledafter package installation.This PR adds an explicit
systemctl --user enable agent-sec-core.service 2>/dev/null || trueafter%systemd_user_postin the%post -n agent-sec-clisection to ensure the security daemon is enabled on install.Root Cause
%systemd_user_postexpands to:This only copies the unit file to the user preset directory. It then calls
systemctl preset, which checks/usr/lib/systemd/user-preset/90-systemd.preset. Since no rule in that file matchesagent-sec-core.service, the default action isdisable.Fix
%post -n agent-sec-cli %systemd_user_post agent-sec-core.service +systemctl --user enable agent-sec-core.service 2>/dev/null || trueThe
2>/dev/null || trueensures the scriptlet does not fail if the user session is not available during RPM install.Verification
161859b9)source /root/.cargo/env && bash scripts/rpm-build.sh agent-sec-core→ exit 0, all 8 RPMs produced%postscript in built RPM containssystemctl --user enable agent-sec-core.service 2>/dev/null || trueafter the systemd-update-helper callThis PR was automatically generated by the nightly test pipeline (run
nightly-20260704-020034).