anudeepND / whitelist

A simple tool to add commonly white listed domains to your Pi-Hole setup.
MIT License
4.17k stars 283 forks source link

File not found? Is this correct? #264

Closed Lonewolf147 closed 10 months ago

Lonewolf147 commented 10 months ago

I have pihole up and running, i've tried to set up the auto updater, and when the whitelist.py script runs, this is the return that I'm getting:

This script will download and add domains from the repo to whitelist.
All the domains in this list are safe to add and does not contain any tracking or adserving domains.

[i] Pi-hole path exists
[i] Write access to /mnt/user/appdata/pihole verified
[i] Legacy Pi-hole detected (Version older than 5.0)
[i] Collecting existing entries from whitelist.txt
[i] 191 existing whitelists identified
[i] Existing anudeep-whitelist install identified
[i] Removing previously installed whitelist
[i] Syncing with https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/whitelist.txt
[i] Outputting 191 domains to /mnt/user/appdata/pihole/whitelist.txt
[i] Done - Domains are now added to your Pi-Hole whitelist

[i] Restarting Pi-hole. This could take a few seconds
Traceback (most recent call last):
File "/opt/whitelist/scripts/whitelist.py", line 388, in
restart_pihole(args.docker)
File "/opt/whitelist/scripts/whitelist.py", line 60, in restart_pihole
subprocess.call(['pihole', '-g'], stdout=subprocess.DEVNULL)
File "/usr/lib64/python3.9/subprocess.py", line 349, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pihole'

Is everything listed after the Traceback correct? Why is there a filenotfounderror?

Thanks

Technetium1 commented 10 months ago

That probably should not happen. It cannot find pihole in path 🤔 Maybe should add more about how and where this is running pihole.

Lonewolf147 commented 10 months ago

Here's the script in unraid that I'm running

#!/bin/bash
docker exec pihole /bin/bash
sudo python3 /opt/whitelist/scripts/whitelist.py

I just have it set to run once a week.

Technetium1 commented 10 months ago

@Lonewolf147 try instead docker exec -it https://docs.docker.com/engine/reference/commandline/exec/#run-docker-exec-on-a-running-container You might be running the last line on unraid itself?

Lonewolf147 commented 10 months ago

Now my problem has changed a bit. Now it won't even run because when the scripts drops down into the pihole bash, it no longer recognizes the Python3 command. If I drop down into root, then python can't find the Whitelist.py script (I just have no idea where things created in the dockers is located via root).

EDIT: Messing around, I finally found a way to get it to run. I changed my script to this command

#!/bin/bash
cd ..
sudo python3 whitelist/scripts/whitelist.py --dir ./mnt/user/appdata/pihole/pihole/ --docker