Skip to contentSkip to conversation

dhcp: Correct leases directory location

PATCH In review Martyn Welch 4 participants 4 messages Mar 31, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dhcp: Correct leases directory location

The DHCP client currently expects to be able to create a leases file in "/var/lib/dhcp" as configured in dhcp3.inc. Recipe is currently creating a directory called "/var/lib/dhcp3", resulting in the following error:

can't create /var/lib/dhcp/dhclient.eth0.leases

Correct directory naming to resolve error.

---

Steve: This seems to be directy reversing a change you made. The commit
message doesn't give me any idea of why you did it, can you remember?

 recipes/dhcp/dhcp3.inc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
recipes/dhcp/dhcp3.inc +2 -2
index f099003..5507f1c 100644
@@ -45,7 +45,7 @@ do_install() {
 	install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server
 	install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf
 	install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf
-	install -d ${D}/var/lib/dhcp3
+	install -d ${D}/var/lib/dhcp
 }
 
 PACKAGES += "dhcp-server dhcp-client dhcp-relay dhcp-omshell"
@@ -53,7 +53,7 @@ FILES_${PN} = ""
 FILES_dhcp-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server ${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf"
 FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay"
 
-FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf /var/lib/dhcp3"
+FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf /var/lib/dhcp"
 
 FILES_dhcp-omshell = "${bindir}/omshell"
 

--

Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E [email protected]                        |   M2 3AB  VAT:GB 927559189
#1 lore raw
Quoted 6 lines · Martyn Welch

The DHCP client currently expects to be able to create a leases file in "/var/lib/dhcp" as configured in dhcp3.inc. Recipe is currently creating a directory called "/var/lib/dhcp3", resulting in the following error:

can't create /var/lib/dhcp/dhclient.eth0.leases

Quoted 8 lines

Correct directory naming to resolve error.

---

Steve: This seems to be directy reversing a change you made. The commit
message doesn't give me any idea of why you did it, can you remember?

Interesting. I made the change because I was getting quite similar errors, but for files being created in /var/lib/dhcp3!

I'm not sure what is different about our overall set ups, but perhaps the proper fix is to create both directories.

Steve

Quoted 32 lines
 recipes/dhcp/dhcp3.inc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
recipes/dhcp/dhcp3.inc +2 -3
index f099003..5507f1c 100644
@@ -45,7 +45,7 @@ do_install() {
      install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server
      install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf
      install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf
-     install -d ${D}/var/lib/dhcp3
+     install -d ${D}/var/lib/dhcp
 }
 
 PACKAGES += "dhcp-server dhcp-client dhcp-relay dhcp-omshell"
@@ -53,7 +53,7 @@ FILES_${PN} = ""
 FILES_dhcp-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server ${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf"
 FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay"
 
-FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf /var/lib/dhcp3"
+FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf /var/lib/dhcp"
 
 FILES_dhcp-omshell = "${bindir}/omshell"
 
 
 
--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E [email protected]                        |   M2 3AB  VAT:GB 927559189
#2 lore raw
Quoted 16 lines · Steve Sakoman
Quoted 6 lines · Martyn Welch

The DHCP client currently expects to be able to create a leases file in "/var/lib/dhcp" as configured in dhcp3.inc. Recipe is currently creating a directory called "/var/lib/dhcp3", resulting in the following error:

can't create /var/lib/dhcp/dhclient.eth0.leases

Quoted 8 lines

Correct directory naming to resolve error.

---

Steve: This seems to be directy reversing a change you made. The commit
message doesn't give me any idea of why you did it, can you remember?

Quoted 7 lines

Interesting. I made the change because I was getting quite similar errors, but for files being created in /var/lib/dhcp3!

I'm not sure what is different about our overall set ups, but perhaps the proper fix is to create both directories.

Steve

Hmm, note that recipes/dhcp/files/init-server uses /var/lib/dhcp as well.

dhclient from 3.1.2p1 uses /var/lib/dhcp by default. Maybe one of the older versions used /var/lib/dhcp3 by default...

I did not spot this myself because dhclient is run from network-manager on our system, which passes it command line arguments on where to put the lease file.

Marc

#3 lore raw
Quoted 37 lines · Marc Olzheim
Quoted 17 lines · Steve Sakoman
Quoted 6 lines · Martyn Welch

The DHCP client currently expects to be able to create a leases file in "/var/lib/dhcp" as configured in dhcp3.inc. Recipe is currently creating a directory called "/var/lib/dhcp3", resulting in the following error:

can't create /var/lib/dhcp/dhclient.eth0.leases

Quoted 9 lines

Correct directory naming to resolve error.

---

Steve: This seems to be directy reversing a change you made. The commit
message doesn't give me any idea of why you did it, can you remember?

Quoted 8 lines

Interesting. I made the change because I was getting quite similar errors, but for files being created in /var/lib/dhcp3!

I'm not sure what is different about our overall set ups, but perhaps the proper fix is to create both directories.

Steve

Hmm, note that recipes/dhcp/files/init-server uses /var/lib/dhcp as well.

dhclient from 3.1.2p1 uses /var/lib/dhcp by default. Maybe one of the older versions used /var/lib/dhcp3 by default...

I did not spot this myself because dhclient is run from network-manager on our system, which passes it command line arguments on where to put the lease file.

Quoted 9 lines

Marc

------------------------------------------------------------------------

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

The contents of do_compile:

do_compile() {
       make RANLIB=${RANLIB} 
PREDEFINES='-D_PATH_DHCPD_DB=\"/var/lib/dhcp/dhcpd.leases\" \
       -D_PATH_DHCLIENT_DB=\"/var/lib/dhcp/dhclient.leases\" \
       -D_PATH_DHCLIENT_SCRIPT=\"/sbin/dhclient-script\" \
       -D_PATH_DHCPD_CONF=\"/etc/dhcp/dhcpd.conf\" \
       -D_PATH_DHCLIENT_CONF=\"/etc/dhcp/dhclient.conf\"'
}

Would suggest an explicit preference to using "var/lib/dhcp". May be there is another argument that has been missed?

Martyn