Red Hat Bugzilla – Bug 431231
upstart: no mechanism for cross-system dependencies
Last modified: 2014-06-18 04:46:09 EDT
If we try to move some of our current rcX scripts to 'native' upstart scripts,
this will break dependencies, as you can't (as far as I can tell) properly
express dependencies between the two systems.
Fixing this may require rewriting /etc/rc after all.
we can add scripts to the runlevels which trigger upstart events at certain
milestones. Then we can have upstart services set to "start on stage1complete".
It may get ugly, but once most or all of the upstart jobs are in place it will
clean up easily.
It's the 'once most or all' that worries me, it makes it a very much all or
The intermediate time will be fine, there will just be a bit more crap in the
event files than we like and a bit of minor ugliness in a few of the scripts
(nothing compared to what's there already).
Can you give an example of how you'd handle this? Say, you have something that
has Required-Start: ntp
but ntp is now a upstart event.
There's some issues with this right now, but here is the idea...
At the beginning of the script:
initctl emit ntp
initctl event | grep -C1 "started ntp"
The emit is obvious enough. intctl event normally blocks forever, just listing
away events as they occur, but the grep will exit after the first matching line,
SIGEPIPEing the initctl.
The issue with this is for some reason initctl doesn't seem to write any output
when piped. Perhaps a security feature? expect could solve this, but I haven't
used it much.
Right, but then the old SysV init script that depended on ntp would need to
conditionally include that.
Did you know that emit will block until all jobs that react to the event have
been started and/or finished? The "grep" bit shouldn't be necessary.
Well that does make it simpler :)
(In reply to comment #6)
> Right, but then the old SysV init script that depended on ntp would need to
> conditionally include that.
I'm still not certain I understand your argument here. We just add the emit line
to the file. Its effectively a noop if ntp is already running. There's no
Your suggestion seems to be for the case of an upstart script that requires a
SysV script. I was asking about a SysV script that requires an upstart script,
and how that can be done *without changing the existing SysV script*.
(In reply to comment #10)
> Your suggestion seems to be for the case of an upstart script that requires a
> SysV script. I was asking about a SysV script that requires an upstart script,
> and how that can be done *without changing the existing SysV script*.
My suggestion was for the latter, and either way the solution is the same. For
the first its "Tell upstart to start the things I need" and for the second its
"tell upstart to start the things that need me"
Right, but it means that all things that have sysv dependencies would need
modified if any of their deps move to upstart (or just modified wholesale). That
isn't very practical.
Ah, I see your point.
Hmm, given what we've explored here, its probably fairly easy to modify /etc/rc
to just send an event before each script is started and then hold off starting
it until the event has been responded to. I'll play with it tonight or tomorrow.
Another thought, what if we (Scott, put the tea down) put an initctl emit $0
line at the end of the "functions" include? It would end up in the right place
in just about every file, though doing such a thing might cost us our eternal souls.
Created attachment 295697 [details]
Patch to /etc/rc to add events
Here is a modified /etc/rc that generates the necessary upstart events for
every service. I moved all the events into a "sysv." namespace, which I think
will make life easier during the transition.
Bill, if you approve, we can build a new initscripts package with this and
close the bug.
Hm. While I understand the idea of separating things into a sysv namespace, it
would mean that any dependent upstart events would actually need editing if the
event moved from sysv to upstart. So we may not want to separate them.
Also, of course, it's only half of the issue.
What half are we missing?
That fixes upstart-event-depends-on-sysv, not sysv-event-depends-on-upstart.
Unless I'm missing something.
We can still make init scripts block on upstart events.
So it would go like this: If ntp is moved to an upstart event, we still have an
ntp sysvinit script. That script just starts the upstart event and waits for it
to come up.
We should be able to develop events in this way without having to think much
about sysvinit. Then one day the sysv scripts just go away.
A version of your patch added in initscripts git. We'll see how it works.
Ideally it would go in init.d/functions for everything to use, but that's not
really practical as that doesn't wrap start/stop/etc.
what are thoughts on this now that its been around a bit?
Well, we emit events for sysv scripts now. I think that's probably as good as
we're going to get for the moment.
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
changing back to rawhide
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.
More information and reason for this action is here:
Closing per Bill's comment as of 2008-03-17.