Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 334535 - net-dns/bind fails to start when /var/run/named is missing
Summary: net-dns/bind fails to start when /var/run/named is missing
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Konstantin Arkhipov (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: keepdir-var-run_lock
  Show dependency tree
 
Reported: 2010-08-26 09:25 UTC by Eray Aslan
Modified: 2013-08-27 15:19 UTC (History)
2 users (show)

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


Attachments
named.init-r5 (named.init-r5,1.76 KB, text/plain)
2010-08-26 09:26 UTC, Eray Aslan
Details
named.init-r7 (named.init-r7,3.52 KB, text/plain)
2010-08-26 09:26 UTC, Eray Aslan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eray Aslan gentoo-dev 2010-08-26 09:25:27 UTC
/var/run can be mounted tmpfs and cleared during a reboot.  Hence, programs (or
their init scripts) should not rely on dirs under /var/run and should create
them if necessary instead.

bind fails to start when /var/run/named is missing:
Aug 26 11:41:10 east named[5807]: couldn't open pid file '/var/run/named/named.pid': No such file or directory
Aug 26 11:41:10 east named[5807]: exiting (due to early fatal error)

The attached init scripts creates the missing dir if necessary.  For your ref:

--- files/named.init-r5.old	2010-08-26 11:32:26.000000000 +0300
+++ files/named.init-r5	2010-08-26 12:13:50.000000000 +0300
@@ -1,5 +1,5 @@
 #!/sbin/runscript
-# Copyright 1999-2004 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r5,v 1.1 2007/06/02 22:34:48 voxus Exp $
 
@@ -29,6 +29,11 @@
 				| egrep -o -m1 "pid\-file +\".+\" *;" \
 				| cut -d\" -f2
 	)
+	# create PIDDIR (usually /var/run/named) if necessary
+	local PIDDIR="${PIDFILE%/*}"
+	if [ ! -d  "${PIDDIR}" ] ; then
+		checkpath -q -d -o named:named -m 0755 "${PIDDIR}" || return 1
+	fi
 
 	KEY="${CHROOT}/etc/bind/rndc.key"
 }

--- files/named.init-r7.old	2010-08-26 11:32:37.000000000 +0300
+++ files/named.init-r7	2010-08-26 12:13:30.000000000 +0300
@@ -53,7 +53,7 @@
 		[[ ! -d ${CHROOT}/dev || ! -d ${CHROOT}/etc || ! -d ${CHROOT}/var ]] && return 1
 		[[ ! -d ${CHROOT}/var/run || ! -d ${CHROOT}/var/log ]] && return 1
 		[[ ! -d ${CHROOT}/etc/bind || ! -d ${CHROOT}/var/bind ]] && return 1
-		[[ ! -d ${CHROOT}/var/run/named || ! -d ${CHROOT}/var/log/named ]] && return 1
+		[[ ! -d ${CHROOT}/var/log/named ]] && return 1
 		[[ ! -e ${CHROOT}/etc/localtime ]] && return 1
 		[[ ! -c ${CHROOT}/dev/null || ! -c ${CHROOT}/dev/zero ]] && return 1
 		[[ ! -c ${CHROOT}/dev/random && ! -c ${CHROOT}/dev/urandom ]] && return 1
@@ -79,6 +79,11 @@
 				| egrep -o -m1 "pid\-file +\".+\" *;" \
 				| cut -d\" -f2
 	)
+	# create PIDDIR (usually /var/run/named) if necessary
+	local PIDDIR="${PIDFILE%/*}"
+	if [ ! -d  "${PIDDIR}" ] ; then
+		checkpath -q -d -o named:named -m 0755 "${PIDDIR}" || return 1
+	fi
 }
 
 start() {


Reproducible: Always
Comment 1 Eray Aslan gentoo-dev 2010-08-26 09:26:10 UTC
Created attachment 244639 [details]
named.init-r5
Comment 2 Eray Aslan gentoo-dev 2010-08-26 09:26:32 UTC
Created attachment 244641 [details]
named.init-r7
Comment 3 Christian Ruppert (idl0r) gentoo-dev 2010-08-26 16:06:58 UTC
This problem has been fixed in our software repository. The fix will be available on the mirrors soon. Thank you for your bug report.