Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    dhclient error - Cannot open or create pidfile: No such file or directory

    DHCP and DNS
    3
    10
    4.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yugisop
      last edited by

      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.

      johnpozJ 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @yugisop
        last edited by

        @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?

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

        Y 1 Reply Last reply Reply Quote 0
        • Y
          yugisop @johnpoz
          last edited by

          @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.

          GertjanG 1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan @yugisop
            last edited by

            @yugisop

            You saw this one :

            d7cfa961-6540-4b20-b08a-50794b2f8e5c-image.png

            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 :

            6f7544c1-e3cc-44ec-978a-790eafe93a44-image.png

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            Y 1 Reply Last reply Reply Quote 1
            • Y
              yugisop @Gertjan
              last edited by

              @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.

              GertjanG 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @yugisop
                last edited by

                @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.

                f218dd10-8cf8-4506-a492-576640c3fc89-image.png

                I've created a early Shell command :

                f51418f3-2500-4163-a04f-f28a133958a9-image.png

                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 :

                2b2136e0-f7e8-4ec7-ba87-cb3b3232d45b-image.png

                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.

                c863d3fd-75aa-4797-8384-16b652b38480-image.png

                Tell me what you did wrong, and I'll tell you what wrong, and it will work for you also ๐Ÿ˜Š

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                Y 1 Reply Last reply Reply Quote 0
                • Y
                  yugisop @Gertjan
                  last edited by

                  @gertjan nearly had a mystery on our hands ๐Ÿ˜•

                  script exists in root with correct permissions
                  img1.png

                  file content is as follows
                  img2.png

                  shell command exists
                  img3.png

                  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"
                  img4.png
                  no "bash" ๐Ÿ˜ต

                  did a google search and found a post on freshports.org which said to run

                  pkg install bash
                  

                  gotbash.png

                  got bash ? voila!
                  bash.png

                  hit reboot and now I have my dhclient pid file ๐Ÿ˜
                  pid_is_here.png

                  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 ๐Ÿ‘

                  GertjanG 1 Reply Last reply Reply Quote 0
                  • GertjanG
                    Gertjan @yugisop
                    last edited by

                    @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.

                    No "help me" PM's please. Use the forum, the community will thank you.
                    Edit : and where are the logs ??

                    Y 1 Reply Last reply Reply Quote 0
                    • Y
                      yugisop @Gertjan
                      last edited by

                      @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...

                      etcrcd.png

                      GertjanG 1 Reply Last reply Reply Quote 0
                      • GertjanG
                        Gertjan @yugisop
                        last edited by

                        @yugisop

                        Correct, that's the issue :

                        994d1e61-5340-4b01-8c79-f35c06fceed4-image.png

                        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.

                        No "help me" PM's please. Use the forum, the community will thank you.
                        Edit : and where are the logs ??

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.