Unbound can't start when …

  • hi

    pfSense2.1.3 / Unbound 1.4.22_2

    i have an Unbound "Custom Options" Rules:

    include: "/tmp/mydnsfile"

    the problem is, when the file is not there unbound can't start … is there a work around, without like shellcmd, to get unbound startet while the file is missing and i put the file later on after unbound has started ?

    pfSense php: /pkg_edit.php: The command '/usr/pbi/unbound-i386/sbin/unbound-control start' returned exit code '1', the output was '/usr/pbi/unbound-i386/etc/unbound/unbound.conf:91: error: cannot open include file '/tmp/mydnsfile': No such file or directory read /usr/pbi/unbound-i386/etc/unbound/unbound.conf failed: 1 errors in configuration file [1399989585] unbound[76018:0] fatal error: Could not read config file: /usr/pbi/unbound-i386/etc/unbound/unbound.conf'


  • Nope the configuration is looking for that file, so if it doesnt exist it doesnt exist and it will fail to start. So your only choice, as you have mentioned, is to make a custom script and have it executed by shellcmd.

  • my workaround at the moment what i use is:

    --- /usr/local/bin/unbound_monitor.sh	2014-05-14 15:05:46.000000000 +0200
    +++ /usr/local/bin/unbound_monitor.sh	2014-05-13 17:53:19.000000000 +0200
    @@ -34,6 +34,11 @@
    +#include workaround?
    +if [ ! -f /tmp/unbound_ad_servers ]; then
    +	touch /tmp/unbound_ad_servers
     if [ -f /var/run/unbound_alarm ]; then
     	rm /var/run/unbound_alarm

    but it would be a more flexible way if you change the source code, i was not looking at the moment, if the file is not there just skip the file and start the process, if i got time i will take a look int othe source code, may a simple check skip function …

    best regards

  • Yes modifying the code can then make anything work. So I can modify the code, but why? What are you trying to do? How would "/tmp/mydnsfile" be created? What is in that file that cant be placed in the custom options section?

  • What are you trying to do?

    my situation is so,
    i dont have have any write storeage on my pfsense (embedded) , and i dont want any additional storage on the pfsense,
    so everytime when pfSense is booting up, and connected successfully to "WAN" ,  pfSense is downloading the "ads" file, called "unbound_ad_servers"(aka /tmp/mydnsfile), from an additional host.

    How would "/tmp/mydnsfile" be created?

    only working with the workaround which i posted before

    What is in that file that cant be placed in the custom options section?

    inside the file i have over 40000 "ads" domains (not static, no static IP's or HOST's)which id like to redirect to some like this:

    local-zone: “adserver.yahoo.com” redirect
    local-data: “adserver.yahoo.com A″

    after the "ads" file has been downloaded to his place like "/tmp/unbound_ad_servers" , unbound automaticly uses the new domains thats nice :)

    so i hope you understand now what id like to do.

    and some additional thinking:
    but even if you have a something else/different inside the "ads" file, can be also used as configuration file instead of holding hosts to block, like a home network configuration … and if you have as example 3 different configuration files for 3 different scenarios , 3 include custom options are then needed, but you like to use only 1 of these 3(1file filled with information the 2 others are 0bytes files and unbound can run,  for your home office and everytime to like to change/switch the configuration you can do this by a file which unbounds reads and is setting the configuration.
    this should be a really flexible way to use unbound to set up configuration for different host, depending if the file has information inside or not.

    best regards

Log in to reply