# dhclient and /var/run/dhcp directory

## cwr

On startup dhclient tries to write a pid file into /var/run/dhcp; since /var/run

is now a tmpfs the directory doesn't exist, and the attempt fails.  The solutions

seem to be either patch dhclient to make the /var/run/dhcp directory if it doesn't

exist, or create the directory at each startup in /etc/local.d.  Which approach

do people usually use?

Thanks - Will

----------

## khayyam

 *cwr wrote:*   

> On startup dhclient tries to write a pid file into /var/run/dhcp; since /var/run is now a tmpfs the directory doesn't exist, and the attempt fails.  The solutions seem to be either patch dhclient to make the /var/run/dhcp directory if it doesn't exist, or create the directory at each startup in /etc/local.d.  Which approach do people usually use?

 

cwr ... I don't use dhclient, and so haven't encountered this issue, however I think the method of dealing with such things is via tempfiles.d. sys-apps/openrc-0.11.x brought with it /etc/init.d/tmpfiles.setup and /lib/rc/sh/tmpfiles.sh, a reimplementation of systemd's 'tmpfiles.d', I haven't looked at it and so can't provide any advice as to how it works, or how you might go about configuring it, but hopefully its a point in the right direction.

best ... khay

----------

## Bones McCracker

```
ln -s /run /var/run
```

----------

## khayyam

 *BoneKracker wrote:*   

> 
> 
> ```
> ln -s /run /var/run
> ```
> ...

 

BoneKracker ... that sym-link should already exist. The issue is with whats within it (ie, nothing, as its tmpfs), and dhclient expects a dir there. That is what tempfiles-setup is now used for.

best ... khay

----------

## Bones McCracker

Sorry.  Just me being hasty and stupid.  I wasn't aware of this and only recently stopped using dhclient on one of my machines, but it was a stable branch setup.  I apologize for not reading your answer more carefully before sticking my nose in.

----------

## cwr

Something odd's going on, since dhclient sometimes complains and sometimes

just uses /run rather than /run/dhcp.  I'll keep digging - a man page for

tmpfiles-setup would have been nice.

Thanks for the pointer - Will

----------

## khayyam

 *cwr wrote:*   

> Something odd's going on, since dhclient sometimes complains and sometimes just uses /run rather than /run/dhcp.

 

cwr ... that doesn't sound normal to me.

 *cwr wrote:*   

> I'll keep digging - a man page for tmpfiles-setup would have been nice.

 

The link I provided above is for the systemd implimentation, and as the openrc implimentation is 100% compatable there should be no issues following the example there.

best ... khay

----------

