cirros-dev / cirros

116 stars 33 forks source link

Unable to stop dhcpcd #107

Closed karelyatin closed 11 months ago

karelyatin commented 1 year ago

Cirros version - 0.6.1/0.6.2

Attempt to stop dhcpcd fails as below:-

$ sudo /etc/init.d/S41dhcpcd stop Stopping dhcpcd... no /sbin/dhcpcd found; none killed

OR using $ sudo start-stop-daemon -K -x /sbin/dhcpcd -p /var/run/dhcpcd.pid -o no /sbin/dhcpcd found; none killed

The reason is wrong pid file used:- $ grep PIDFILE= /etc/init.d/S41dhcpcd PIDFILE=/var/run/dhcpcd.pid

The location is different:- $ ls -l /var/run/dhcpcd* total 4 drwxr-xr-x 4 root root 80 Jul 26 14:48 hook-state -rw------- 1 root root 4 Jul 26 14:48 pid srw-rw---- 1 root root 0 Jul 26 14:48 sock srw-rw-rw- 1 root root 0 Jul 26 14:48 unpriv.sock

After fixing the pid file dhcpcd stop works fine:- $ sudo sed -i 's|dhcpcd.pid|dhcpcd/pid|' /etc/init.d/S41dhcpcd $ sudo /etc/init.d/S41dhcpcd stop Stopping dhcpcd... stopped /sbin/dhcpcd (pid 979)

Workaround:- sudo start-stop-daemon -K -x /sbin/dhcpcd -p /var/run/dhcpcd/pid -o