Group blocking later fails if blocklists are updated when the group is disabled

The issue I am facing:
This is the weirdest thing, I understand it might be an edge-case but possibly this could be fixed. Would be great if someone could verify this...

  • I have created a group called Focus
  • A blocklist "Distractions" with social media / news etc is created and retrieved 'raw' from Pastebin.
  • This list, Distractions, is assigned to "Focus" group only - not General group.
  • A number of machines are assigned to both the (1) Focus and (2) Default groups from Group Management / Clients settings page.

When I activate the Focus group (under Group Management) all URL's on the "Distraction" list is blocked on machines assigned to the Focus group. This is expected behavior. Great!

Unexpected behavior: If I (1) disable the group Focus in admin interface, and then (2) Update all blocklists (manually with pihole -g or with the scheduled overnight update) the blocking is not activated when I later enable the Focus group.

The group "Focus" is green and Enabled, but blocking of sites on the Distractions list is not happening.

I noticed that when running pihole -g the Distractions list is not retrieved if the "Focus" group is disabled. It is only retrieved if the group is enabled. Possibly related.

Solution: (1) Enable the group "Focus" and (2) Retrieve all blocklists. The Enabled/Disabled toggle on the group Focus now works as expected and sites are blocked/allowed.

Theory: Blocklists assigned to groups disabled when adlists are refreshed/retrieved can not be activated by enabling the group at a later time.

Details about my system:

  • Pi-hole version is v5.5 (Latest: v5.5)
  • AdminLTE version is v5.7 (Latest: v5.7)
  • FTL version is release v5.10.2 (Latest: v5.10.2)
  • Ubuntu 20.04.3 LTS

What I have changed since installing Pi-hole:

  • Nada

Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

Hi, I'm upload the debug log in "unexpected mode"

This is after

  1. Disabling the group in admin interface / Group Management
  2. Reloading all blocklists pihole -g

The toggle in group management enabled/disabled does not work as expected here:
https://tricorder.pi-hole.net/hQKDQLu0/

Tx
/magnus

I can reproduce it.
I need to check the code but I guess it only downloads lists that are enabled and in at least one group that is enabled. It kind of makes sense to download only lists that are currently in use.
On the other hand I can see that this is confusing and uses expect all list that are enabled should be downloaded.

As I thought

The important part is

WHERE adlist.enabled = 1 AND (adlist_by_group.group_id IS NULL OR "group".enabled = 1)

Adlist needs to be enabled AND in the default group (group ID Null) or group is enabled.

Your Focus group has an ID other than 0.

The important questions is: do we want to change it?

Here's my scenario:

  • A new adlist is added to pi-hole and assigned to a group and the group status is active.
  • All adlists are manually refreshed pihole -g - the new adlist is retrieved and processed
  • A number of clients are added to the active group.
  • Blocking works like a dream for all clients in the group. Great.

Then...

  • In the evening I disable the group in the admin interface - no sites from the newly added list for clients in the group are blocked. Expected and great.
  • pi-hole updates all adlists overnight automatically/on schedule while I'm sleeping.
  • Time to go to work and kill all distractions. I enable the group.
  • Surprisingly no sites from the adlist attached to the group are blocked. Not great.

This is what I think why it should be fixed: URL-blocking for the group is disabled when pi-hole updates all the lists and the group is disabled. Switching the group to Enabled does not active the adlist.
The list is "Status: active" in the admin interface and the group is Active, but no sites/ads are blocked.

Expected is that when I activate the group the adlists attached to the group are activated, this does not happen in the above scenario.

They can't be "active" because the relevant data has never been downloaded. I'll write a patch for this, let's see how the discussion precedes.

1 Like

Coin drop. The DB is rebuilt from downloaded & cached & enabled adlists.
Adlists assigned to disabled groups are not pulled into the new DB, even if they are cached/available.
I see the problem - always pull every list available in the admin interface?
I'd say... pull them if status is Enabled on list-level in Group Management / Adlists.

If you like you can try it out. It's based on development branch so expect things to break.
Run

pihole checkout core gravity_download_enabled

To go back to master run

pihole checkout core master

Thank you, have to send the rugrats to bed, I'll try later/tomorrow
/m

We changed the internals of the change a bit. If you still want to try it out, please use

pihole checkout core tweak/vw_adlist

Switched to tweak/vw_adlist, v5.4-34-gb30d729a

[i] Target: https://pastebin.com/raw/[distractionlist]
[✓] Status: Retrieval successful
[i] Analyzed 46 domains

Group switch enabled/disabled behaves as expected,
Thank you!
/magnus

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.