Unable to access admin page

Hello guys.

I have just started using Pi-Hole. However I have a slight problem, because I cannot access the administrator page.

I have installed it on a clean Fedora server 24, also tried with Fedora server 25.
When i try to get access to the adminstrator page, I just get a 404 failure.

I have tried to look around on google, found a few different things, but none of it worked.

My debug token is: yaqbx4ioe7.

The response i get from curl -I http://localhost/admin/ is:
HTTP/1.1 301 Moved Permanently
Location: http//localhost/admin
Dte Tue, 18 Jul 2017 09:30:34 GMT
Server: lighttpd/1.4.45

The response I get from Curl -I 127.0.0.1 is:
HTTP/1.1 404 Not Found
X-Powered-By: PHP/7.0.21
Content-type: text-html; charset=UTF.8
Date: Tue, 18 Jul 2017 09:31:57 GMT
Server: lighttpd/1.4.45

I do not have that much experience with linux system, so would love some help.

Thanks guys :slight_smile:

What is the output of:

curl -I http://localhost/admin

Hi Mcat12.

It says in the post, but I'll post it again :slight_smile:

HTTP/1.1 301 Moved Permanently
Location: http://localhost/admin/
Date: Tue, 18 Jul 2017 19:40:24 GMT
Server: lighttpd/1.4.45

You said that was the output of curl -I http://localhost/admin/ (notice the trailing /). Anyways, it looks like you ran the command I posted, which combined with your previous responses seems to be sending you in a loop between /admin and /admin/. Does the browser give you a 404 screen when going to either /admin or /admin/?

I didn't notice the extra / - whoops :slight_smile:

Both with and without the /, it gives me a 404 error.

Thanks for helping out ! :slight_smile:

It looks like dnsmasq is not working, so what is the output of these commands?

sudo service dnsmasq restart
sudo service dnsmasq status

It may be that you have two conf-dir entries in /etc/dnsmasq.conf

Hi Mcat12,

I ran systemctl restart dnsmasq.service. After that I ran systemctl status dnsmasq.service and I got this error.

Jul 19 17:52:56 localhost.localdomain systemd[1]: Started DNS caching server..
Jul 19 17:52:56 localhost.localdomain dnsmasq[8801]: dnsmasq: cannot open log /var/log/pihole.log: Permission denied
Jul 19 17:52:56 localhost.localdomain dnsmasq[8801]: cannot open log /var/log/pihole.log: Permission denied
Jul 19 17:52:56 localhost.localdomain dnsmasq[8801]: FAILED to start up
Jul 19 17:52:56 localhost.localdomain systemd[1]: dnsmasq.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Jul 19 17:52:56 localhost.localdomain systemd[1]: dnsmasq.service: Unit entered failed state.
Jul 19 17:52:56 localhost.localdomain systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

Then I tried to give myself permission to run it, and did the same thing again, getting the same error again.

I used this command to give myself permissions.
chmod -R 755 /var/log
chown -R jakob.jakob /var/log

Anything I can do here?

If you think it would be better to install it on a Ubuntu / Debian I can try that, however I don't own a Raspberry Pi yet.

Thanks again :slight_smile:

The dnsmasq user needs access to the log. Try:

sudo chown dnsmasq:root /var/log/pihole.log

I just get this response:

chown: invalid user: ‘dnsmasq:root’

I tried a couple different ways to do it, but no luck.

Hmm, what is the full output of sudo service dnsmasq status or sudo systemctl status dnsmasq ?

It should work fine:

[jakob@localhost log]$ sudo service dnsmasq status
[sudo] password for jakob:
Redirecting to /bin/systemctl status dnsmasq.service
● dnsmasq.service - DNS caching server.
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-07-19 17:55:05 CEST; 3h 39min ago
Process: 8845 ExecStart=/usr/sbin/dnsmasq -k (code=exited, status=3)
Main PID: 8845 (code=exited, status=3)

Jul 19 17:55:05 localhost.localdomain systemd[1]: Started DNS caching server..
Jul 19 17:55:05 localhost.localdomain dnsmasq[8845]: dnsmasq: cannot open log /var/log/pihole.log: Permission denied
Jul 19 17:55:05 localhost.localdomain dnsmasq[8845]: cannot open log /var/log/pihole.log: Permission denied
Jul 19 17:55:05 localhost.localdomain dnsmasq[8845]: FAILED to start up
Jul 19 17:55:05 localhost.localdomain systemd[1]: dnsmasq.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Jul 19 17:55:05 localhost.localdomain systemd[1]: dnsmasq.service: Unit entered failed state.
Jul 19 17:55:05 localhost.localdomain systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

[jakob@localhost log]$ sudo systemctl status dnsmasq
● dnsmasq.service - DNS caching server.
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-07-19 17:55:05 CEST; 3h 39min ago
Process: 8845 ExecStart=/usr/sbin/dnsmasq -k (code=exited, status=3)
Main PID: 8845 (code=exited, status=3)

Jul 19 17:55:05 localhost.localdomain systemd[1]: Started DNS caching server..
Jul 19 17:55:05 localhost.localdomain dnsmasq[8845]: dnsmasq: cannot open log /var/log/pihole.log: Permission denied
Jul 19 17:55:05 localhost.localdomain dnsmasq[8845]: cannot open log /var/log/pihole.log: Permission denied
Jul 19 17:55:05 localhost.localdomain dnsmasq[8845]: FAILED to start up
Jul 19 17:55:05 localhost.localdomain systemd[1]: dnsmasq.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Jul 19 17:55:05 localhost.localdomain systemd[1]: dnsmasq.service: Unit entered failed state.
Jul 19 17:55:05 localhost.localdomain systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

Both gives the same error.

I see you are running Fedora, do you have SELinux enabled?

Hi DanSchaper,

I'm not sure what SELinux is, but I found a command "/usr/sbin/sestatus" where it says it is enabled.

[jakob@localhost log]$ /usr/sbin/sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 30

Should I try to disable it?

Below one will do that for you (until you reboot):

setenforce 0

But you've made a grave mistake by running the chown and chmod commands recursively (the -R argument).
You changed ownership/permissions for all the log files and folders contained in the /var/log folder.
This might cause problems for the other software needing to write logs to the files that have changed ownership now.
I dont know proper ownership/permits on Fedora to restore/revert this.

Thanks deHakkelaar your command "setenforce 0" made it possible to open up the admin page.

I'll report back if everything is working as it should.

This is an awesome community, thanks for all the help

I'll be sure to donate to you guys within the next couple of days ! :slight_smile:

Lookup the line that says "SELINUX=enabled" and change into "SELINUX=disabled" in below file to make it persistent:

sudo nano /etc/selinux/config