dhclient error - Cannot open or create pidfile: No such file or directory
-
Hi guys,
I recently did a fresh install of pfsense 2.5.2 and have noticed in my dhcp logs the message "Cannot open or create pidfile: No such file or directory" being logged by the dhclient service.
Some googling showed that the folder /var/run/dhclient was missing and having created it and restart the wan interface the error would go away with the system creating the /var/run/dhclient/dhclient.pid file.
On reboot however the dhclient folder is lost and the error returns.
Sorry but I have very little knowledge of FreeBSD and would be grateful if someone can guide me on making /var/run/dhclient persistent across reboots?
Appreciate any assistance with this.
-
@yugisop I have to believe this is something specific to your install - if it was a general sort of issue the forums would be a blaze with threads about it.
I have installed 2.5.2 a few times on VM, and have never run into such an issue.
So this is a clean install on what? Are you using zfs or ufs? Do you have any other packages installed?
-
@johnpoz thanks for the feedback. It's not a major issue as i'm still connected on the wan but ever so often the error is logged.
I'm running on a Qotom-Q355G4 with 4 intel NICs, i5-5200U, 8GB RAM, 32GB SSD with ZFS. No packages installed as yet.
I also have 2.5.2 installed on old Dell PowerEdge server and notice that too does not have /var/run/dhclient folder. Once the folder is created and any changes made to the wan interface the dhclient is able to create the pid file in path /var/run/dhclient/dhclient.pid; however once a reboot takes place the folder goes away and there is no dhclient.pid.
-
You saw this one :
This message can be generated at will, by visiting Status Interfaces, and releasing the WAN (IP) interface, and then renewing it.
The path/folder /var/run/dhclient/ doesn't exist on my pfSense (2.5.2 CE) - or isn't created during boot - or isn't created by the dhcp-client service before it tries to place its pid file there, hence the error.I've seen this message for a long time actually, and didn't notice any side effects.
@yugisop said in dhclient error - Cannot open or create pidfile: No such file or directory:
and notice that too does not have /var/run/dhclient folder. Once the folder is created and any changes made to the wan interface the dhclient is able to create the pid file in path /var/run/dhclient/dhclient.pid; however once a reboot takes place the folder goes away and there is no dhclient.pid.
Create a script file :
[2.5.2-RELEASE][admin@pfsense.local.here]root: ls -al dhcp-client.sh -rwxr-xr-x 1 root wheel 78 Nov 29 08:54 dhcp-client.sh
#!/usr/local/bin/bash mkdir -p /var/run/dhclient/ chmod 755 /var/run/dhclient
and then wake up the magic :
-
@gertjan Thank you for the feedback and suggestion however this does not appear to work.
Still not seeing the folder /var/run/dhclient created after a reboot. Is there a log I can check to ensure the script is executing?
Also is there supposed to a file or folder name bash in the path /usr/local/bin/ ? My installation does not have this.
-
@yugisop said in dhclient error - Cannot open or create pidfile: No such file or directory:
Still not seeing the folder /var/run/dhclient created after a reboot
Strange.
because it's me that should thank you for solving this issue.
The solution works fine for me.I've created a early Shell command :
that runs on boot - early.
The file /root/dhcp-client.sh contains :
#!/usr/local/bin/bash mkdir -p /var/run/dhclient/ chmod 755 /var/run/dhclient
File rights and owner :
-rwxr-xr-x 1 root wheel 79 Nov 29 09:09 dhcp-client.sh
@yugisop said in dhclient error - Cannot open or create pidfile: No such file or directory:
Also is there supposed to a file or folder name bash in the path /usr/local/bin/ ? My installation does not have this.
Oh lol.
Only Microsoft OSs do not have a /usr/local/bin/ folder.
Every other 'computer' on planet earth has a /usr/local/bin/ (I'm not joking ....)I'm not promoting the use of Diagnostics > Command Prompt but you could proof yourself wrong with :
and hit execute.
The result will show 451 files in /usr/local/bin/
And yes, bash is one of them.
Btw : I deleted /var/run/dclient/ folder.
Rebooted pfSense.
The folder was back - recreated, with de pid file in it.Tell me what you did wrong, and I'll tell you what wrong, and it will work for you also
-
@gertjan nearly had a mystery on our hands
script exists in root with correct permissions
file content is as follows
shell command exists
sorry I didn't mean that /usr/local/bin doesn't exists, I meant there was no file or directory named "bash" in /usr/local/bin"
no "bash"did a google search and found a post on freshports.org which said to run
pkg install bash
got bash ? voila!
hit reboot and now I have my dhclient pid file
thank you very much for assisting me in solving this and my apologies about bash as bsd/unix is new to me.
appreciated and cheers
-
@yugisop said in dhclient error - Cannot open or create pidfile: No such file or directory:
assisting me in solving this and my apologies
Stupid me.
I totally forgot that bash isn't installed by default.
The installed default shell 'sh' (in /bin/) would probably also work.
Glad you figured it out. -
@gertjan said in dhclient error - Cannot open or create pidfile: No such file or directory:
The installed default shell 'sh' (in /bin/) would probably also work.
changing
#!/usr/local/bin/bash
to
#!/bin/sh
worked, so don't really need bash :)
on another note was going through some files to determine where the dhclient folder was coming from and found the below but even after deleting dhclient from the pidfile path, pfsense was still trying to put it there.
maybe the devs will resolve this someday...
-
Correct, that's the issue :
The RC (process start stop file) file defines the folder /var/run/dhclient/ without assuring that is exists.
And /var.run/... is a rather volatile place.