Posted on 2 Comments

PiHole Status Display – Official Raspberry Pi LCD

PiHole Status Display

On my home network I have a system running PiHole – a DNS server that blocks all unwanted traffic, such as ads. Since I have an official Pi LCD with a broken touch panel, I decided to use the bare LCD as a status display for PiHole.

This requires some extra packages installing onto the base system after PiHole is installed & configured, and the interface automatically starts on bootup. I used the latest Raspbian Jessie Minimal image for this system, and ran everything over a SSH connection.

First thing, get the required packages installed onto the Pi:

sudo apt-get update 
sudo apt-get install -y midori matchbox unclutter x11-xserver-utils xinit xserver-xorg

Once these are installed, it’s time to configure the startup script for Midori to display the status page. Create StartMidori.sh in /home/pi and fill with the following:

#!/bin/sh export DISPLAY=:0 
xset -dpms 
xset s off 
xset s noblank 
unclutter & 
matchbox-window-manager & 
midori -e Fullscreen -a http://127.0.0.1/admin/

This script disables all power management on the system to keep the LCD on, starts unclutter to hide the mouse pointer and finally starts the Matchbox Window Manager to run Midori, which itself is set to fullscreen mode, and the URL of the admin panel is provided.
The next step is to test, give the script executable permissions, and run the script:

chmod +x /home/pi/StartMidori.sh
sudo xinit /home/pi/StartMidori.sh

Once this is run, the LCD should come to life after a short delay with the PiHole stats screen. Close the test & return to the terminal by hitting CTRL+C.

Now the Pi can be configured to autorun this script on boot, the first thing to do here is to enable autologin on the console. This can be done with raspi-config, select Option 3 (Boot Options), then Option B1 (Desktop/CLI), then Option B2 (Console Autologin). When prompted to reboot, select No, as we’ll be finishing off the config before we reboot the system.

The next file to edit is /etc/rc.local, add the command to start the status browser up:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
sudo xinit /home/pi/StartMidori.sh &
exit 0

Here I’ve added in the command just above “exit 0”. This will start the browser as the last thing on bootup. The Pi can now be rebooted, and the status display should start on boot!

PiHole Status Display
PiHole Status Display

2 thoughts on “PiHole Status Display – Official Raspberry Pi LCD

  1. This is great; however, I’m having an issue getting it to work on my 3.5″ LCD display that’s connected to the Pi Interface port.

    I get this when I execute the shell script:

    X.Org X Server 1.19.2
    Release Date: 2017-03-02
    X Protocol Version 11, Revision 0
    Build Operating System: Linux 4.9.35-v7+ armv7l Raspbian
    Current Operating System: Linux pihole 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
    Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=640 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo
    Build Date: 20 July 2017 09:07:00AM
    xorg-server 2:1.19.2-1+deb9u1+rpi1 (https://www.debian.org/support)
    Current version of pixman: 0.34.0
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
    Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    (==) Log file: "/var/log/Xorg.0.log", Time: Thu Sep 21 17:34:28 2017
    (==) Using config file: "/etc/X11/xorg.conf"
    (==) Using config directory: "/etc/X11/xorg.conf.d"
    (==) Using system config directory "/usr/share/X11/xorg.conf.d"
    (EE)
    Fatal server error:
    (EE) no screens found(EE)
    (EE)
    Please consult the The X.Org Foundation support
    at http://wiki.x.org
    for help.
    (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
    (EE)
    (EE) Server terminated with error (1). Closing log file.
    xinit: giving up
    xinit: unable to connect to X server: Connection refused
    xinit: server error

    I’ve checked the following:

    /etc/X11/xorg.conf
    It’s empty

    /usr/share/X11/xorg.conf.d
    Also empty

    /etc/X11/xorg.conf.d
    Contains one file called 99-calibration.conf

    It contains this:

    Section "InputClass"
    Identifier "calibration"
    MatchProduct "ADS7846 Touchscreen"
    Option "Calibration" "3936 227 268 3880"
    Option "SwapAxes" "1"
    EndSection

    I’m unsure of where to go with this. Can you offer any pearls of wisdom please?

    1. Hi, which LCD are you using with your Pi? I’m guessing it’s using the GPIO and not either the HDMI/DSI/Composite outputs? My post details operation with the Official 7″ LCD – I don’t have any other types to test with, but with more information I might be able to give some pointers. It seems that XOrg isn’t detecting your display, if you can get XOrg to detect properly it should work fine.

      Cheers, de 2E0GXE

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.