Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Chrooted DHCP and no pid file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mrbeeye
n00b
n00b


Joined: 04 Nov 2005
Posts: 19

PostPosted: Wed Nov 09, 2005 2:56 pm    Post subject: Chrooted DHCP and no pid file Reply with quote

I have DHCP running chrooted in /chroot/dhcp.

I cannot use
Code:
/etc/init.d/dhcp stop
or
Code:
/etc/init.d/dhcp restart

I have to kill manually DHCP process and delete
Code:
/var/lib/init.d/started/dhcp


I explored that there's no pid file in
Code:
/chroot/dhcp/var/run


Here is
Code:
/etc/init.d/dhcp:

Code:
checkconfig() {
        if [ ! -f "${CHROOT}/etc/dhcp/dhcpd.conf" ] ; then
                eerror "No ${CHROOT}/etc/dhcp/dhcpd.conf file exists!"
                return 1
        fi

        if [ ! -f "${CHROOT}/var/lib/dhcp/dhcpd.leases" ] ; then
                ebegin "Creating dhcpd.leases"
                touch "${CHROOT}/var/lib/dhcp/dhcpd.leases" || return 1
                eend $?
        fi

        ebegin "Setting ownership on dhcpd.leases"
        chown dhcp:dhcp "${CHROOT}/var/lib/dhcp/dhcpd.leases" || return 1
        eend $?
}

start() {
        checkconfig || return 1

        ebegin "Starting ${CHROOT:+chrooted }dhcpd"
        start-stop-daemon --start --quiet --exec /usr/sbin/dhcpd \
                -- -pf ${CHROOT}/var/run/dhcp/dhcpd.pid \
                -user dhcp -group dhcp ${DHCPD_OPTS} \
                ${CHROOT:+-chroot ${CHROOT}} ${IFACE}
        eend $?
}

stop() {
        ebegin "Stopping dhcpd"
        start-stop-daemon --stop --quiet --pidfile \
                "${CHROOT}/var/run/dhcp/dhcpd.pid"
        eend $?
}


Also, here is
Code:
/etc/conf.d/dhcp:

Code:
IFACE="eth0"

# Insert any other options needed
DHCPD_OPTS="-q"

# If you wish to run dhcp in a chroot, run:
# ebuild /var/db/pkg/net-misc/<dhcp version>/<dhcp-version>.ebuild config
# and un-comment the following line.
# You can specify a different chroot directory but MAKE SURE it's empty.
CHROOT="/chroot/dhcp"

# If you need name resolution under a chroot, uncomment the following:
#export LD_PRELOAD="/usr/lib/libresolv.so /usr/lib/libnss_dns.so"
Back to top
View user's profile Send private message
Dizzutch
Guru
Guru


Joined: 09 Nov 2004
Posts: 463
Location: Worcester, MA

PostPosted: Wed Nov 09, 2005 9:27 pm    Post subject: Reply with quote

your script shows the file going in ${CHROOT}/var/run/dhcp/dhcp.pid
since ${CHROOT} is /chroot/dhcp your file should be in /chroot/dhcp/var/run/dhcp/dhcp.pid are the permissions correct? does this path exist?
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20588

PostPosted: Wed Nov 09, 2005 10:54 pm    Post subject: Reply with quote

Moved from Other Things Gentoo
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
mrbeeye
n00b
n00b


Joined: 04 Nov 2005
Posts: 19

PostPosted: Thu Nov 10, 2005 6:05 am    Post subject: Reply with quote

Dizzutch wrote:
since ${CHROOT} is /chroot/dhcp your file should be in /chroot/dhcp/var/run/dhcp/dhcp.pid are the permissions correct? does this path exist?
Of course it exists. Permissions for the last dhcp directory is rwx-r-xr-x and owner dhcp:dhcp.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum