Skip to contentSkip to conversation

libdaemons localstatedir /usr/var

Buildroot Jörg Krause 3 participants 9 messages Oct 12, 2014 – Oct 17, 2014

lore
Share & tools
lore
#0 lore raw

I have a package which uses libdaemon for running as a daemoon and for creating the pid file. libdaemons default directory for opening the pid file is /usr/var/run. However, buildroot does not create this directory in the output directory by default. The package compiles successfully but fails to run because of the missing directory.

How should I deal with this?

1) patch libdaemon.mk: LIBDAEMON_CONF_OPTS = ... --localstatedir=/var
2) add /usr/var/run to my rootfs overlay directory

What do you think? Any other suggestions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20141012/e99f62df/attachment.html>

#1 lore raw

Dear J?rg Krause,

Quoted 6 lines · J?rg Krause

I have a package which uses libdaemon for running as a daemoon and for creating the pid file. libdaemons default directory for opening the pid file is /usr/var/run. However, buildroot does not create this directory in the output directory by default. The package compiles successfully but fails to run because of the missing directory.

Quoted 6 lines

How should I deal with this?

1) patch libdaemon.mk: LIBDAEMON_CONF_OPTS = ... --localstatedir=/var
2) add /usr/var/run to my rootfs overlay directory

What do you think? Any other suggestions?

I'd say (1).

Isn't --localstatedir a common autoconf variable ? I see 26 packages passing --localstatedir=/var in Buildroot. Maybe it's time to move as a common definition, like --prefix=/usr ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

Dear Thomas Petazzoni,

Quoted 9 lines · Thomas Petazzoni

Dear J?rg Krause,

Quoted 6 lines · J?rg Krause

I have a package which uses libdaemon for running as a daemoon and for creating the pid file. libdaemons default directory for opening the pid file is /usr/var/run. However, buildroot does not create this directory in the output directory by default. The package compiles successfully but fails to run because of the missing directory.

Quoted 7 lines
Quoted 6 lines

How should I deal with this?

1) patch libdaemon.mk: LIBDAEMON_CONF_OPTS = ... --localstatedir=/var
2) add /usr/var/run to my rootfs overlay directory

What do you think? Any other suggestions?

I'd say (1).

Looks good. I will prepare a patch.

Quoted 3 lines

Isn't --localstatedir a common autoconf variable ? I see 26 packages passing --localstatedir=/var in Buildroot. Maybe it's time to move as a common definition, like --prefix=/usr ?

Yes, it is. There was a discussion on the mailing list long time ago:

    Making --localstatedir=/var global?
    (http://lists.busybox.net/pipermail/buildroot/2011-April/042918.html.)

And also this one:

Bizarre things on the allyespackageconfig build
(http://lists.busybox.net/pipermail/buildroot/2013-May/071856.html)

Best regards
J?rg Krause
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20141012/44a6492c/attachment.html>

#3 lore raw
Quoted 28 lines · J?rg Krause

Dear Thomas Petazzoni,

Quoted 9 lines · Thomas Petazzoni

Dear J?rg Krause,

Quoted 6 lines · J?rg Krause

I have a package which uses libdaemon for running as a daemoon and for creating the pid file. libdaemons default directory for opening the pid file is /usr/var/run. However, buildroot does not create this directory in the output directory by default. The package compiles successfully but fails to run because of the missing directory.

Quoted 7 lines
Quoted 6 lines

How should I deal with this?

1) patch libdaemon.mk: LIBDAEMON_CONF_OPTS = ... --localstatedir=/var
2) add /usr/var/run to my rootfs overlay directory

What do you think? Any other suggestions?

I'd say (1).

Looks good. I will prepare a patch.

Quoted 3 lines

Isn't --localstatedir a common autoconf variable ? I see 26 packages passing --localstatedir=/var in Buildroot. Maybe it's time to move as a common definition, like --prefix=/usr ?

Yes, it is. There was a discussion on the mailing list long time ago:

Quoted 7 lines
    Making --localstatedir=/var global?
    (http://lists.busybox.net/pipermail/buildroot/2011-April/042918.html.)

And also this one:

Bizarre things on the allyespackageconfig build
(http://lists.busybox.net/pipermail/buildroot/2013-May/071856.html)

+1 to making it a global pkg-autotools option. J?rg, care to prepare a patch
for that? Removing the existing --localstatedir should be a separate patch then.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#4 lore raw
Quoted 30 lines · Arnout Vandecappelle
Quoted 29 lines · J?rg Krause

Dear Thomas Petazzoni,

Quoted 9 lines · Thomas Petazzoni

Dear J?rg Krause,

Quoted 6 lines · J?rg Krause

I have a package which uses libdaemon for running as a daemoon and for creating the pid file. libdaemons default directory for opening the pid file is /usr/var/run. However, buildroot does not create this directory in the output directory by default. The package compiles successfully but fails to run because of the missing directory.

Quoted 7 lines
Quoted 6 lines

How should I deal with this?

1) patch libdaemon.mk: LIBDAEMON_CONF_OPTS = ... --localstatedir=/var
2) add /usr/var/run to my rootfs overlay directory

What do you think? Any other suggestions?

I'd say (1).

Looks good. I will prepare a patch.

Quoted 3 lines

Isn't --localstatedir a common autoconf variable ? I see 26 packages passing --localstatedir=/var in Buildroot. Maybe it's time to move as a common definition, like --prefix=/usr ?

Yes, it is. There was a discussion on the mailing list long time ago:

     Making --localstatedir=/var global?
     (http://lists.busybox.net/pipermail/buildroot/2011-April/042918.html.)
Quoted 6 lines
Quoted 4 lines

And also this one:

Bizarre things on the allyespackageconfig build
(http://lists.busybox.net/pipermail/buildroot/2013-May/071856.html)

+1 to making it a global pkg-autotools option. J?rg, care to prepare a patch
for that? Removing the existing --localstatedir should be a separate patch then.

I will prepare a patch for this. Should I add this to host configure, too? I guess so...

#5 lore raw

Dear J?rg Krause,

Quoted 7 lines · J?rg Krause
Quoted 4 lines
Quoted 2 lines

Bizarre things on the allyespackageconfig build
(http://lists.busybox.net/pipermail/buildroot/2013-May/071856.html)

+1 to making it a global pkg-autotools option. J?rg, care to prepare a patch
for that? Removing the existing --localstatedir should be a separate patch then.

I will prepare a patch for this. Should I add this to host configure, too? I guess so...

If you add that to host configure, it should be $(HOST_DIR)/var.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw
Quoted 6 lines · Thomas Petazzoni

Dear J?rg Krause,

Quoted 2 lines · J?rg Krause
Quoted 2 lines
Quoted 2 lines

Bizarre things on the allyespackageconfig build
(http://lists.busybox.net/pipermail/buildroot/2013-May/071856.html)

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

+1 to making it a global pkg-autotools option. J?rg, care to prepare a patch
for that? Removing the existing --localstatedir should be a separate patch

then.

Quoted 3 lines

I will prepare a patch for this. Should I add this to host configure, too? I guess so...

If you add that to host configure, it should be $(HOST_DIR)/var.

But I don't think that there's any host package that does anything
useful with the localstatedir.

Regards,
Arnout

Quoted 3 lines

Thomas

Signature · 6 lines
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#7 lore raw
In reply to Arnout Vandecappelle

Dear Thomas Petazzoni,
Dear Arnout Vandecappelle,

Quoted 10 lines · Arnout Vandecappelle
Quoted 9 lines · J?rg Krause
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Isn't --localstatedir a common autoconf variable ? I see 26 packages passing --localstatedir=/var in Buildroot. Maybe it's time to move as a common definition, like --prefix=/usr ?

Yes, it is. There was a discussion on the mailing list long time ago:

    Making --localstatedir=/var global?
    (http://lists.busybox.net/pipermail/buildroot/2011-April/042918.html.)
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

And also this one:

Bizarre things on the allyespackageconfig build
(http://lists.busybox.net/pipermail/buildroot/2013-May/071856.html)

+1 to making it a global pkg-autotools option. J?rg, care to prepare a patch
for that? Removing the existing --localstatedir should be a separate patch then.

I started with setting --localstatedir=/var globally. There are three packages which set localstatedir to another directory as /var:

* dhcp: It's save to remove local localstatedir here. Is it used for setting leases and pid files. All leases and pid files are set as config options in the dhcp.mk.
* proftpd: Uses localstatedir to set the location of the pid file:

    AC_DEFINE_UNQUOTED(PR_RUN_DIR, "`eval echo "${localstatedir}"`")
    AC_DEFINE_UNQUOTED(PR_PID_FILE_PATH, "`eval echo
    "${localstatedir}/proftpd.pid"`")

Maybe a patch should set it to?:

    AC_DEFINE_UNQUOTED(PR_RUN_DIR, "`eval echo "${localstatedir}/run"`")
    AC_DEFINE_UNQUOTED(PR_PID_FILE_PATH, "`eval echo
    "${localstatedir}/run/proftpd.pid"`")

* mysql: localstatedir sets the location for database directories and other files. Not sure how to handle this.

Do you have any suggestions?

J?rg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20141017/1dcc90c1/attachment.html>

#8 lore raw

Dear J?rg Krause,

Quoted 6 lines · J?rg Krause

I started with setting --localstatedir=/var globally. There are three packages which set localstatedir to another directory as /var:

* dhcp: It's save to remove local localstatedir here. Is it used for setting leases and pid files. All leases and pid files are set as config options in the dhcp.mk.

Ok.

Quoted 11 lines

* proftpd: Uses localstatedir to set the location of the pid file:

    AC_DEFINE_UNQUOTED(PR_RUN_DIR, "`eval echo "${localstatedir}"`")
    AC_DEFINE_UNQUOTED(PR_PID_FILE_PATH, "`eval echo
    "${localstatedir}/proftpd.pid"`")

Maybe a patch should set it to?:

    AC_DEFINE_UNQUOTED(PR_RUN_DIR, "`eval echo "${localstatedir}/run"`")
    AC_DEFINE_UNQUOTED(PR_PID_FILE_PATH, "`eval echo
    "${localstatedir}/run/proftpd.pid"`")

Sounds good.

Quoted 2 lines

* mysql: localstatedir sets the location for database directories and other files. Not sure how to handle this.

You can keep a custom --localstatedir in mysql.mk.

One of the good thing with autoconf is that if you pass:

	--localstatedir=/var ... --localstatedir=/var/something

Then /var/something will be used. So, we can set --localstatedir=/var by default in the infrastructure, and still have certain packages doing weird things override it.

So this also means that your patch should be in at least two steps: one step adding --localstatedir=/var to the infrastructure, and then one patch removing --localstatedir=/var from the packages where this is no longer needed.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com