On Mon, Apr 22, 2019 at 09:31:19AM -0700, Adam Williamson wrote: > On Mon, 2019-04-22 at 09:25 -0700, Adam Williamson wrote: > > On Sat, 2019-04-20 at 07:59 +0000, Zbigniew Jędrzejewski-Szmek wrote: > > > On Fri, Apr 19, 2019 at 04:35:54PM -0400, John Florian wrote: > > > > I'm generally familiar with how systemd presets work but I'm at a > > > > bit of loss as to how part of all the magic works. To best explain > > > > my confusion, let me say that I make a customized live spin of > > > > Fedora and I have a package we'll call "my-dist" which is similar in > > > > nature to the "fedora-release" package in that it provides a custom > > > > preset file. I still use fedora-release because this spin is not > > > > *that* customized, so it's best to think of this as an extension. I > > > > have another package we'll call "my-service" which has a systemd > > > > service unit file and all the usual %systemd_post, etc. macros. > > > > When I boot my live spin I find that my-service is not enabled > > > > despite the preset in my-dist. I can "systemctl preset-all" to > > > > rectify this so I believe most requirements are correct. I do see > > > > that livemedia-creator installs my-service *before* it installs > > > > my-dist so if the %systemd_post is called as each rpm is installed > > > > that would explain my problem because my custom preset isn't present > > > > yet. > > > > > > > > How does Fedora itself accomplish this??? I don't see every package > > > > providing a service having a dependency on fedora-release to address > > > > this ordering issue. I can certainly stick the "systemctl > > > > preset-all" into the %post of my kickstart as final cleanup, but > > > > that feels dirty and wrong. Similarly, I don't wish to have to have > > > > a "Requires: my-dist" in every one of "my-service" and other > > > > packages like it. I've scrutinized fedora-release.spec and didn't > > > > see anything all that different than what I have in my-dist. > > > > > > systemd.rpm does preset-all when it is installed, so it is enough > > > that systemd.rpm is installed after fedora-release-common.rpm. > > > fedora-release-common is required by setup.rpm, so it is installed > > > early. But you raise a good point — I don't see any *explicit* > > > ordering chain between fedora-release-common and systemd. > > > > > > There is no need to order individual rpms against either > > > fedora-release-common and other packages providing presets or > > > systemd. The only thing that is necessary is for systemd.rpm to be > > > installed after all presets. If that is satisfied, packages proving > > > services can be installed both earlier and later and the effect > > > (in the sense of service enablement) should be identical. > > > > AIUI, the design is that any package that *ships a preset* should run > > systemctl preset on it in its scriptlets (there should be guidelines > > for this somewhere but I can't find them right now). There's no explicitly stated rule, afaik, but scriptlets [1] document %systemd_requires and scriptlets are part of the guidelines. [1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_scriptlets > > However, there's a > > loophole here in that if any package that ships a preset gets ordered > > before systemd itself during install, its attempt to run 'systemctl > > preset' will obviously fail. This is why we run 'preset-all' in the > > systemd package scriptlets: to apply the presets for any packages which > > were already installed. It's not intended that all other packages can > > *rely* on the call in systemd's scripts. > > BTW if you're wondering "why not just make sure everything that ships a > preset gets installed after systemd"...sadly there are some awkward > cases that make that not practical, basically 'systemd depends on > something that installs a preset' or 'systemd depends on something that > depends on something that installs a preset'. I think that the attempt to install all packages that provide services after systemd is misguided / outdated. As you say, doing this comprehensively isn't possible because of circular deps. Furthermore, since you restored the call to preset-all, there is no point. The effect is the same in either order. I want to open an FPC ticket to change the guidelines to not require any dependency on systemd for packages that simply provide a service file. Things are complicated by the fact that packages might require systemd for different reasons, e.g. use some systemd helper in installation scriptlets. So we can't simply drop the dependency and ordering on systemd everywhere, but I think we could do it in many places. This will remove some noise, shorten our spec files a bit, and give rpm more freedom to order package installation according to requirements (there will be less requirements, so less loops). I was planning to start the discussion on this after F30 is released, but since we're already discussing this, I'll try to write up a proposal for fedora-devel in the next few days. Zbyszek _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx