Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 479922 - net-misc/dhcpcd-6.0.5 service reconnect attempts during systemd shutdown
Summary: net-misc/dhcpcd-6.0.5 service reconnect attempts during systemd shutdown
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-08-06 13:07 UTC by Ulenrich
Modified: 2013-09-22 18:11 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulenrich 2013-08-06 13:07:03 UTC
My systemd shutdown phase shows in the logs
journalctl -b -1
continuus attempts of dhcpcd.service to reconnect.
I wonder if such change would be fine:

--- dhcpcd.service      2013-08-03 14:07:49.000000000 +0200
+++ dhcpcd.service      2013-08-06 15:02:19.608615974 +0200
@@ -1,7 +1,8 @@
 [Unit]
 Description=Lightweight DHCP client daemon
 Wants=network.target
-Before=network.target
+Conflicts=shutdown.target
+Before=network.target shutdown.target
 
 [Service]
 ExecStart=/sbin/dhcpcd -q --nobackground
Comment 1 Ulenrich 2013-08-06 15:07:01 UTC
Also I receive some kernel segfault when stop.
Wouldn't it be better to:

TimeoutSec=4
KillMode=process
ExecStop=/sbin/dhcpcd --exit

which should invoke a full kill --signal sequence after 4secs after using the 
dhcpcd internal exiting feature.
Comment 2 Ulenrich 2013-08-06 20:06:12 UTC
I don't know why I get this segfault despite stoping dhcpcd gracefully as above described:

Aug 06 21:59:35 maci systemd[1]: Stopping Lightweight DHCP client daemon...
Aug 06 21:59:35 maci dhcpcd[2742]: dhcpcd[2742]: sending signal 15 to pid 332
Aug 06 21:59:35 maci dhcpcd[2742]: dhcpcd[2742]: waiting for pid 332 to exit
Aug 06 21:59:35 maci dhcpcd[2742]: sending signal 15 to pid 332
Aug 06 21:59:35 maci dhcpcd[2742]: waiting for pid 332 to exit
Aug 06 21:59:35 maci dhcpcd[332]: received SIGTERM from PID 2742, stopping
Aug 06 21:59:35 maci dhcpcd[332]: eth0: removing interface
Aug 06 21:59:35 maci dhcpcd[332]: wlan0: removing interface
Aug 06 21:59:35 maci dhcpcd[332]: wlan0: deleting host route to 192.168.1.122 via 127.0.0.1
Aug 06 21:59:35 maci dhcpcd[332]: wlan0: deleting route to 192.168.1.0/24
Aug 06 21:59:35 maci dhcpcd[332]: wlan0: deleting default route via 192.168.1.1
Aug 06 21:59:35 maci systemd[1]: dhcpcd.service: main process exited, code=killed, status=11/SEGV
Aug 06 21:59:35 maci kernel: dhcpcd[332]: segfault at 18 ip 00007f32e5245ae5 sp 00007fff7b3c4580 error 4 in libc-2.17.so[7f32e51c7000+1a7000]
Aug 06 21:59:39 maci systemd[1]: dhcpcd.service stopping timed out. Terminating.
Aug 06 21:59:39 maci systemd[1]: Stopped Lightweight DHCP client daemon.
Aug 06 21:59:39 maci systemd[1]: Unit dhcpcd.service entered failed state

I can reconnect with "systemctl start dhcpcd" without problem though ...
Comment 3 William Hubbs gentoo-dev 2013-08-17 21:22:36 UTC
Roy,

I know you can't tell me the specifics about the systemd unit, but, you
can tell me whether it matters how dhcpcd is killed. Should we use

dhcpcd --exit

to bring dhcpcd down? (this will affect the OpenRC init script as well).

Also, I am concerned about the seg fault message, it looks like it might
be dhcpcd seg faulting.

Thanks,

William
Comment 4 Roy Marples 2013-08-18 12:58:28 UTC
dhcpcd --exit is fine

The segfault is a bug though.
Is a /dhcpcd.core generated? If so, can you post a decent backtrace of the crash?
Comment 5 Ulenrich 2013-08-18 22:37:57 UTC
@Roy, hmm no dhcpcd.core. Does it depend on some kernel .config
(I disabled core dumps)?

I can confirm downgrading to stable dhcpcd-5.6.4 doesn't produce any segfault with following /etc/dhcpcd.conf:
---
hostname
# option rapid_commit
# I had rapid_commit with dhcpcd-6
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
nohook lookup-hostname
option interface_mtu
noipv4ll
ipv4only
interface wlan0
ssid secondary
static ip_address=192.168.2.88
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
release
ssid primary
static ip_address=192.168.1.122
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
release
---
This way I have a primary 192.168.1.122 and
a fallback fallback wlan 192.168.2.1
if I set according /etc/wpa_supplicant/wpa_supplicant.conf.
Is there something wrong with this setup?
Comment 6 Roy Marples 2013-08-19 08:34:24 UTC
I think you need to enable kernel core dumps to get a crash dump.
Also, depending on your config you may need to do `ulimit -c` before calling dhcpcd (unsure how todo this from systemd).

I'll look into testing your config when time permits to see if that's the cause.
Comment 8 Ulenrich 2013-08-19 10:53:58 UTC
@Roy, thanks for the fix! 

Works with USE flag -ipv6, 
but as the fix is patching only ipv4.c 
the segfault should be fixed for all.
Comment 9 William Hubbs gentoo-dev 2013-08-23 19:43:17 UTC
 The patch for the segfault is encorporated into dhcpcd-6.0.5-r1.
Comment 10 William Hubbs gentoo-dev 2013-09-22 18:11:15 UTC
Since the segfault is fixed in 6.0.5-r1 and 6.1, I am closing this bug.
If you have other issues, please open bugs for them, one per issue.

Thanks much,

William