Bug 616857
| Summary: | RFE: Make chkconfig try to use systemctl first then use it's own way. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Jóhann B. Guðmundsson <johannbg> | ||||||
| Component: | chkconfig | Assignee: | Bill Nottingham <notting> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | low | ||||||||
| Version: | rawhide | CC: | a.badger, gregswift, mishu, notting, rvokal, slords | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | chkconfig-1.3.51-1.fc15 | Doc Type: | Bug Fix | ||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2011-03-16 04:11:18 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: | |||||||||
| Attachments: |
|
||||||||
|
Description
Jóhann B. Guðmundsson
2010-07-21 14:42:30 UTC
chkconfig-1.3.50-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/chkconfig-1.3.50-1.fc15 This update further broke the draft guidelines for systemd unit files. There's several ways we could work around it.
Description of problem:
The draft scriptlet for upgrading from a service using SystemVinit scripts to the same service using unit files is this:
%post
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
elif [ $1 -ge 2 ] ; then
# Package upgrade
if [ -f %{_initddir}/httpd ] ; then
if /sbin/chkconfig httpd ; then
/bin/systemctl --no-reload enable httpd.service >/dev/null 2>&1 || :
fi
fi
fi
On package upgrade, if there's a sysvinit script, run chkconfig to determine if the init script is enabled. If it is enabled, then run systemctl to register the new unit file.
The problem that now occurs with the script is that when /sbin/chkconfig runs in the %post script, both the SysVinit scripts and the systemd unit files are installed. Since the patch to chkconfig forwards to systemd if systemd unit files are present, we end up asking systemd if the service is enabled via the unit file which it isn't since we haven't yet gotten to the line where we enable it.
Options:
* Rewrite the scriptlets to use triggers instead. Triggers are error prone due to small mistakes in a trigger having unforeseen interactions with updated packages down the road but we could do this.
* Add a command line parameter to chkconfig so that it won't forward to systemd if we specify --no-systemd, for instance. Update the draft Guidelines to use that parameter in the scriptlet.
* Change chkconfig to use SysVinit scripts first and fallback to unit files after. This seems confusing although the Guidelines will state that you should not have both systemd and SysV init scripts in the same package. (A subpackage is fine).
* Revert the patch to chkconfig
reply to comment 2... Has this been thought through by FPC? "The Guidelines will state that you should not have both systemd and SysV init scripts in the same package. (A subpackage is fine)." Yes. If you have a comment on that, ping me on IRC (abadger1999) or in the Guidelines ticket: https://fedorahosted.org/fpc/ticket/31 Created attachment 481456 [details]
Patch to add --no-forward arg
Here's a patch that adds a --no-forward arg to chkconfig. When given, chkconfig does not forward requests to systemd. This touches only code, not documentation. I also don't know whether it makes sense to apply this to both --levels and to --levels [...] on/off but this patch does so. I suppose that if someone has a service installed and wants to use it with a SysV init system, they'll need to have --no-forward on --levels on/off as well.
We have a --no-redirect in /sbin/service... I wonder if it's better to keep the same name/convention. (The idea looks fine.) Created attachment 481742 [details] Patch to add --no-redirect arg * Changed name of parameter to --no-redirect. * Added a man page section for the paramter. Patch applied to a build: http://koji.fedoraproject.org/koji/taskinfo?taskID=2877444 Minimally tested by installing two versions of a package (one with sysv init scripts and one with a systemd unit file) and then running the following commands: chkconfig --add supervisord chkconfig --no-redirect --levels 5 supervisord on chkconfig --levels 5 supervisord echo $? 1 chkconfig --no-redirect --levels 5 supervisord echo $? 0 chkconfig --no-redirect --levels 3 supervisord echo $? 1 chkconfig-1.3.50-1.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report. chkconfig-1.3.51-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/chkconfig-1.3.51-1.fc15 chkconfig-1.3.51-1.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report. |