[SOLVED] dnsmasq as DHCP server crash under Jessie

Having issues with your DietPi installation, or, found a bug? Post it here.
skyfly555
Posts: 81
Joined: Tue Nov 17, 2015 12:16 pm

[SOLVED] dnsmasq as DHCP server crash under Jessie

Post by skyfly555 »

Seeing there's no answer in one month,
I put this post on the Bug Category.

Bug setting Static IP under Jessie DietPi!!!

BRIEF
I try to create a static IP address as it's supposed to be done under Jessie, but DietPi doesn't have dhcpcd. I see DietPi creates it as Jessie was Wheezy, and this can create troubles to some apps, as dnsmasq, used too by PiHole.

As a secondary effect of this, when I try to use dnsmasq as a DHCP server, dnsmasq gets a SIGTERM signal from some DietPi process and I have to be all the time restarting dnsmasq. When I realize dnsmasq is dead, and PiHole is not working

This doesn't happen in Raspbian Jessie Lite Official Imagehttps://downloads.raspberrypi.org/raspbian_lite_latest. There's dhcpcd and nothing kills dnsmasq.

Can this be solved for the next Dietpi release? This is not good for PiHole neither!


-------------------------------------------------------------------------------------------
LONG EXPLANATION
Sorry, this will be a long post. Just desiring to help (and to be helped).

BACKGROUND
I’m trying to have a RPi 2 as a parental control/router/gateway/proxy/firewall/content filter using 2 ethernet interfaces. Eth0, internal Ethernet, goes to the DSL modem and to the Internet. Eth1, USB 1 Gbit Ethernet TPLINK UE300 to the internal network.

FIRST ISSUES
I was using a non-compatible USB Ethernet dongle, believing it was a compatible ASIX, but it wasn’t. Thanks to Fourdee, I could solve this buying the UE300, which is compatible, out-of-the-box.

DIETPI WHEEZIE ISSUES
I installed everything, dnsmasq, squid, dansguardian… and it seemed to work. I just had some troubles with the USB dongle, as I said before, that I got solved on another post you can find in “troubleshooting” section in this forum.
If you want to check how to configurate this, this is the post: http://dietpi.com/phpbb/viewtopic.php?f=11&t=267
So, encouraged for these good results, I tried to go Jessie.

DIETPI JESSIE ISSUES
I did all the same and dnsmasq is now working a few minutes and then it stops. It’s not the same issue as when I was using the old USB Ethernet dongle (then it was creating a kernel panic). Now, when I use “log-queries” on dnsmasq, it says that it has received a “SIGTERM”, so something is killing dnsmasq. If I restart the dnsmasq service, it works again for some minutes and it receives the SIGTERM message again.

OFFICIAL MINIMAL JESSIE ISSUES
So, I’ve tried it on the official Jessie Raspbian, and it works and doesn’t have this issue. But I’m doing something different.

STATIC IPS ISSUES
If you want to have a static IP under Jessie, you are supposed to do it in a different way. You say to /etc/network/interfaces it’s manual (see code) and go to the dhcpcd.conf and you config there the static IP.
Under Jessie Dietpi I was configuring static IPs as I were using Wheezie (and I realised dietpi-config does it the same way, just modifying /etc/network/interfaces/ the same way I've shown in the other post).
When I tried to do it “the Jessie Way” I realized there wasn’t any dhcpcd.conf, but a dhclient.conf. So I tried to use it as it was dhcpcd.conf but it destroyed all the network config: I couldn’t go into RPi under SSH and it didn’t respond to pings and didn’t got any IP.
How I have set this config under Official Minimal Jessie:
/etc/network/interfaces

Code: Select all

source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug eth1
iface eth1 inet manual
/etc/dhcpcd.conf (leaving eth0 with IP got by DHCP, eth1 static IP)

Code: Select all

interface eth1
static ip_address=192.168.50.1/24
static routers=192.168.50.1
static domain_name_servers=192.168.50.1
NOW IN THIS VERY MOMENT
I have 2 SDs, one with Official Jessie Raspbian, and other one with Dietpi Jessie Raspbian. If there is something I can check or change to DietPi SD, I’ll do it, to get dnsmasq working as a DHCP server under DietPi. The reality is that I would love to have my RPi “parental control router” using Jessie DietPi.

But I think there’s something strange in DietPi Jessie. For example, I tried using dnsmasq as a DHCP+DNS server using PiHole, so I installed Pihole (it’s dnsmasq configured as a DNS server) and then I modified dnsmasq.conf to use eth1 and configured the DHCP server on it, but dnsmasq didn’t give any IP to my Macbook connected to eth1, so I didn’t get DHCP dnsmasq server working.

Thank you very much for your attention and patience reading this long post,
I hope if there's a bug, this post will help DietPi to be improved; and if it's consequence of my ignorance (because as I've said before I'm newbie setting up Linux servers), this will help me to improve and know Linux much better.
Here you can see DietPi is lighter than official "minimal" Jessie: less memory usage, less cpu load, more disk space, 83 (versus 96) processes running, having installed lots of software and dependencies (dnsmasq, squid3, dansguardian, webmin...). DietPi is better!
Webmin statistics on DietPi Jessie
Webmin statistics on DietPi Jessie
Webmin statistics on Official Jessie
Webmin statistics on Official Jessie
Last edited by skyfly555 on Tue Jan 19, 2016 10:40 am, edited 1 time in total.
skyfly555
Posts: 81
Joined: Tue Nov 17, 2015 12:16 pm

Re: [BUG] PiHole crash-Not setting static IP under Jessie Di

Post by skyfly555 »

Solution is installing dhcpcd.

Code: Select all

apt-get install dhcpcd5
and then setting static IP address "Jessie way" I've described before.

Don't care about dhcp installed on dietpi, you won't simply use it.

I'd like to have this solved by Fourdee so not to have to do this every time I install DietPi on a microSD, but it seems it's not interesting for him.
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by Fourdee »

skyfly555 wrote:Seeing there's no answer in one month,
I put this post on the Bug Category.

Bug setting Static IP under Jessie DietPi!!!

BRIEF
I try to create a static IP address as it's supposed to be done under Jessie, but DietPi doesn't have dhcpcd. I see DietPi creates it as Jessie was Wheezy, and this can create troubles to some apps, as dnsmasq, used too by PiHole.

As a secondary effect of this, when I try to use dnsmasq as a DHCP server, dnsmasq gets a SIGTERM signal from some DietPi process and I have to be all the time restarting dnsmasq. When I realize dnsmasq is dead, and PiHole is not working

This doesn't happen in Raspbian Jessie Lite Official Imagehttps://downloads.raspberrypi.org/raspbian_lite_latest. There's dhcpcd and nothing kills dnsmasq.

Can this be solved for the next Dietpi release? This is not good for PiHole neither!


-------------------------------------------------------------------------------------------
LONG EXPLANATION
Sorry, this will be a long post. Just desiring to help (and to be helped).

BACKGROUND
I’m trying to have a RPi 2 as a parental control/router/gateway/proxy/firewall/content filter using 2 ethernet interfaces. Eth0, internal Ethernet, goes to the DSL modem and to the Internet. Eth1, USB 1 Gbit Ethernet TPLINK UE300 to the internal network.

FIRST ISSUES
I was using a non-compatible USB Ethernet dongle, believing it was a compatible ASIX, but it wasn’t. Thanks to Fourdee, I could solve this buying the UE300, which is compatible, out-of-the-box.

DIETPI WHEEZIE ISSUES
I installed everything, dnsmasq, squid, dansguardian… and it seemed to work. I just had some troubles with the USB dongle, as I said before, that I got solved on another post you can find in “troubleshooting” section in this forum.
If you want to check how to configurate this, this is the post: http://dietpi.com/phpbb/viewtopic.php?f=11&t=267
So, encouraged for these good results, I tried to go Jessie.

DIETPI JESSIE ISSUES
I did all the same and dnsmasq is now working a few minutes and then it stops. It’s not the same issue as when I was using the old USB Ethernet dongle (then it was creating a kernel panic). Now, when I use “log-queries” on dnsmasq, it says that it has received a “SIGTERM”, so something is killing dnsmasq. If I restart the dnsmasq service, it works again for some minutes and it receives the SIGTERM message again.

OFFICIAL MINIMAL JESSIE ISSUES
So, I’ve tried it on the official Jessie Raspbian, and it works and doesn’t have this issue. But I’m doing something different.

STATIC IPS ISSUES
If you want to have a static IP under Jessie, you are supposed to do it in a different way. You say to /etc/network/interfaces it’s manual (see code) and go to the dhcpcd.conf and you config there the static IP.
Under Jessie Dietpi I was configuring static IPs as I were using Wheezie (and I realised dietpi-config does it the same way, just modifying /etc/network/interfaces/ the same way I've shown in the other post).
When I tried to do it “the Jessie Way” I realized there wasn’t any dhcpcd.conf, but a dhclient.conf. So I tried to use it as it was dhcpcd.conf but it destroyed all the network config: I couldn’t go into RPi under SSH and it didn’t respond to pings and didn’t got any IP.
How I have set this config under Official Minimal Jessie:
/etc/network/interfaces

Code: Select all

source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug eth1
iface eth1 inet manual
/etc/dhcpcd.conf (leaving eth0 with IP got by DHCP, eth1 static IP)

Code: Select all

interface eth1
static ip_address=192.168.50.1/24
static routers=192.168.50.1
static domain_name_servers=192.168.50.1
NOW IN THIS VERY MOMENT
I have 2 SDs, one with Official Jessie Raspbian, and other one with Dietpi Jessie Raspbian. If there is something I can check or change to DietPi SD, I’ll do it, to get dnsmasq working as a DHCP server under DietPi. The reality is that I would love to have my RPi “parental control router” using Jessie DietPi.

But I think there’s something strange in DietPi Jessie. For example, I tried using dnsmasq as a DHCP+DNS server using PiHole, so I installed Pihole (it’s dnsmasq configured as a DNS server) and then I modified dnsmasq.conf to use eth1 and configured the DHCP server on it, but dnsmasq didn’t give any IP to my Macbook connected to eth1, so I didn’t get DHCP dnsmasq server working.

Thank you very much for your attention and patience reading this long post,
I hope if there's a bug, this post will help DietPi to be improved; and if it's consequence of my ignorance (because as I've said before I'm newbie setting up Linux servers), this will help me to improve and know Linux much better.
Here you can see DietPi is lighter than official "minimal" Jessie: less memory usage, less cpu load, more disk space, 83 (versus 96) processes running, having installed lots of software and dependencies (dnsmasq, squid3, dansguardian, webmin...). DietPi is better!
jessie-dietpi-webmin.png
jessie-minimal-official-webmin.png
A few things:
1) DietPi applies the network settings "The Jessie Way" (https://wiki.debian.org/NetworkConfiguration)
2) dhcpcd is not needed for setting a static IP.
3) dhclient is the dhcp client service installed on DietPi
4) as you are setting up your system to route traffic through 2 eth devices, you will need to install additional software to achieve this.

I would highly suggest you follow a step by step guide for setting up your system as a firewall router, to avoid confusion and false bug reports:
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: [BUG] PiHole crash-Not setting static IP under Jessie Di

Post by Fourdee »

skyfly555 wrote:Seeing there's no answer in one month,
I put this post on the Bug Category.
Must of missed this one.
skyfly555 wrote: Solution is installing dhcpcd.

I'd like to have this solved by Fourdee so not to have to do this every time I install DietPi on a microSD, but it seems it's not interesting for him.
dhclient is installed on DietPi systems and wont be changed. Its your choice to install an alternative DHCP client (eg: dhcpcd).
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
skyfly555
Posts: 81
Joined: Tue Nov 17, 2015 12:16 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by skyfly555 »

Thank you very much for your answer, Fourdee, I'm grateful.

The reality is that I'm following step-by-step tutorials on how to configure a firewall on a RPI and the tutorials I've found say to set an static IP address using dhcpcd under Jessie.

In this post, allfox gave me "the key" https://www.raspberrypi.org/forums/view ... 57#p861457 and when I tried to do that I couldn't under DietPi because there wasn't dhcpcd. Then I tried to use dhclient and I suppose I failed the syntax of dhclient.conf or whatever because it didn't work. Trying to set the static IP directly on /etc/network/interfaces on DietPi didn't work (neither) because dnsmasq got a sigterm signal from somewhere that killed it. And this happened using a USB NIC fully compatible (TPLINK UE300) and seeing as this configuration was working under the official raspbian minimal jessie imagehttps://downloads.raspberrypi.org/raspbian_lite_latest, and was not working under DietPi.

So, I thought It would be great to inform you all about this.

The reality is that I love DietPi and the preinstalled software works great (I've tried Worpress server, OwnCloud, Kodi...) and like-a-charm "out-of-the-box" but my firewall project is going on using the minimal official Jessie Raspbian, not DietPi.

Now, just out of curiosity, I can talk to you about another project I'm working on: it's about installing Chamillo LMS on my RPI 2B as explained in: https://beeznest.com/blog/2015/01/02/ch ... mment-1096
Curiously, yesterday morning I couldn't install NGINX on DietPi (I got an error); again, I went back to the minimal official Jessie Raspbian and it worked perfectly, I could install NGINX and all the other stuff and now Chamillo is working fine, as you can see in this screen capture.
Captura de pantalla 2016-01-20 a las 13.12.21.png
In conclusion, I don't want to be the fly on the anybody's nose (I won't open a new post to talk about my NGINX issue), so now that I understand what DietPi is about, I won't complain about anything anymore, and just go to the official Raspbian if I have issues with my projects.
Of course, if I want to get something included in the DietPi software list running in just a few clicks on my RPI 2B, be sure I'll use DietPi! :D

Thanks for creating this great distro, Fourdee!
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by Fourdee »

I won't complain about anything anymore, and just go to the official Raspbian if I have issues with my projects.
Constructive criticism is great. A wall of text post blaming DietPi for your inability to fully understand and follow a guide is not. You hit a brick wall after playing with configuration files you did not fully understand and instantly blamed DietPi.

My worry is you will hit another brick wall on the Official Raspbian image at some point, then instead of trying to understand the issue, you will simply blame Raspbian and start using another distro.
Trying to set the static IP directly on /etc/network/interfaces on DietPi didn't work (neither) because dnsmasq got a sigterm signal from somewhere that killed it.
This has never been reported by any DietPi users who have installed PiHole. It sounds like you broke dnsmasq by failing to understand what you were actually doing in the configuration files.

There are multiple methods to set networking configurations on linux systems. The way DietPi does it has been used for many years and is still considered "the right way".
Your inability to set a static IP is beyond me. We even created a networking tool in DietPi-Config that does this for you. Maybe you should read the source code to understand how DietPi (and most linux users) achieve this.
yesterday morning I couldn't install NGINX on DietPi (I got an error)
I've created a Git ticket for this and will look into it. Appears there are dependency issues:
https://github.com/Fourdee/DietPi/issues/175
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
skyfly555
Posts: 81
Joined: Tue Nov 17, 2015 12:16 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by skyfly555 »

Hello, Fourdee.

I'm sad reading your words.
Firstly, you are supposing I don't know what I'm doing, or whatever. Secondly, I think you think I want to blame DietPi, that's not the case; on the contrary, I say what I say because I desire to use DietPi for my projects.

So, let's Jacob Salmela from PiHole talk:
Jessie Static IP (first image) as said by Jacob Salmela, creator of PiHole
Jessie Static IP (first image) as said by Jacob Salmela, creator of PiHole
Jessie Static IP (second image) as said by Jacob Salmela, creator of PiHole
Jessie Static IP (second image) as said by Jacob Salmela, creator of PiHole
Wheezy Static IP as said by Jacob Salmela, creator of PiHole
Wheezy Static IP as said by Jacob Salmela, creator of PiHole
You can read this on http://jacobsalmela.com/block-millions- ... -hole-2-0/

Thank you, Fourdee, I'm sorry if I've been a nuisance for somebody, that wasn't my intention, I really thought I wasn't so uninformed,
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by Fourdee »

skyfly555 wrote: You can read this on http://jacobsalmela.com/block-millions- ... -hole-2-0/

Thank you, Fourdee, I'm sorry if I've been a nuisance for somebody, that wasn't my intention, I really thought I wasn't so uninformed,
When you select PiHole for installation on DietPi, it will do the following:
1.png
When you say Yes, it will take you directly there:
2.png
We could not make it any easier for you.

Now if you are following Jake's guide (who is using a less known/newer method of applying static IP's via dhcpcd5), you should ask Jake for support.
For everyone else who wants to install PiHole on DietPi, DietPi will install and configure your system with the ability to set a static IP before installation, using the /etc/network/interface method that has been used for years and provides exactly the same end result.
I'm sad reading your words.
Firstly, you are supposing I don't know what I'm doing, or whatever. Secondly, I think you think I want to blame DietPi, that's not the case; on the contrary, I say what I say because I desire to use DietPi for my projects.
At the end of the day, a simple post of the following would of sufficed:
I want to install PiHole manually on DietPi without using the optimized installation available in dietpi-software. The guide i am following uses dhcpcd5 which is not on the DietPi image. Heres the link to the guide: http://jacobsalmela.com/block-millions- ... -hole-2-0/.
I would appreciate any support.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
skyfly555
Posts: 81
Joined: Tue Nov 17, 2015 12:16 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by skyfly555 »

Dear Dan,

Please, be a knight (and you know you are), because I feel you are disqualifying me. You don't know, but I'm telecom. engineer, been using computers from I was 12(my first one, an Amstrad), installed my first Linux (Slackware) in 96, working with Ubuntu for years, been an ICT manager in school, and the list goes on. It's truth I don't have experience on Linux servers, but I'm experimented on Linux Workstations.

Maybe you don't understand what I'm trying to say, or maybe my english is not good enough to having you understanding me.

I don't need support for doing what I've done. And, please, don't get obfuscated with the PiHole question, I just put it on the topic to try to get the attention of somebody, because you have always been very attentive with all my questions and you have helped me a lot in other posts (I felt very strange not having any feedback for weeks in this post, and, then, I changed the topic title) and you know I have always appreciated your good disposition.

The reason for the long post is just for helping you to get the BUG that is killing dnsmasq when is used as a DHCP server, and not just a DNS server as PiHole does. As it happens under DietPi, and not under the Jessie Official Minimal Raspbian, it HAS to be because there's something to improve on DietPi (yes, this is not happening because I'm st*p*d).

So, do whatever you want, just to tell you I'm not talking about God and angels, but just about things you can check yourself if you try to do them under DietPi and I think I have explained enough how to do it in this post. You can check, and will get the same results as me, be sure.

And, yes, if dnsmasq is killed, PiHole dies with it.

My apologies if my words seem rude, I've tried to be polite,

Thank you very much for your attention,
Trying to be helpful to improve DietPi,
Oscar
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: [SOLVED] PiHole crash-Static IP under Jessie DietPi

Post by Fourdee »

skyfly555 wrote:I don't need support for doing what I've done. And, please, don't get obfuscated with the PiHole question, I just put it on the topic to try to get the attention of somebody
As the issue you are reporting is related to dnsmasq as a DHCP server, I've removed PiHole from the topic title which is purely dnsmasq as a DNS server.
Using false information in your report helps nobody, and creates unnecessary confusion.
The reason for the long post is just for helping you to get the BUG that is killing dnsmasq when is used as a DHCP server, and not just a DNS server as PiHole does.
If you report a bug, we need to know how you have configured the software, which in this case is dnsmasq as a DHCP server.
What is the contents of your /etc/dnsmasq.conf file?
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Post Reply