Simple-adblock: fast, lean and fully uci/luci configurable AdBlocking

Yeah the more I look at this, the more I think it's possibly a totally different module that is doing it. Unfortunately I have no way to know which process is calling service dnsmasq restart :frowning: I wish there was a way to know. Perhaps I could add some logging that spit out the parent process id when it was called... Anyways I'm pretty sure it's not your plugin that is calling it at this point based on what you've said.

1 Like

README should have instructions: https://docs.openwrt.melmac.net/

1 Like

still same error after reboot

Sat Feb 11 10:40:50 2023 daemon.err dnsmasq[3856]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Sat Feb 11 10:40:57 2023 user.notice simple-adblock [9004]: ERROR: The service failed to discover WAN gateway!
Sat Feb 11 10:40:57 2023 user.notice simple-adblock [9004]: WARNING: Some recommended packages are missing, install them by running:
Sat Feb 11 10:40:57 2023 user.notice simple-adblock [9004]: opkg update; opkg --force-overwrite install gawk grep sed;
Sat Feb 11 10:40:57 2023 user.notice simple-adblock [9004]: ERROR: The service failed to discover WAN gateway!
Sat Feb 11 10:40:59 2023 daemon.err dnsmasq[9667]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Sat Feb 11 10:40:59 2023 daemon.err dnsmasq[9667]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory

Did you set verbosity to 2 before rebooting?

here is my simple-adblock config and yes verbosity is set to 2.

cat /etc/config/simple-adblock

config simple-adblock 'config'
        list allowed_domain 'cdn.jsdelivr.net'
        option allow_non_ascii '0'
        option canary_domains_icloud '0'
        option canary_domains_mozilla '0'
        option compressed_cache '0'
        option config_update_enabled '0'
        option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update'
        option curl_retry '3'
        option download_timeout '10'
        option debug '0'
        option dns 'dnsmasq.servers'
        option dns_instance '0'
        option force_dns '1'
        list force_dns_port '53'
        list force_dns_port '853'
        option led 'none'
        option parallel_downloads '1'
        option procd_trigger_wan6 '0'
        option verbosity '2'
        list blocked_hosts_url 'https://adaway.org/hosts.txt'
        list blocked_hosts_url 'https://cdn.jsdelivr.net/gh/hoshsadiq/adblock-nocoin-list/hosts.txt'
        list blocked_hosts_url 'https://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'
        list blocked_hosts_url 'https://winhelp2002.mvps.org/hosts.txt'
        list blocked_hosts_url 'https://someonewhocares.org/hosts/hosts'
        list blocked_domains_url 'https://cdn.jsdelivr.net/gh/AdguardTeam/cname-trackers@master/combined_disguised_trackers_justdomains.txt'
        option enabled '1'

That's unexpected, this version should have detected the presence of PPPoE and waited longer.

Are you able to edit the init script on the router to add extra logging?

I will do it if you help me do it.
By the way I am using this custom build of openwrt.

Just update to simple-adblock 1.9.3-9 instead, easier than giving you instructions. :wink:

1 Like

same error

Tue Feb 14 14:37:29 2023 daemon.err dnsmasq[3867]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Tue Feb 14 14:37:36 2023 user.notice simple-adblock [8916]: Status :: interface:  :: gateway:  :: protocol:
Tue Feb 14 14:37:36 2023 user.notice simple-adblock [8916]: ERROR: The service failed to discover WAN gateway!
Tue Feb 14 14:37:36 2023 user.notice simple-adblock [8916]: WARNING: Some recommended packages are missing, install them by running:
Tue Feb 14 14:37:37 2023 user.notice simple-adblock [8916]: opkg update; opkg --force-overwrite install gawk grep sed;
Tue Feb 14 14:37:37 2023 user.notice simple-adblock [8916]: Status :: interface:  :: gateway:  :: protocol:
Tue Feb 14 14:37:37 2023 user.notice simple-adblock [8916]: ERROR: The service failed to discover WAN gateway!
Tue Feb 14 14:37:37 2023 daemon.err dnsmasq[9293]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Tue Feb 14 14:38:51 2023 daemon.err dnsmasq[9293]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Tue Feb 14 14:38:52 2023 daemon.err dnsmasq[9293]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Tue Feb 14 16:56:12 2023 daemon.err dnsmasq[9293]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory

That was actually very informative. Could you please try simple-adblock 1.9.3-10.

Actually simple-adblock 1.9.3-13 with verbosity set to 2. Had to implement the recent oisd.nl changes.

I'd appreciate if you could test the new WAN/up detection quickly as I need to merge the oisd-related changes asap.

2 Likes

its working now

Wed Feb 15 09:37:27 2023 user.notice simple-adblock [8992]: Waiting to discover WAN Interface...
Wed Feb 15 09:37:28 2023 user.notice simple-adblock [8992]: Waiting to discover WAN Interface...
Wed Feb 15 09:37:29 2023 user.notice simple-adblock [8992]: Waiting to discover WAN Interface...
Wed Feb 15 09:37:30 2023 user.notice simple-adblock [8992]: WAN Interface found: 'WAN'
Wed Feb 15 09:37:30 2023 user.notice simple-adblock [8992]: WARNING: Some recommended packages are missing, install them by running:
Wed Feb 15 09:37:30 2023 user.notice simple-adblock [8992]: opkg update; opkg --force-overwrite install gawk grep sed;
Wed Feb 15 09:37:30 2023 user.notice simple-adblock [8992]: WAN Interface found: 'WAN'
Wed Feb 15 09:37:30 2023 user.notice simple-adblock [8992]: Starting simple-adblock 1.9.3-13...
Wed Feb 15 09:37:31 2023 user.notice simple-adblock [8992]: [DL] Blocked Hosts:   cdn.jsdelivr.net [✓]
Wed Feb 15 09:37:32 2023 user.notice simple-adblock [8992]: [DL] Blocked Hosts:   pgl.yoyo.org [✓]
Wed Feb 15 09:37:32 2023 user.notice simple-adblock [8992]: [DL] Blocked Hosts:   adaway.org [✓]
Wed Feb 15 09:37:33 2023 user.notice simple-adblock [8992]: [DL] Blocked Domains: cdn.jsdelivr.net [✓]
Wed Feb 15 09:37:34 2023 user.notice simple-adblock [8992]: [DL] Blocked Hosts:   someonewhocares.org [✓]
Wed Feb 15 09:37:35 2023 user.notice simple-adblock [8992]: [DL] Blocked Hosts:   winhelp2002.mvps.org [✓]
Wed Feb 15 09:37:35 2023 user.notice simple-adblock [8992]: Sorting combined list [✓]
Wed Feb 15 09:37:43 2023 user.notice simple-adblock [8992]: Optimizing combined list [✓]
Wed Feb 15 09:37:43 2023 user.notice simple-adblock [8992]: Allowing domains [✓]
Wed Feb 15 09:37:43 2023 user.notice simple-adblock [8992]: Formatting merged file [✓]
Wed Feb 15 09:37:43 2023 user.notice simple-adblock [8992]: Creating dnsmasq servers file [✓]
Wed Feb 15 09:37:43 2023 user.notice simple-adblock [8992]: Removing temporary files [✓]

after power failure back to same error again. But it worked before after the reboot.

Wed Feb 15 12:28:19 2023 daemon.err dnsmasq[8970]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Wed Feb 15 12:28:20 2023 daemon.err dnsmasq[8970]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory

only these two entries in system log

Doesn't look like OpenWrt even started the simple-adblock. I have no idea why this is happening on the power failure.

If you could re-test with simple-adblock 1.9.3-16, I'd appreciate it, as this is the version I'm going to call 1.9.4-1 and send the PR to the official repo for.

I think it was working after the upgrade.
But after power failure, new error

Thu Feb 16 16:43:38 2023 daemon.err dnsmasq[9033]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Thu Feb 16 16:43:39 2023 daemon.err dnsmasq[9033]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Thu Feb 16 16:46:07 2023 daemon.err dnsmasq[9033]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory

Thanks for a quick check. Just like before, the only errors in the log after the power failure are from dnsmasq, not simple-adblock. It doesn't look like simple-adblock is even starting. Is it enabled in the WebUI: System -> Startup?

In this condition, what does service simple-adblock info produce?

here is the output

[root@dca632 / 51°]# service simple-adblock info
{
        "simple-adblock": {
                "instances": {
                        "main": {
                                "running": false,
                                "command": [
                                        "/bin/true"
                                ],
                                "term_timeout": 5,
                                "exit_code": 0,
                                "data": {
                                        "entries": 0,
                                        "errors": "",
                                        "firewall": [
                                                {
                                                        "type": "redirect",
                                                        "target": "DNAT",
                                                        "src": "lan",
                                                        "proto": "tcp udp",
                                                        "src_dport": "53",
                                                        "dest_port": "53",
                                                        "reflection": false
                                                },
                                                {
                                                        "type": "rule",
                                                        "src": "lan",
                                                        "dest": "*",
                                                        "proto": "tcp udp",
                                                        "dest_port": "853",
                                                        "target": "REJECT"
                                                }
                                        ],
                                        "status": "statusFail"
                                }
                        }
                },
                "triggers": [
                        [
                                "interface.*",
                                [
                                        "if",
                                        [
                                                "eq",
                                                "interface",
                                                "wan"
                                        ],
                                        [
                                                "run_script",
                                                "/etc/init.d/simple-adblock",
                                                "start"
                                        ]
                                ],
                                1000
                        ],
                        [
                                "config.change",
                                [
                                        "if",
                                        [
                                                "eq",
                                                "package",
                                                "simple-adblock"
                                        ],
                                        [
                                                "run_script",
                                                "/etc/init.d/simple-adblock",
                                                "reload"
                                        ]
                                ],
                                1000
                        ]
                ]
        }
}

here are the today's log I guess after power failure.

Fri Feb 17 18:00:08 2023 user.notice simple-adblock [9005]: WARNING: Some recommended packages are missing, install them by running:
Fri Feb 17 18:00:08 2023 user.notice simple-adblock [9005]: opkg update; opkg --force-overwrite install gawk grep sed;
Fri Feb 17 18:00:08 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:10 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:11 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:12 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:13 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:14 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:15 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:16 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:17 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:18 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:19 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:20 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:21 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:22 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:23 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:24 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:26 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:27 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface
Fri Feb 17 18:00:28 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:29 2023 user.notice simple-adblock [9005]: Waiting to discover WAN Interface...
Fri Feb 17 18:00:30 2023 user.notice simple-adblock [9005]: WAN Interface timeout, assuming 'wan'.
Fri Feb 17 18:00:30 2023 user.notice simple-adblock [9005]: Waiting to discover wan Gateway...
Fri Feb 17 18:00:31 2023 user.notice simple-adblock [9005]: Waiting to discover wan Gateway...
Fri Feb 17 18:00:32 2023 user.notice simple-adblock [9005]: Waiting to discover wan Gateway...
Fri Feb 17 18:00:33 2023 user.notice simple-adblock [9005]: Waiting to discover wan Gateway...
Fri Feb 17 18:00:34 2023 user.notice simple-adblock [9005]: Waiting to discover wan Gateway...
Fri Feb 17 18:00:35 2023 user.notice simple-adblock [9005]: Waiting to discover wan Gateway...
Fri Feb 17 18:00:36 2023 user.notice simple-adblock [9005]: ERROR: The service failed to discover WAN gateway!
Fri Feb 17 18:00:36 2023 user.notice simple-adblock [9005]: Starting simple-adblock 1.9.3-16...
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: [DL] Blocked Hosts:   adaway.org [✗]
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: [DL] Blocked Hosts:   winhelp2002.mvps.org [✗]
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: [DL] Blocked Domains: cdn.jsdelivr.net [✗]
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: [DL] Blocked Hosts:   cdn.jsdelivr.net [✗]
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: [DL] Blocked Hosts:   pgl.yoyo.org [✗]
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: [DL] Blocked Hosts:   someonewhocares.org [✗]
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to create /var/run/simple-adblock/dnsmasq.servers file!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: service Fail: Downloading...
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to download https://adaway.org/hosts.txt!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to download https://cdn.jsdelivr.net/gh/AdguardTeam/cname-trackers@master/combined_disguised_trackers_justdomains.txt!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to download https://cdn.jsdelivr.net/gh/hoshsadiq/adblock-nocoin-list/hosts.txt!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to download https://winhelp2002.mvps.org/hosts.txt!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to download https://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to download https://someonewhocares.org/hosts/hosts!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to create /var/run/simple-adblock/dnsmasq.servers file!
Fri Feb 17 18:01:03 2023 user.notice simple-adblock [9005]: ERROR: failed to create block-list or restart DNS resolver!

yes it is enabled.

Again, thanks for checking.

If you could update to version 1.9.4-1 and edit the /etc/init.d/simple-adblock file and on line 213 adjust the wan_if_timeout='20' and try changing 20 to like 60 maybe, that'd be great.

Alternatively, over the weekend I'll post the 1.9.4-2 where it would be editable in the config.

PS. Is there a reason your WAN interface name is capitalized? AFAIK by default all the interface names should be lower case. Not saying it'd help in this matter, just curious.

1 Like

Actually 1.9.4-2 is in my repo, the option name in the config now is procd_boot_wan_timeout, set to 60 by default.

1 Like

smple-adblock is gone from my services list. I don't know how to check it anymore. after the update to 1.9.4-2

I also uninstalled and installed it again.