pi-hole on an Orange Pi Zero (temperature readout!)


Recommended Posts

So I just received a couple of Orange Pi Zeros.  I thought for a fun first project I'd port the pi-hole project.  The Pi-Hole project creates a black hole / dns server for your home network that filters out lots of extraneous advertising.  Its a pretty nice project.

 

 Reference: https://pi-hole.net/and https://github.com/pi-hole/pi-hole

 

I ended up using a semi automatic install for pi-hole: 

git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
cd Pi-hole/automated_installer/
bash basic-install.sh

There was one hiccup.  The admin page for the pi-hole (run on your local network) in the browser includes a header that conveniently shows CPU temperature.  Unfortunately the system scans for temperature at location:  /sys/class/thermal/thermal_zone0/temp    From what I can tell, that value on a Raspberry Pi is 1000 times greater than the core temp in deg Celcius.  On the Orange Pi Zero, that reading seems to be straight degrees celcius.  

 

With that said, there is one minor software change to be made... You will change this line:

 
$celsius = intVal($output)*1e-3;
to 
$celsius = intVal($output);
 
at location /var/www/html/admin/header.php   (original source = https://github.com/pi-hole/AdminLTE/blob/master/header.php)  Note: there should be a way to recommend a mod to the pi-hole repository team that says (if orange pi use 1 as the divider, else use 1000) but I'm not aware of what would work there.   Anybody know of a handy technique?
 
pihole_sml.jpg
 
 

 

Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

Sorry.. I should have been more clear.  Is there a setting somewhere that can be used to determine if the internal CPU temperate is stored as degrees Celcius or as milli-degrees Celcius.   We could do a hack, like 

If value is numeric and less than 1, assume the data is milli-degrees C and divide by 1000

But that just seems wrong.  I was thinking there is an internal value stored in that that could be polled to indicate CPU  type / mfgr model / etc...

Link to post
Share on other sites

Hi zipzit,

 

pi-hole looks indeed quite nice - concerning temperature readout - you are not the first :-)

In order to help people with troubleshooting the RPi-Monitor (armbianmonitor - has been packaged with armbian a while ago).

 

To make this monitor work you have to have the right config-file..  so I am sorry but you get a bit to read.

You already have the two links on top, but as you have an H3 you might want to start with this little thread.

 

Some screenshots on CNX

 

Cheers

Tido

Link to post
Share on other sites

Note: there should be a way to recommend a mod to the pi-hole repository team that says (if orange pi use 1 as the divider, else use 1000)

'If it's 1000 or above divide through 1000' is the only reliable method since this is not device but kernel dependant (as soon as you would use 4.x on your H3 devices value would be in millidegree). See also https://github.com/igorpecovnik/lib/blob/master/scripts/armbianmonitor/armbianmonitor#L273-L279

Link to post
Share on other sites

We have since made some changes to the temperature detection code to support more platforms and more approaches to get the information correct no matter what the SBC/OS Distro is. 

 

We stand behind our endeavor and will help out in any way we can.

 

As to the logo, it's now our trademark logo, but I completely understand a non Raspi user not wanting that image on their display! We are trying to get away from being thought of as just a Raspberry solution, but one that will work on many platforms, devices and virtual installations.

Link to post
Share on other sites
9 hours ago, Pi-holeDan said:

We have since made some changes to the temperature detection code to support more platforms and more approaches to get the information correct no matter what the SBC/OS Distro is. 

 

If there's /etc/armbian-release you can always rely on /etc/armbianmonitor/datasources/soctemp but still have to cope with the value either exceeding 1000 (millidegree) or not.

 

BTW: https://github.com/friendlyarm/linux/commit/d4940f17b1cd5dfded32c87d01bf7ac2cb1d26f7#commitcomment-21959223

 

Edit: If you don't want to rely on the existence of /etc/armbian-release this might help (tested and confirmed on +50 SBC with 2 kernel variants -- please keep that in mind that readouts differ based on device and kernel version)

 

Link to post
Share on other sites

Thanks for the links and pointers tkaiser. We're going to have to start depending on being able to detect the distribution releases now, as our static IP addressing was based off the backwards Rasbpian dhcpcd5 method, and that just doesn't work on other platforms that conform to more normal standards of `/etc/network/interfaces`. 

I'll pass this along to the rest of the devs and we'll try to get something worked in.

Link to post
Share on other sites
7 hours ago, Pi-holeDan said:

more normal standards of `/etc/network/interfaces`

 

Oh no! Please don't call /etc/network/interfaces normal, it's just one of many ways. For example on most of my boxes this file is empty in the meantime since all configuration is done in a more modern way with NetworkManager using profiles.

Link to post
Share on other sites

Thanks again for the guidance. We do try to use NetworkManager when we can detect it running, as with our CentOS/Fedora based installs. We'll need to take that in to consideration when we update the installer script to handle IP addressing. (We've also looked at just letting the users set their static IP's or use DHCP leases and just handle creating the IP information when we can see that it's a Raspbian install. We try to help out the users that may not be as savvy with the networking and have just bought a new SBC with little linux knowledge. 

And if we decide to ever roll a distro ourselves, I'm going to push for the Armbian build scripts to help with the process.

Link to post
Share on other sites
On 5/2/2017 at 10:36 PM, tkaiser said:

 

Oh no! Please don't call /etc/network/interfaces normal, it's just one of many ways. For example on most of my boxes this file is empty in the meantime since all configuration is done in a more modern way with NetworkManager using profiles.

 

If there are any ways that we can make Pi-hole and the Pi-hole installer more friendly to the various distributions that use Armbian either directly, or as build sources, please let us know, I can get you my direct email if this isn't something that should be in the forums. Two of the developers personally use NanoPi Neo and I use the Armbian legacy image and love it. But we'd like to be able to run on as many platforms as possible and get away from the conception that we can only function on Berry hardware.

Link to post
Share on other sites
5 hours ago, Pi-holeDan said:

If there are any ways that we can make Pi-hole and the Pi-hole installer more friendly to the various distributions that use Armbian either directly, or as build sources, please let us know,

 

You might want to have a look at the OMV installation function (called as latest step of image creation): https://github.com/armbian/build/blob/master/scripts/customize-image.sh.template and discussion over there: http://forum.openmediavault.org/index.php/Thread/17855-Building-OMV-automatically-for-a-bunch-of-different-ARM-dev-boards/?pageNo=1

 

The idea behind was more or less a PoC to use Armbian's build system for other projects that rely on a Debian/Ubuntu base. I think you're looking into installation/integration in already running OS images. Since @Igoradded Pi-Hole installation already to Armbian's config tool I would think he has an idea what's missing or desirable?

Link to post
Share on other sites
On 22.5.2017 at 1:28 AM, Pi-holeDan said:

If there are any ways that we can make Pi-hole and the Pi-hole installer more friendly to the various distributions that use Armbian either directly, or as build sources, please let us know,

 

In my opinion wrt temperature readouts you should really check for /etc/armbianmonitor/datasources/soctemp first (after latest commit it's only two exceptions any more since I hope @TonyMac32 also thinks about RK3288 legacy kernel here but since they're already catched at board start it's easy to let the job do our startscript).

 

And then the basic recommendation to install your software could be

  • Choose a board that's on Pi hole's list or supported by Armbian
  • Install Armbian
  • run armbian-config --> Software --> "Pi hole"

And I really hope both armbian-config and your installer start to take security -- temp file vulnerabilities -- seriously (and using HTTPS instead of such insane stuff)

Link to post
Share on other sites
Guest
This topic is now closed to further replies.