Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 667428 - net-dns/unbound fails to start if control-interface directory doesn't exist, instead of creating the requisite directory
Summary: net-dns/unbound fails to start if control-interface directory doesn't exist, ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Marc Schiffbauer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-01 05:15 UTC by Michael Moon
Modified: 2020-12-30 19:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Moon 2018-10-01 05:15:26 UTC
# service unbound start
unbound            | *   Checking unbound configuration ...                                                                                                                                                                                             [ ok ]
unbound            | *   Starting unbound daemon ...
unbound            |[1538370182] unbound[28258:0] error: Cannot bind local socket /var/run/unbound/control (No such file or directory)
unbound            |[1538370182] unbound[28258:0] error: cannot open control interface /var/run/unbound/control 8953 : protocol not supported
unbound            |[1538370182] unbound[28258:0] fatal error: could not open ports
unbound            | *   start-stop-daemon: failed to start `/usr/sbin/unbound'
unbound            | *   Failed to start unbound daemon                                                                                                                                                                                                 [ !! ]
unbound            | *   ERROR: unbound failed to start

Simply inserting mkdir -p "$(dirname "$(getconfig control-interface /var/run/unbound/control)")" into /etc/init.d/unbound:start_pre() sorts it nicely.
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2018-10-05 03:21:52 UTC
This doesn't work if "control-interface" is set to an interface which is more common.

I tend to reject this. I suggest to use opentmpfiles service, e.g. create 

/etc/tmpfiles.d/unbound.conf

with

> d /var/run/unbound 0750 unbound unbound -

as content for example.
Comment 2 Michael Moon 2018-10-05 04:33:32 UTC
I've never heard of /etc/tmpfiles.d before, I guess it could work?

I don't have opentmpfiles-setup in any of my runlevels though so apparently it may not be a default service in openrc and affected users would still have to hunt down this bug and rc-update..

Fwiw, most other init scripts use 'checkpath' function for this. If that's no longer the appropriate way, should they all be changed too?
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2018-10-05 04:40:29 UTC
opentmpfiles is a default service for some time now. Not sure why it isn't enabled on your system.

> Fwiw, most other init scripts use 'checkpath' function for this. If that's no longer the appropriate way, should they all be changed too?

It depends:

"checkpath" is a OpenRC thing. So especially when the same is needed for systemd I prefer tmpfiles.d solution.

In this specific case using checkpath isn't an option because when you have set

> control-interface 1.2.3.4

in your config, the mkdir call wouldn't be what you want. In other words: If we do that in runscript we must be 100% sure that it will work for everyone, not just for you who has set a valid path. :)
Comment 4 Michael Moon 2018-10-05 04:48:48 UTC
> opentmpfiles is a default service for some time now. Not sure why it isn't enabled on your system.

Apparently it only got pulled in in mid-february while this install is more than a year old, and Gentoo isn't in the habit of silently adding to my startup scripts for me.

> In this specific case using checkpath isn't an option because when you have set
> 
>> control-interface 1.2.3.4
> 
> in your config, the mkdir call wouldn't be what you want. In other words: If we do that in runscript we must be 100% sure that it will work for everyone, not just for you who has set a valid path. :)

Fair enough, let's go with tmpfiles then
Comment 5 Mike Gilbert gentoo-dev 2020-12-30 19:19:02 UTC
Closing as INVALID since this issue does not occur with the default configuration.