php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78963 php-fpm-7.4.0 can't access devices
Submitted: 2019-12-15 13:37 UTC Modified: 2019-12-21 05:46 UTC
From: jeanmarc dot louviaux at gmail dot com Assigned:
Status: Closed Package: FPM related
PHP Version: 7.4.0 OS: Arch
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jeanmarc dot louviaux at gmail dot com
New email:
PHP Version: OS:

 

 [2019-12-15 13:37 UTC] jeanmarc dot louviaux at gmail dot com
Description:
------------
Hello,
I'am using app via php-fpm that communicate with some of my USB ports (Arduino, electric meters and a solar inverter)
It was running for years without any hitchs. I just had to usermod -a -G uucp http.

Since php-fpm-7.4.0 i'am unable to access them, so i had to downgrade. Could you please fix that ?
Cheers

Test script:
---------------
<?php
$com = "aurora -a 2 -c -T -Y3 -l4 -d0 -e /dev/ttyUSB1";
//$com = "ls -al /dev/";
//$com = "poolmeters ws";
exec("$com 2>&1", $datareturn);
$datareturn = trim(implode($datareturn));
echo $datareturn;
?>

Expected result:
----------------
Get returns from my devices ;)

Actual result:
--------------
Unable to open any dev/port

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-15 16:32 UTC] bugreports at gmail dot com
learn about systemd-dropins and set PrivateDevices=no
this change of defaults is completly deserved

https://docs.flatcar-linux.org/os/using-systemd-drop-in-units/
 [2019-12-16 08:50 UTC] jeanmarc dot louviaux at gmail dot com
Hi,
thanks for pointing me this but i can't still get it working.
I have tried changing php-fpm.service but adding :

#Access /dev
PrivateDevices=no
DevicePolicy=auto
#DeviceAllow=true

Obviously did systemctl daemon-reload and systemctl restart php-fpm
But can't access to any /dev

Could you please help me with that ?
Cheers
 [2019-12-16 10:47 UTC] happypuzzle9 at gmail dot com
thinks your url

```
[Service]
ProtectHome=false
```

I perfectly solved the problem of `home` inaccessibility caused by upgrading from 7.3 to 7.4
 [2019-12-18 10:19 UTC] jeanmarc dot louviaux at gmail dot com
Ok i get it
I have set PrivateDevices=false
but i also have to chmod 777 /run/lock/ to allow lock files from devices
Thanks
 [2019-12-18 11:09 UTC] bugreports at gmail dot com
> I have set PrivateDevices=false
> but i also have to chmod 777 /run/lock/ to allow lock files from devices

would you mind not f**p your whole setup?

* nobody and nothing has a business to write directly to /run root-dir
* whatever you do below /run won#t survive a reboot
* learn basics like https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
 [2019-12-18 11:43 UTC] jeanmarc dot louviaux at gmail dot com
Thanks for your kind comment.
I am not the author of communication application but it seem ok to me to have port lock files there (/var/lock/LCK..)
I don't mind if those files survive a reboot or not
 [2019-12-20 06:49 UTC] jeanmarc dot louviaux at gmail dot com
Hello,
You may close this bug as it is not related to php. The issue is related to Arch which now set 755 on /var/lock, thus some apps that request port com via php-fpm can't write /var/lock/LCK.. files.

It may be usefull :
Set PrivateDevices=false in php-fpm.service (thanks happypuzzle9)
via systemctl edit --full php-fpm.service
systemctl daemon-reload & systemctl restart php-fpm

And if 'http' can't write in /var/lock/
set the permissions to 777 into
cp /usr/lib/tmpfiles.d/legacy.conf /etc/tmpfiles.d/
nano /etc/tmpfiles.d/legacy.conf
systemctl restart systemd-tmpfiles-setup
 [2019-12-21 05:46 UTC] jeanmarc dot louviaux at gmail dot com
-Status: Open +Status: Closed
 [2019-12-21 05:46 UTC] jeanmarc dot louviaux at gmail dot com
see comment
 [2019-12-21 05:57 UTC] bugreports at gmail dot com
the same as for /run

random nun-root processes have no business to write dirctly to /run or /var/lock

that's what subfolders and https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html are for
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC