Comment 4 for bug 1945687

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Interesting,
thanks for confirming that after creating "/var/run/php" manually it works for you.

Indeed /var/run is a temporary directory, and all such are expected by the packages to be re-created on boot as needed. That is present for php-fpm here

$ dpkg -S /usr/lib/tmpfiles.d/php7.4-fpm.conf
php7.4-fpm: /usr/lib/tmpfiles.d/php7.4-fpm.conf

$ cat /usr/lib/tmpfiles.d/php7.4-fpm.conf
#Type Path Mode UID GID Age Argument
    d /run/php 0755 www-data www-data - -

With that in place I'd expect that on reboot that directory would always be re-created and then the subsequently php-fpm work on reboot.
In a similar fashon on an install/upgrade the configure step of the postinst /var/lib/dpkg/info/php7.4-fpm.postinst will run
  systemd-tmpfiles --create php7.4-fpm.conf >/dev/null || true
before starting php7.4-fpm

Could you maybe have a look if that silently fails and if it does why?
Because we will need to track down why this directory isn't created in your case to consider a fix or further user-guidance.

A sequence like this should work in a normal Ubuntu system:
$ systemctl stop php7.4-fpm; rm -rf /var/run/php; systemd-tmpfiles --create php7.4-fpm.conf; systemctl start php7.4-fpm; ll -laF /var/run/php; systemctl status php7.4-fpm
total 4
drwxr-xr-x 2 www-data www-data 100 Oct 11 06:51 ./
drwxr-xr-x 29 root root 940 Oct 11 06:51 ../
lrwxrwxrwx 1 root root 30 Oct 11 06:51 php-fpm.sock -> /etc/alternatives/php-fpm.sock=
-rw-r--r-- 1 root root 4 Oct 11 06:51 php7.4-fpm.pid
srw-rw---- 1 www-data www-data 0 Oct 11 06:51 php7.4-fpm.sock=
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-10-11 06:51:38 UTC; 39s ago
       Docs: man:php-fpm7.4(8)
    Process: 1656 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)
   Main PID: 1653 (php-fpm7.4)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 38267)
     Memory: 11.1M
     CGroup: /system.slice/php7.4-fpm.service
             ├─1653 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
             ├─1654 php-fpm: pool www
             └─1655 php-fpm: pool www

Does this sequence work on your system?