Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dhcpcd-10.0.5 without privsep no longer forks into background #262

Closed
Polynomial-C opened this issue Nov 11, 2023 · 13 comments
Closed

dhcpcd-10.0.5 without privsep no longer forks into background #262

Polynomial-C opened this issue Nov 11, 2023 · 13 comments

Comments

@Polynomial-C
Copy link
Contributor

Polynomial-C commented Nov 11, 2023

This happens on a Gentoo system with netifrc but can easily be reproduced without:

  • run something like dhcpcd -A eth0
  • watch pidof dhcpcd returning nothing
  • Wait till max-lease-time kicks in and see your system no longer having a configured network device.

Bisecting the issue revealed commit c32c88b to be blamed here. Reverting that commit for 10.0.5 release "fixes" this issue.

@Polynomial-C Polynomial-C changed the title dhcpcd-10.0.5 no longer forks into background dhcpcd-10.0.5 without privsep no longer forks into background Nov 12, 2023
@Polynomial-C
Copy link
Contributor Author

I've done more tests and this issue only appears when dhcpcd has been built without privsep support.

rsmarples added a commit that referenced this issue Nov 12, 2023
@rsmarples
Copy link
Member

@Polynomial-C can you test the fix_no_privsep branch please? I can't reproduce your exact issue but I did make a few fixes for non privsep builds.

@Polynomial-C
Copy link
Contributor Author

@rsmarples Unfortunately, the two commits from fix_no_privsep don't help. dhcpcd configures the interface and then exits with no background fork.

@rsmarples
Copy link
Member

I cannot reproduce that. Is dhcpcd crashing somehow maybe that we are not seeing? I'll try and spin up a Gentoo VM next week, but I don't really have much free time.

@Polynomial-C
Copy link
Contributor Author

Running dhcpcd -B -d -A eth0 shows no crashes. The process keeps running till I press CTRL+C.
When calling without -B I don't see anything unusual except that the last line forked to background is missing.

@rsmarples
Copy link
Member

I have reproduced the the issue and am looking working on a fix.

rsmarples added a commit that referenced this issue Nov 13, 2023
For some reason, the stdio callback is extremely flaky on
*some* Linux based distributions making it very hard to debug some
things.
Removing it is fine because we now enforce that we have file descriptors
for stdin, stdout and stdrr on launch and dup them to /dev/null on daemonise.

It's also interesting to see behavioural differences between
some socketpair implementations that emit a HANGUP and some don't.

As such, we now close the fork socket on daemonise once more AND
in the fork_cb depending on if we hangup or read zero first.

Fixes #262
@rsmarples
Copy link
Member

@Polynomial-C should be good now, please test.

@Polynomial-C
Copy link
Contributor Author

@rsmarples: I can confirm. It's fixed now. Thank you very much!

@rsmarples
Copy link
Member

@Polynomial-C Excellent! I've pushed a few more fixes for various OS's so we should be good now.... feel free to re-test ;)

@Polynomial-C
Copy link
Contributor Author

@rsmarples: Re-tested, still good. 👍

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Nov 13, 2023
@peabee
Copy link

peabee commented Nov 30, 2023

May be related..... I think the -b switch causes problems with dhcpcd-10.0.5
Not extensively tested but I have code (not mine) which includes the -b switch which worked fine with 10.0.4 and doesn't work with 10.0.5 (Slackware Current builds) but starts to work again if the -b switch is removed.
Should I report anywhere else?

@pierre-labastie
Copy link

pierre-labastie commented Dec 3, 2023

Using BLFS, I get "dhcpcd_fork_cb: Connection reset by peer", but I think it is the same issue, because it is fixed by the new commits. This issue is rather annoying. Can we expect another release soon?
[EDIT] Actually, it seems "dhcpcd -x" has a problem with current master... It answers "dhcpcd is not running" and does nothing, although "ps aux" shows a "dhcpcd" process... I open a new issue

@rsmarples
Copy link
Member

I'm awaiting on feedback from two issues and I'll make a new release.

pgj added a commit to pgj/freebsd-wifibox-alpine that referenced this issue Mar 28, 2024
`dhcpcd` 10.0.5 has a bug which can cause the daemon fail to fork
in the background on starting up.  Version 10.0.6 fixes the issue,
so move ahead to that.

References:
- NetworkConfiguration/dhcpcd#262
pgj added a commit to pgj/freebsd-wifibox-alpine that referenced this issue Mar 28, 2024
`dhcpcd` 10.0.5 has a bug which can cause the daemon fail to fork
in the background on starting up.  Version 10.0.6 fixes the issue,
so move ahead to that.

References:
- NetworkConfiguration/dhcpcd#262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants