Summary: | sys-apps/openrc-0.11.8 tries to start services multiple times at boot, although if the first attempt failed | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | Thomas Deutschmann (RETIRED) <whissi> |
Component: | OpenRC | Assignee: | OpenRC Team <openrc> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 481672 | ||
Bug Blocks: | |||
Attachments: |
rc.log without any modifications (text version from first picture)
rc.log without "before net" (text version from second picture) rc.log from openrc-0.12 /run/openrc/deptree as requested |
Description
Thomas Deutschmann (RETIRED)
2013-08-14 16:29:50 UTC
Created attachment 356010 [details]
rc.log without any modifications (text version from first picture)
I attached a text version of the first picture (rc.log).
Created attachment 356012 [details]
rc.log without "before net" (text version from second picture)
I attached a text version from the second picture (rc.log).
Can you please upgrade to OpenRC-0.12 and let me know if this is still an issue? Thanks, William Created attachment 356092 [details]
rc.log from openrc-0.12
Hi,
still the same with openrc-0.12. I attached a new, complete rc.log:
shorewall-init is set to start at boot runlevel (and only at boot runlevel), but it isn't configured, so the services denies to start.
When the system enters runlevel default, Gentoo tries to start shorewall-init again, because shorewall-init should start before net (see the depend() function from #1) and this is still unexpected, at least for me.
(In reply to Thomas D. from comment #4) > Created attachment 356092 [details] > rc.log from openrc-0.12 > > Hi, > > still the same with openrc-0.12. I attached a new, complete rc.log: > > shorewall-init is set to start at boot runlevel (and only at boot runlevel), > but it isn't configured, so the services denies to start. > > When the system enters runlevel default, Gentoo tries to start > shorewall-init again, because shorewall-init should start before net (see > the depend() function from #1) and this is still unexpected, at least for me. can you also attach a deptree (/run/openrc/deptree)? Created attachment 356094 [details]
/run/openrc/deptree as requested
/run/openrc/deptree as requested
Let me summarize information. As initscript uses start_pre and fails in it that it's state in stopped. So there is no difference in if this service was started and then failed or not started at all. After runlevel change openrc tries to start all dependencies: because it shorewall-init is in stopped state it's also started. To fix this situation you can mark service as failed manually with 'mark_service_failed' function. The other option is introducing RC_AUTOMATIC variable env that variable that will be set when services is started automatically, and will be unset in case manual of a manual run. Then in case of AUTOMATIC start we can mark service not passing start_pre as failed. I am trying what you said in c7, but it doesn't seem to work, see bug 481672. For testing I created /etc/init.d/test with the following content: #!/sbin/runscript description="Test runscript" start_pre() { einfo "Running start_pre()..." # Normally, we would run checkconfig() here # which will fail (because the service isn't configured # Let us mark the service as failed like suggested by Alexander mark_service_failed "${SVCNAME}" # I think we need to exit here $ Otherwise, our failed status might get overwritten by start() return 1 } start() { ebegin "I am starting" sleep 3 eend $? } stop() { einfo "I am stopping" sleep 3 eend $? } (In reply to Thomas D. from comment #9) > #!/sbin/runscript > > description="Test runscript" > > start_pre() { > einfo "Running start_pre()..." > > # Normally, we would run checkconfig() here > # which will fail (because the service isn't configured > # Let us mark the service as failed like suggested by Alexander > mark_service_failed "${SVCNAME}" You shouldn't need to mark the service as failed because of the return line below. When start_pre fails, the service should be marked failed... > # I think we need to exit here > $ Otherwise, our failed status might get overwritten by start() > return 1 > } > > start() { > ebegin "I am starting" > sleep 3 > eend $? > } > > stop() { > einfo "I am stopping" > sleep 3 > eend $? > } (In reply to William Hubbs from comment #10) > When start_pre fails, the service should be marked failed... The problem is that failed mark is removed on runlevel change. Does any other init script have a dependency on shorewall-init? I checked with Roy on this a while back, and it is working as designed. So I guess the question is, is this something we should change or just document? The problem is like Alexander said in comment 7, that failed mark is removed on runlevel change, right? Is there a reason for not keeping the error state across runlevels or was it done without further intention? If this is really wanted, I would like to hear why. Currently I cannot imagine why this could be wanted. As long as I cannot image why this is wanted I would vote for changing the current design (e.g. keep information about failed services across runlevels), because the current behavior can be dangerous (see comment 0, imagine bootmisc will fail for some reason but re-run later). (In reply to Thomas D. from comment #14) > The problem is like Alexander said in comment 7, that failed mark is removed > on runlevel change, right? You are correct about the fail mark being removed on runlevel changes. > Is there a reason for not keeping the error state across runlevels or was it > done without further intention? I'm not really sure, but I do know that this is a risky change, and it does have the potential of breaking backward compatibility, so I don't want to do anything with it until 1.0. > If this is really wanted, I would like to hear why. Currently I cannot > imagine why this could be wanted. As long as I cannot image why this is > wanted I would vote for changing the current design (e.g. keep information > about failed services across runlevels), because the current behavior can be > dangerous (see comment 0, imagine bootmisc will fail for some reason but > re-run later). Bootmisc will never fail since the start() function always returns 0, so this case will never happen. |