Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service start dnsmasq always return true #1

Open
mirasrael opened this issue Oct 13, 2016 · 4 comments
Open

service start dnsmasq always return true #1

mirasrael opened this issue Oct 13, 2016 · 4 comments

Comments

@mirasrael
Copy link

In dnsmasq.sh script used command service dnsmasq start || service dnsmasq restart which never restarts server because first part always returns true.
It may be rewritten as:
(service dnsmasq status && service dnsmasq restart) || service dnsmasq start

My configuration:
OS:

NAME="Ubuntu"
VERSION="14.04.3 LTS, Trusty Tahr"
ID=ubuntu

Dnsmasq version 2.68

@johnweldon
Copy link
Contributor

I don't think this is true; while testing this I found that service dnsmasq start returns 1 instead of 0 when dnsmasq is already running. (Additionally, these scripts are copied directly from the upstream hashicorp/c1m repo)

How are you reproducing the behaviour you describe?

@mirasrael
Copy link
Author

mirasrael commented Oct 26, 2016

Hi @johnweldon.

> docker run --privileged -it --rm ubuntu:trusty
root@228c2b6db12f:/# apt-get update && apt-get instal -y dnsmasq
root@228c2b6db12f:/# service dnsmasq start
 * Starting DNS forwarder and DHCP server dnsmasq                                                                                                                                                                                        [ OK ] 
root@228c2b6db12f:/# service dnsmasq start || echo 1
 * Starting DNS forwarder and DHCP server dnsmasq
 * (already running)

As you can see no "1" printed here.

@johnweldon
Copy link
Contributor

Ah, interesting... this is different if you don't use the --privileged flag to docker... in that case you have to modify the dnsmasq.conf file to allow it to start (set user=root), and then the behaviour is different:

root@d27bebcf7201:/# vi /etc/dnsmasq.conf 
root@d27bebcf7201:/# service dnsmasq start || echo 1
 * Starting DNS forwarder and DHCP server dnsmasq                        [ OK ] 
root@d27bebcf7201:/# service dnsmasq start || echo 1
 * Starting DNS forwarder and DHCP server dnsmasq                               
dnsmasq: failed to create listening socket for port 53: Address already in use
                                                                         [fail]
1
root@d27bebcf7201:/# 

Are you seeing this problem in the actual GCE images? I'll do some more experimentation to see if it actually occurs there (i.e. if those images run with the --privileged flag).. if so we'll open a PR upstream to the hashicorp/c1m repo too.

@mirasrael
Copy link
Author

I initially found this issue when installing it on my Virtualbox VM (under vagrant user). So it is not related to --privileged mode only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants