dhcpcd-discuss

Re: dhcpcd -k causes crash (v. 6.9.0)

Roy Marples

Tue Sep 29 16:00:56 2015

Hi Nickolai

On 29/09/2015 15:56, Nickolai Dobrynin wrote:
> # dhcpcd -k
> sending signal ARLM to pid 1776
> waiting for pid 1776 to exit
> # /etc/init.d/dhcpcd status
>  * crashed

This is not an error with dhcpcd :)
dhcpcd -k (or -x) causes dhcpcd to exit.

Because it exited outside of a command in the init service (guessing
OpenRC here) then the init service rightly thinks it crashed.

The solution is to add a new function to the dhcpcd init script to cater
for this. I'll assume you're using OpenRC, so here's something to add to
the stock template

extra_commands=release
release()
{
        ebegin "Releasing ${name:-$RC_SVCNAME}"
        $command -k
        if eend $? "Failed to release ${name:-$RC_SVCNAME}"; then
                mark_service_stopped
                return 0
        else
                return $?
        fi
}


Then you can do this
/etc/init.d/dhcpcd release

Or you can remove the persistent keyword from /etc/dhcpcd.conf to
release addresses on stop so the /etc/init.d/dhcpcd stop will do the
same as the above.

Hope this helps!

Roy

References:
dhcpcd -k causes crash (v. 6.9.0)Nickolai Dobrynin
Archive administrator: postmaster@marples.name