Bug #13217


dhclient using default pid file location which does not exist

Added by Paul Arbour almost 2 years ago. Updated about 1 year ago.

Viktor Gurov
Target version:
Start date:
Due date:
% Done:


Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
Affected Architecture:


The dhclient by default uses the location of /var/run/dhclient/ to store the PID for the client process.
This directory does not exist on the system and so the dhclient will fail to renew IP addresses when it is used.
Specifically in my case, anytime my ISP needs to update my WAN address the dhclient will respawn a new version, because the pid file isn't there to confirm that it exists.

I can see that the code in the scripts that work to spawn and cleanup dhclient are using intelligent lookups to find the PID instead of using the PID file, it seems that dhclient itself doesn't really care how clever those scripts are.

Due to the dhclient being unable to find its own PID, i.e. to decide NOT to run another instance of the client you will end up with multiple dhclients running and will never be able to resolve an IP.

Actions #1

Updated by Viktor Gurov almost 2 years ago

  • Assignee set to Viktor Gurov
Actions #2

Updated by Jim Pingle almost 2 years ago

  • Estimated time deleted (0.50 h)
  • Plus Target Version set to Plus-Next

I checked several systems here and most of them had /var/run/dhclient/ as expected with proper PID files inside, but some did not. I didn't see any obvious differences between the ones that were missing vs the rest that had it.

  • On systems where it was missing it came back on reboot.
  • Some that had it missing were on older versions (back to 2.5.2) and some were dev snapshots (22.05/2.7.0)
  • /var/run is a RAM disk (tmpfs) so it shouldn't matter if the system is UFS or ZFS, the systems where it was missing had both types.
  • Some that had it missing have been up for days, others were updated and rebooted yesterday.
  • Some that had the directory were completely static (no DHCP interfaces), though others that were completely static had it missing.
  • Doesn't seem to matter if WAN or OPT interfaces are the first/only DHCP interface
  • Doesn't seem to matter if any interfaces are DHCPv6
  • No common packages on systems where it's missing vs where it's present

Rather than changing the PID path we pass to the command it seems better to figure out what is wiping out that directory.

The only place I see that explicitly would remove it is in pfSense-rc when it wipes the entire contents of /var/run after creating the RAM disk but that step happens so early at boot that dhclient couldn't be running yet.

Since I'm seeing this even on older versions it's not a (recent) regression and doesn't seem like a release blocker.

Actions #3

Updated by Vitaly Bakulev about 1 year ago

Never seen this with my previous ISP (Beeline), spent a day troubleshooting this with the new ISP (Megafon). Reboot fixed this for a week (Reroot didn't, which I used to avoid connecting a keyboard and inputting a ZFS password), today it happened again at renewal.
Unfortunately, no DHCP client option seemed to influence this behavior, so my input is limited to "happens with some ISPs, doesn't with others".


Also available in: Atom PDF