Unbound - Factory default Failed

Hello,
i tried to run DND ad block on omnia.
I used manual from original turris forum like inspiration with these erors afrer restart command.
/etc/init.d/unbound restart
[1475931358] unbound[5772:0] error: can’t bind socket: Address in use for 0.0.0.0
[1475931358] unbound[5772:0] fatal error: could not open ports
[1475931360] unbound[5773:0] error: can’t bind socket: Address in use for 0.0.0.0
[1475931360] unbound[5773:0] fatal error: could not open ports

So I thought it was an error in my configuration.
At the end of my strength i choose factory reset to begin from the beginning.
But immediately after basic startup config i tried same comand with same result.
Please could you help me how to solve it ? Or can we solve it with some update ?
Thank

You have already some process listening on the port 53 tcp. There can be only one process that is bound to a port.

kresd or unbound run as default resolver. I think kresd is default. They are switched using a config file. See:

https://discourse.labs.nic.cz/t/dnsmasq-local-domain-issue/924/8?u=adminx

I tried to change it in /etc/config/resolver/

resolver 'common'
list interface '0.0.0.0'
list interface '::0'
option port '53'
option keyfile '/etc/root.keys'
option verbose '0'
option msg_buffer_size '4096'
option msg_cache_size '20M'
option net_ipv6 '1'
option net_ipv4 '1'
option forward_upstream '1'
**option prefered_resolver 'unbound'**
option ignore_root_key '0'
option prefetch 'yes'

config resolver 'kresd’
option rundir '/tmp/kresd’
option log_stderr '0’
option log_stdout '0’
option forks ‘1’

config resolver 'unbound’
option outgoing_range '60’
option outgoing_num_tcp '1’
option incoming_num_tcp '1’
option msg_cache_slabs '1’
option num_queries_per_thread '30’
option rrset_cache_size '100K’
option rrset_cache_slabs '1’
option infra_cache_slabs '1’
option infra_cache_numhosts '200’
list access_control '0.0.0.0/0 allow’
list access_control '::0/0 allow’
option pidfile '/var/run/unbound.pid’
option root_hints '/etc/unbound/named.cache’
option target_fetch_policy '2 1 0 0 0’
option harden_short_bufsize 'yes’
option harden_large_queries 'yes’
option key_cache_size '100k’
option key_cache_slabs '1’
option neg_cache_size '10k’
option prefetch_key ‘yes’

/# config resolver ‘unbound_python’
/# list python_script “/etc/unbound/ubmodule-tst.py”

config resolver 'unbound_remote_control’
option control_enable 'no’
list control_interface '0.0.0.0’
list control_interface ‘::0’

/# config resolver ‘unbound_includes’
/# list include_path "/etc/unbound/unbound-part.conf"
list include_path “/etc/unbound/ad_servers.conf”

That still not work with erors that i write before.

There are some more outputs for investigation

root@turris:~# unbound -d -v
[1476011504] unbound[7716:0] notice: Start of unbound 1.5.1.
[1476011504] unbound[7716:0] error: can’t bind socket: Address in use for 0.0.0.0
[1476011504] unbound[7716:0] fatal error: could not open ports
root@turris:~#
root@turris:~#
root@turris:~# netstat -lutnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 4963/unbound
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1710/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2270/lighttpd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2270/lighttpd
tcp 0 0 :::53 :::* LISTEN 4963/unbound
tcp 0 0 :::22 :::* LISTEN 1710/sshd
tcp 0 0 :::443 :::* LISTEN 2270/lighttpd
tcp 0 0 :::80 :::* LISTEN 2270/lighttpd
udp 0 0 127.0.0.1:53 0.0.0.0:* 4963/unbound
udp 0 0 0.0.0.0:67 0.0.0.0:* 1881/dnsmasq
udp 0 0 0.0.0.0:7001 0.0.0.0:* -
udp 0 704 :::546 :::* 1830/odhcp6c
udp 0 0 :::547 :::* 1609/odhcpd
udp 0 0 :::53 :::* 4963/unbound
root@turris:~#
root@turris:~#
root@turris:~# /etc/init.d/unbound start
[1476011514] unbound[7808:0] error: can’t bind socket: Address in use for 0.0.0.0
[1476011514] unbound[7808:0] fatal error: could not open ports
[1476011516] unbound[7809:0] error: can’t bind socket: Address in use for 0.0.0.0
[1476011516] unbound[7809:0] fatal error: could not open ports

root@turris:~# /etc/init.d/unbound restart
rm: can’t remove ‘/var/run/unbound.pid’: No such file or directory

It seems that you already have unbound running with PID 4963:

udp 0 0 :::53 :::* 4963/unbound

And why i can´t restart this service… ?

root@turris:~# /etc/init.d/unbound restart
rm: can’t remove ‘/var/run/unbound.pid’: No such file or directory

But i find it in his dirrectory
root@turris:~# ls -alh /var/run/
drwxrwxrwx 7 root root 440 Oct 9 14:56 .
drwxrwxrwt 18 root root 580 Oct 9 14:56 …
-rw-r–r-- 1 root root 5 Oct 9 14:55 atd.pid
-rw-r–r-- 1 root root 2.4K Oct 9 14:55 config.md5
-rw-r–r-- 1 root root 5 Oct 9 14:56 cron.pid
drwxr-xr-x 2 root root 40 Oct 9 14:55 ddns
drwxr-xr-x 2 root root 60 Oct 9 14:55 dnsmasq
-rw-r–r-- 1 root root 2 Oct 9 14:55 dnsmasq.br-lan.dhcp
-rw-r–r-- 1 root root 985 Oct 9 14:55 fw3.state
drwxr-x— 2 root root 60 Oct 9 14:55 hostapd
-rw-r–r-- 1 root root 469 Oct 9 14:55 hostapd-phy0.conf
-rw-r–r-- 1 root root 5 Oct 9 14:56 lighttpd.pid
drwxr-xr-x 2 root root 0 Oct 9 14:56 mountd
-rw-r–r-- 1 root root 5 Oct 9 14:56 mountd.pid
-rw-r–r-- 1 root root 8 Oct 9 14:56 resolver.name
-rw-r–r-- 1 root root 5 Oct 9 14:56 resolver.pid
drwx------ 2 root root 40 Oct 9 14:55 rpcd
-rw-r–r-- 1 root root 5 Oct 9 14:55 sshd.pid
srw------- 1 root root 0 Oct 9 14:55 ubus.sock
-rw-r–r-- 1 root root 5 Oct 9 14:56 udhcpc-eth1.pid
-rw-r–r-- 1 root root 5 Oct 9 14:56 unbound.pid
-rw-r–r-- 1 root root 5 Oct 9 14:55 wifi-phy0.pid

And dns adblock on turris too not work.

wget ‘http://www.s474n.com/download/Turris/ad_servers.conf’ -O /etc/unbound/ad_servers.conf

At the end of the file /etc/config/resolver i add:
list include_path “/etc/unbound/ad_servers.conf”

I change option prefered_resolver ‘kresd’ to prefered_resolver ‘unbound’,

/etc/init.d/unbound reload
/etc/init.d/unbound restart not work
and ping to any server from this list reply from correct server not from local link.

I have not idea why it not working :confounded:

Try /etc/init.d/resolver restart

As it was quoted, this is the script that is intended to control your configured “preferred resolver” in Turris OS

Same fail it can´t find pid:
/etc/init.d/resolver reload
Called /etc/init.d/unbound reload
cp: can’t stat ‘/var/run/unbound.pid’: No such file or directory

Edit: /reload /restart everythink has same result

root@turris:~# /etc/init.d/resolver restart
Called /etc/init.d/unbound stop
[1476185023] unbound[2808:0] error: can’t bind socket: Address in use for 0.0.0.0
[1476185023] unbound[2808:0] fatal error: could not open ports
[1476185025] unbound[2809:0] error: can’t bind socket: Address in use for 0.0.0.0
[1476185025] unbound[2809:0] fatal error: could not open ports
Called /etc/init.d/unbound start

Please try doing
killall kresd
/etc/init.d/resolver restart

If this solves your problem, contact us at tech<\dot>support<\at>turris<\dot>cz, because that would mean a bug.