Bug 1826658
| Summary: | systemd presets request - rpmdb-rebuild | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Panu Matilainen <pmatilai> |
| Component: | fedora-release | Assignee: | Stephen Gallagher <sgallagh> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | rawhide | CC: | dennis, jdisnard, jkeating, kellin, kevin, mboddu, pbrobinson, sgallagh, thrcka, zbyszek |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | fedora-release-33-0.7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-04-29 16:33:56 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1818910 | ||
|
Description
Panu Matilainen
2020-04-22 09:10:37 UTC
I'm not implementing this yet because I took a look at RPM's new rpmdb-rebuild.service and realized that it won't actually work the way you are expecting for upgrades. Two problems: 1) You didn't include the `%systemd_post rpmdb-rebuild.service` (and `%systemd_preun` and `%systemd_postun_with_restart`). As a result, systemd won't set up the service properly. 2) Even once those are added, the service won't get enabled by default because those scripts only run `systemctl preset rpmdb-rebuild.service` on initial package installation. Meaning it won't be enabled during upgrades. (The check is `if [ $1 -eq 1 ] && [ -x /usr/bin/systemctl ] ; then` in `%systemd_post`) Probably we need to get FESCo's permission to do: ``` %post /usr/bin/systemctl enable rpmdb-rebuild.service || : ``` The problem with this approach is that it will result in rpmdb-rebuild.service being enabled unconditionally. It won't be possible to disable it (if for some reason this was desired.) (In reply to Stephen Gallagher from comment #1) > ``` > %post > /usr/bin/systemctl enable rpmdb-rebuild.service || : > ``` Correction: ``` if [ -x /usr/bin/systemctl ] ; then # Initial installation /usr/bin/systemctl enable rpmdb-rebuild.service || : fi ``` (I forgot to include the check for systemctl above) Oh, I know the service addition in current rpm is incomplete due to missing details, just added it to tick of another box from my list while spinning wheels. Looks like my secret plan to evoke feedback from the community is working beyond expectations :P
%post seems like the wrong place to do anything about this as it imposes ordering constraints related to systemd that we absolutely don't want in rpm. It seems to me the right place to do this would be %posttrans instead, maybe:
%posttrans
if [ -x /usr/bin/systemctl ] ; then
/usr/bin/systemctl --no-reload preset rpmdb-rebuild.service || :
fi
Doing this in %posttrans means any new presets will already be there, and so will /usr/bin/systemctl if its to be there at all. Whether this is preferable to explicit enable I dunno. From my point of view it'd certainly be easier to manage if all this was inside rpm.spec and not spread around in multiple places.
Should I just go ahead and file a FESCo ticket for this?
Filed https://pagure.io/fesco/issue/2382, lets see. So... regardless of whether rpm itself ends up needing an exception for its "systemctl preset" calling mechanism, we'll need the preset to be set in fedora-release-common. And AIUI the service itself does not need an exception. Can we just proceed with this part, please? Committed to fedora-release: https://src.fedoraproject.org/rpms/fedora-release/c/e951fe6b674c2daceb3f00c4a0601cb5f214ff2d?branch=master It will be in the next Rawhide build of that package. Built for Rawhide and should be in the next compose. |