3

/var/run/nextdns.sock: connect: no such file or directory

Hello,

I'm running NextDNS CLI version 1.37.3 on pfSense 2.5.2-RELEASE (amd64) successfully. Everything seems to be working well. However, when executing the following, an error is thrown:

[2.5.2-RELEASE][someuser@XXX.XXX]/root: sh -c "nextdns cache-keys"
Error: dial unix /var/run/nextdns.sock: connect: no such file or directory
[2.5.2-RELEASE][someuser@XXX.XXX]/root: sh -c "nextdns cache-stats"
Error: dial unix /var/run/nextdns.sock: connect: no such file or directory

My config is:

[2.5.2-RELEASE][someuser@XXX.XXX]/root: sh -c "nextdns config"
auto-activate true
bogus-priv true
cache-max-age 0s
cache-size 50MB
config XXXXXX
control /var/run/nextdns.sock
detect-captive-portals false
discovery-dns
hardened-privacy false
listen 192.168.1.254:53
listen localhost:53
log-queries false
max-inflight-requests 256
max-ttl 5s
report-client-info true
setup-router false
timeout 5s
use-hosts true

I'd like to be able to inspect the cache-keys and cache-stats. How should I do that please?

9 replies

null
    • Gianpaolo_Racca
    • 2 yrs ago
    • Reported - view

    Hi, I'm experiencing the same behaviour. Did you solve it?

    Thanks

    • Rob_Cork
    • 2 yrs ago
    • Reported - view

    Same issue here on pfsense 22.05

    • Rob_Cork
    • 2 yrs ago
    • Reported - view

    I found a way to work around this bug. I changed my config to have the file created in /tmp

    control /tmp/nextdns.sock
    

    After restarting nextdns i can see the nextdns.sock file is created correctly in /tmp directory. However, running nextdns cache-stats still results in the same error about the file missing from /var/run/nextdns.sock so it appears that this path is hardcoded in the cli. 

    So  i created a softlink to /var/run/netxtnds.sock by running the following command from pfsense shell

    cd /var/run
    ln -s /tmp/nextdns.sock nextdns.sock
    

    Now when running nextdns cache-status it works correctly. I'm not sure if this will survive a reboot but will try and report back.

      • Nitin
      • 2 yrs ago
      • Reported - view

      Rob Cork why would this fix work as it is not a permissions issue. Using your fix, has the issue resolved itself 100% and not reappeared? I am asking because upon reboot, if this file is not created, nextdns does not start up which means no DNS resolution for the network, which is very very painful if I am remote.

    • Rob_Cork
    • 2 yrs ago
    • Reported - view

    This fix does not survive a reboot so i installed the shellcmd pfsense package and added an entry for

    ln -s /tmp/nextdns.sock /var/run/nextdns.sock

    Now after pfsense reboots its working as expected

    • Nitin
    • 2 yrs ago
    • Reported - view

    Facing the same issue. Quite sad to see that no one from nextdns has bothered to even pick this up. As a paying customer, this reduces my confidence and desire to renew.

    • Nitin
    • 2 yrs ago
    • Reported - view

    Created a php script to start nextDNS upon reboot and send out appropriate alerts. Leaving this here in case it helps anyone.

    Note: This will only work on pfSense.

    #!/usr/bin/env php
    <?php
            require_once("/etc/inc/notices.inc");
            # get the current nextDNS status
            exec('nextdns status',$nextdnsStatus, $status);
            if ($nextdnsStatus[0] == "running") {
                    # send alert that nextDNS is ok
                    notify_via_telegram("nextDNS running ok after reboot.");
            } else {
                    # send alert that nextDNS is not ok
                    notify_via_telegram("nextDNS is NOT running after reboot. Attempting to fix...");
                    exec('nextdns start',$nextdnsRestart, $status);
                    exec('nextdns status',$nextdnsStatusPostFix, $status);
                    if ($nextdnsStatusPostFix[0] == "running") {
                            # clean up and create required symlink (hack)
                            exec('rm /var/run/nextdns.sock',$cleanSymlink, $status);
                            exec('ln -s /tmp/nextdns.sock /var/run/nextdns.sock',$symlink, $status);
                            notify_via_telegram("nextDNS running ok after fix.", true);
                    } else {
                            notify_via_telegram("Unable to start nextDNS. Please check the system.");
                    }
            }
    ?>
    
    • Nitin
    • 2 yrs ago
    • Reported - view

    FYI... the script above should be run on pfSense via the "shellcmd" pfsense package @rob_cork referenced above my posts.

    • NextDNs
    • 2 yrs ago
    • Reported - view

    You don't need to create this link, you can pass the -control flag to the cache-keys and cache-stats sub-commands.

Content aside

  • 3 Likes
  • 2 yrs agoLast active
  • 9Replies
  • 365Views
  • 6 Following