Modify

Opened 7 years ago

Last modified 4 years ago

#8992 new defect

[patch] dhcpd not starting if router was powered down unexpectedly

Reported by: Vespian Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: packages Version: Backfire 10.03
Keywords: dhcpd Cc:

Description

Pid file of a dead dhcpd instance is not properly handled during the start of the init script. In effect we have dhcpd not starting.

Steps to reproduce:

  1. add dhcpd to the boot init scripts
  2. power down the device
  3. boot the device once again and you get:

root@Engel:~# /etc/init.d/dhcpd start

dhcpd already running with PID 1445

Trivial patch fixing it:

--- ./backfire/staging_dir/target-mipsel_uClibc-0.9.30.1/root-brcm47xx/etc/init.d/dhcpd 2011-03-01 20:49:51.850446799 +0100
+++ ./etc/init.d/dhcpd  2011-03-06 21:23:44.000000000 +0100
@@ -7,8 +7,17 @@ pid_file=/var/run/dhcpd.pid
 
 start() {
        if [ -e $pid_file ] ; then
+               kill -0 `cat $pid_file`
+
+               if [ $? -eq 0 ]; then
             echo "  dhcpd already running with PID `cat $pid_file`"
            return 1
+               else
+                       echo "  PID " `cat $pid_file` not found
+                       echo "  Removing old pid file"
+                       rm -f $pid_file
+               fi
+
         fi
 
        echo Starting isc-dhcpd

Attachments (0)

Change History (3)

comment:1 follow-up: Changed 7 years ago by jow

On all ordinary setups, /var is a ramdisk which never retains data through a reboot so I wonder whether the above problem isn't just theoretical

comment:2 in reply to: ↑ 1 Changed 7 years ago by Vespian

Yeah, but still some of us are using external storage device. I do not think that fixing it will have significant negaive impact on the system's efficiency or/and flash usage, but it can save somebody else some time debugging it once again :)

comment:3 Changed 4 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.