You are here
Franklin Timóteo - Tue, 2022/11/22 - 22:34
I am trying to put in the pihole in TKL. The pihole installation script seems to run normally, but stops at the Pi-hole-FTL engine restart.
root@tkldev .../products/pihole# echo $CHROOT_ONLY
yes
root@tkldev .../products/pihole# make
root@tkldev .../products/pihole# fab-chroot build/root.patched/
Trying manually inside root.patched:
root@tkldev /# bash /usr/local/src/Pi-hole/automated\ install/basic-install.sh
Forum:
Tags:
Hi Franklin, welcome to TurnKey
Hi Franklin, welcome to TurnKey.
That certainly seems like a strange one!?
Unfortunately, it's not uncommon for these sort of generic install scripts to fail on TKLDev. They often don't play nice with TKLDev because they're generally developed with the intention of installation on an end user system, rather than as part of a build process. The TKLDev build environment is essentially just a chroot and doesn't provide a complete "proper" environment as a complete system would. Services in particular are often problematic.
I just had a go myself and whilst it also failed for me, my output looked very different to yours? Mine has the same output (and fails at the same place) as your manual install!? The TKLDev output you show from your automated build appears to be quite different to mine?! Did you enable some debugging setting or something? Here's mine:
Regardless, poking around it appears that the issue is that the systemctl command exits with a non-zero exit code (indicating an error) and because the build process stops on errors, it stops...
I'm not sure what other issue you might encounter, but that one can be worked around by appending ' || true' on the end of the line that calls 'systemctl restart' (so that it never returns a non-zero exit code). Here's a one liner:
(Where path/to/basic-install.sh is the actual path to the script).
After doing that it appears to complete successfully. I haven't tested it's usage at all though.
To get it to a point where the resulting ISO can be used though, you'll likely need to do some additional firstboot config. That will ensure that all the relevant settings are reconfigured for the new installed system.
Thanks for replying Jeremy!
Thanks for replying Jeremy!
The above line did not solve it. But it gave me an idea to remove restart. It seems to have worked.
I think I should add some things like:
Great work! :)
No worries. Sorry I'm not always as quick as I'd like.
Great work on the work around. Glad you got it working. Removing the restart altogether is a great idea.
I can't help much as I'm not at all familiar with pihole, but on face value, your suggestions seem pretty good.
I imagine that you'll also want to set a static IP too (by default a TurnKey server will get an IP via DHCP).
If you know any python, you could create interactive first boot scripts like the ones we provide for other appliances. That's a project we call Inithooks. Beyond reading, you could have a look at another appliance to get a feel for what custom pihole inithooks might look like. E.g. have a look at the overlay/usr/lib/inithooks/ directory of our Domain Controller. They usually consist of one or 2 bash scripts (in /usr/lib/inithooks/firstboott.d) that call a python script (in /usr/lib/inithooks/). If you'd rather not, that's cool, just thought I'd share.
Hello Jeremy
Hello Jeremy!
I am having some problems with the construction.
Initially it seems that localhost:3128 becomes unavailable after some build. After a few seconds/minutes it becomes available again as in the gist below.
https://gist.github.com/franklintimoteo/c256fbcb7e1a6cae80a3e9115bc68834
Setting CHROOT_ONLY=no also does not generate the iso.
If you can, take a look at my repository.
Thanks for the heads up Jeremy!
https://github.com/franklintimoteo/tkl-pihole
I'm not sure, but my guess is squid has crashed
In TKLDev squid is set up as a (caching) download proxy. The output you shared suggests that may have crashed. Check my guess like this
If it has crashed, perhaps the first thing to check is free space:
Sorry, I forgot the variable CHROOT_ONLY in bashrc.d.
Sorry, I forgot the variable CHROOT_ONLY in bashrc.d.
Anyway if you can evaluate the code on github.
Thanks!
I'm not sure if the CHROOT_ONLY would matter
I did a test run of your code and it wasn't working for me. I had a quick look and refactored the build code. Here my changes: https://github.com/franklintimoteo/tkl-pihole/pull/1
As I noted on the PR, I haven't tested the ISO (obviously don't use CHROOT_ONLY if you want to build an ISO).
I was able to understand a little bit
Hello Jeremy!
After your pull request things worked out perfectly.
It took me a while to understand that the inithooks scripts needed to be in python.
https://github.com/franklintimoteo/tkl-pihole/commit/628f4bd342dfe140d4c...
I wonder if the code below makes sense in my tkl. I haven't finished reading my shell book yet.
Much of it I copied from the turnkey-apps scripts, the readability is very good.
I know that the code below could be done with python substitution functions, but it will take about 4-5 lines because of the opening of the file and its manipulation with the line. Using call with sed seems readable to me.
Thank you for your attention to a beginner.
Do you think it would be interesting to have Pi-hole as part of turnkey-apps?
Looks good!
Sorry for slow response. I've been unwell.
All in all, that's looking good. The only ting that jumps out at me is that it won't run non-interactively. But it's an easy fix.
In overlay/usr/lib/inithooks/firstboot.d/40pihole add '--pass="$APP_PASS"' when calling '$INITHOOKS_PATH/bin/pihole.py'. I.e. so it looks like this:
If you're interested in how the non-interactive firstboot preseeds, please have a read of the Inithooks docs.
I get your point around use of sed in python. I'm fine with it for exactly the reason you noted.
I think that Pi-hole would make an awesome TurnKey appliance. You've done a lot of the heavy lifting so it's pretty close. FYI there are a few somewhat minor steps also required. E.g. changelog, README and artwork (logo and screenshots). You can find more info about logos and screenshots in the "artwork" repo.
Beyond that, we'll need to do some closer code review and testing. Unfortunately we're pretty snowed under at the moment and way behind schedule (and being sick last week didn't help...). So I won't make any promises on when we might be able to move this forward. Please open an issue on our issue tracker about the new appliance you have developed. That way it won't get lost or forgotten.
Update on this appliance.
Hello, this is pretty cool that you were able to make a new appliance that worked out the box. I was just going through all of the work you have done and again I am quite impressed because a lot of the information you have online for your new appliance is what I have spent the last part of this year learning about. I was going to offer to help get this appliance on the list for Turnkey, but it looks like you have it almost all done! The only thing that seems to be left is making a tracker issue with the #newappliance label. Since you have already gone through and created a logo, changelog, and readme.rst on github. Please let me know if I can help at all in getting the appliance pushed through and officially released, Franklin Timóteo.
Hello Mattalynn
I did indeed delay the changes. Feel free to send the commits. I will accept them as soon as I can.
The repo is at: https://github.com/franklintimoteo/tkl-pihole
Anyway, I promise to finish it by next week.
Thanks for your interest in the project.
Issue created on github
As expected, I have made the changes and created an issue on github.
I will keep an eye out for any requests for changes. I hope I haven't forgotten something.
https://github.com/turnkeylinux/tracker/issues/1787
https://github.com/franklintimoteo/tkl-pihole
Thanks Franklin. I'll try to have a closer look ASAP.
Thanks Franklin. I've had a quick look and from a glance it looks great, but I'd like to build it locally and do some proper testing. Unfortunately, that likely means that it won't happen until next year (I'm about to take a couple of weeks off). Having said that, if I get a chance, I may even have a look while I'm "not working".
Regardless, thanks heaps for your contribution and I definitely look forward to adding this one to the library! :)
Add new comment