Skip to contentSkip to conversation

package/php: select SYSTEMD_TMPFILES for PHP_SAPI_FPM

PATCH New Pascal de Bruijn 3 participants 5 messages Nov 22, 2019 – Aug 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/php: select SYSTEMD_TMPFILES for PHP_SAPI_FPM

PrivateTmp=true requires SYSTEMD_TMPFILES otherwise the service will fail to start on boot.

---
 package/php/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/php/Config.in +1 -0
index 2469573..b65438a 100644
@@ -39,6 +39,7 @@ config BR2_PACKAGE_PHP_SAPI_CLI
 
 config BR2_PACKAGE_PHP_SAPI_FPM
 	bool "FPM interface"
+	select BR2_PACKAGE_SYSTEMD_TMPFILES if BR2_PACKAGE_SYSTEMD
 	depends on BR2_USE_MMU
 	# "Sparc v8 and predecessors are not and will not be supported"
 	depends on !BR2_sparc
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/php: select SYSTEMD_TMPFILES for PHP_SAPI_FPM

Hello J?r?my,

Do you have some feedback about this patch ?

Thanks,

Thomas

Quoted 20 lines · On Fri, 22 Nov 2019 10:39:30 +0100 Pascal de Bruijn <[email protected]>…

PrivateTmp=true requires SYSTEMD_TMPFILES otherwise the service will fail to start on boot.

---
 package/php/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/php/Config.in +1 -0
index 2469573..b65438a 100644
@@ -39,6 +39,7 @@ config BR2_PACKAGE_PHP_SAPI_CLI
 
 config BR2_PACKAGE_PHP_SAPI_FPM
 	bool "FPM interface"
+	select BR2_PACKAGE_SYSTEMD_TMPFILES if BR2_PACKAGE_SYSTEMD
 	depends on BR2_USE_MMU
 	# "Sparc v8 and predecessors are not and will not be supported"
 	depends on !BR2_sparc
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/php: select SYSTEMD_TMPFILES for PHP_SAPI_FPM

systemd-tmpfiles is a small utility provided by systemd to do "file system tweaks" early during the boot

The primary use-case is to populate /run early so everything is ready when the "real stuff" starts but it can do all sort of things
* create files
* remove files
* write to files
* adjust file permissions/ACL..
* create nodes in /dev

systemd-tmpfiles avoids launching dozen of small processes/subshells for small adjustment as it is don intraditionnal sysV startup files

systemd-tmpfiles configuration is drop-in based so any package can add file in the proper directory to be sure things are created/adjusted at boot time.

moreover systemd-tmpfiles is needed to be able to dynamically load modules :
* at boot time, systemd will scan modules in /lib/modules (using modinfo) to know all /dev nodes that unloaded modules can handle
* systemd-tmpfiles will create the corresponding nodes in /dev
* when a process opens the node, the kernel will block the process and call udev
* udev will find the module to load (using modules.alias)
* once the module is loaded, the kernel will honor the open request and unblock the process.

systemd-tmpfiles is not an optional part of systemd. Buildroot configures it that way, but packages are supposed to safely assume it's there on any systemd-based system

So I would consider it a bug to have systemd-tmpfiles be optional. I'd rather see a patch removing that aspect entirely.

Now... if we want to keep that option (which, again, I don't recommend) yes. This patch looks good to me.

Le lun. 25 nov. 2019 ? 22:10, Thomas Petazzoni <[email protected]> a ?crit :

Quoted 39 lines

Hello J?r?my,

Do you have some feedback about this patch ?

Thanks,

Thomas

Quoted 13 lines · On Fri, 22 Nov 2019 10:39:30 +0100 Pascal de Bruijn <[email protected]>…

PrivateTmp=true requires SYSTEMD_TMPFILES otherwise the service will fail to start on boot.

---
 package/php/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/php/Config.in +0 -0
index 2469573..b65438a 100644

package/php/Config.in config BR2_PACKAGE_PHP_SAPI_CLI · line 45

Quoted 7 lines
package/php/Config.in +1 -0
@@ -39,6 +39,7 @@ config BR2_PACKAGE_PHP_SAPI_CLI
 
 config BR2_PACKAGE_PHP_SAPI_FPM
      bool "FPM interface"
+     select BR2_PACKAGE_SYSTEMD_TMPFILES if BR2_PACKAGE_SYSTEMD
      depends on BR2_USE_MMU
      # "Sparc v8 and predecessors are not and will not be supported"
      depends on !BR2_sparc

--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 21 lines
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191126/51252cb2/attachment.html>
#3 lore raw

PATCH 1/1 package/php: select SYSTEMD_TMPFILES for PHP_SAPI_FPM

Ok, for the special case of PHP, this has been fixed upstream with

https://github.com/systemd/systemd/pull/14207

The official word from upstream is "yes tmpfiles is optional but it should always be here except for really tiny embedded systems"

So we are good (tmpfile's default is activated)

Ideally, we should backport that PR until upstream adds it to systemd-stable.

BR
J?r?my

Le mar. 26 nov. 2019 ? 18:45, J?r?my ROSEN <[email protected]> a ?crit :

Quoted 105 lines

systemd-tmpfiles is a small utility provided by systemd to do "file system tweaks" early during the boot

The primary use-case is to populate /run early so everything is ready when the "real stuff" starts but it can do all sort of things
* create files
* remove files
* write to files
* adjust file permissions/ACL..
* create nodes in /dev

systemd-tmpfiles avoids launching dozen of small processes/subshells for small adjustment as it is don intraditionnal sysV startup files

systemd-tmpfiles configuration is drop-in based so any package can add file in the proper directory to be sure things are created/adjusted at boot time.

moreover systemd-tmpfiles is needed to be able to dynamically load modules :
* at boot time, systemd will scan modules in /lib/modules (using modinfo) to know all /dev nodes that unloaded modules can handle
* systemd-tmpfiles will create the corresponding nodes in /dev
* when a process opens the node, the kernel will block the process and call udev
* udev will find the module to load (using modules.alias)
* once the module is loaded, the kernel will honor the open request and unblock the process.

systemd-tmpfiles is not an optional part of systemd. Buildroot configures it that way, but packages are supposed to safely assume it's there on any systemd-based system

So I would consider it a bug to have systemd-tmpfiles be optional. I'd rather see a patch removing that aspect entirely.

Now... if we want to keep that option (which, again, I don't recommend) yes. This patch looks good to me.

Le lun. 25 nov. 2019 ? 22:10, Thomas Petazzoni <
thomas.petazzoni at bootlin.com> a ?crit :

Quoted 25 lines

Hello J?r?my,

Do you have some feedback about this patch ?

Thanks,

Thomas

Quoted 14 lines · On Fri, 22 Nov 2019 10:39:30 +0100 Pascal de Bruijn <[email protected]>…

PrivateTmp=true requires SYSTEMD_TMPFILES otherwise the service will fail to start on boot.

---
 package/php/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/php/Config.in +0 -0
index 2469573..b65438a 100644
@@ -39,6 +39,7 @@ config BR2_PACKAGE_PHP_SAPI_CLI
 
Quoted 14 lines

package/php/Config.in config BR2_PACKAGE_PHP_SAPI_CLI · line 45

Quoted 6 lines
package/php/Config.in +1 -0
 config BR2_PACKAGE_PHP_SAPI_FPM
      bool "FPM interface"
+     select BR2_PACKAGE_SYSTEMD_TMPFILES if BR2_PACKAGE_SYSTEMD
      depends on BR2_USE_MMU
      # "Sparc v8 and predecessors are not and will not be supported"
      depends on !BR2_sparc

--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

--
[image: SMILE] <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone] +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>

Signature · 21 lines
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191204/df5ab6a5/attachment-0001.html>
#4 lore raw

Hello Jérémy,

Quoted 11 lines · On Wed, 4 Dec 2019 09:53:53 +0100 Jérémy ROSEN <[email protected]> wrote:

Ok, for the special case of PHP, this has been fixed upstream with

https://github.com/systemd/systemd/pull/14207

The official word from upstream is "yes tmpfiles is optional but it should always be here except for really tiny embedded systems"

So we are good (tmpfile's default is activated)

Ideally, we should backport that PR until upstream adds it to systemd-stable.

It's been a while ago, but if I understand correctly what you said, because PR14207 has been merged upstream, we no longer need absolutely need tmpfiles support in systemd for PHP's FPM interface to work. We're now using a much newer systemd version in Buildroot, which must have PR14207 applied.

So I've marked this patch as Rejected. Pascal, if you disagree and still see a problem, do not hesitate to resubmit the patch.

Thanks a lot,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot