package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade: installed php7.4-fpm package post-installation script subprocess returned error exit status 1

Bug #1945687 reported by vivek1115
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php7.4 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

No socket file is created for php-fpm

ProblemType: Package
DistroRelease: Ubuntu 20.04
Package: php7.4-fpm 7.4.3-4ubuntu2.6
ProcVersionSignature: Ubuntu 5.4.0-86.97-generic 5.4.133
Uname: Linux 5.4.0-86-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.20
Architecture: amd64
CasperMD5CheckResult: skip
Date: Sun Sep 26 22:31:12 2021
ErrorMessage: installed php7.4-fpm package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2018-08-09 (1148 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
Python3Details: /usr/bin/python3.8, Python 3.8.10, python3-minimal, 3.8.2-0ubuntu2
PythonDetails: /usr/bin/python2.7, Python 2.7.18, python-is-python2, 2.7.17-4
RelatedPackageVersions:
 dpkg 1.19.7ubuntu3
 apt 2.0.6
SourcePackage: php7.4
Title: package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade: installed php7.4-fpm package post-installation script subprocess returned error exit status 1
UpgradeStatus: Upgraded to focal on 2020-05-31 (486 days ago)

Setting up php7.4-fpm (7.4.3-4ubuntu2.6) ...
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Detected unsafe path transition / → /run during canonicalization of /run.
Job for php7.4-fpm.service failed because the control process exited with error code.
See "systemctl status php7.4-fpm.service" and "journalctl -xe" for details.
invoke-rc.d: initscript php7.4-fpm, action "restart" failed.
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (]8;;file://Vivek-PC/lib/systemd/system/php7.4-fpm.service/lib/systemd/system/php7.4-fpm.service]8;;; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-09-26 22:31:11 CEST; 32ms ago
       Docs: ]8;;man:php-fpm7.4(8)man:php-fpm7.4(8)]8;;
    Process: 9683 ExecStart=/usr/sbin/php-fpm7.4 --nodaemonize --fpm-config /etc/php/7.4/fpm/php-fpm.conf (code=exited, status=78)
    Process: 9686 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)
   Main PID: 9683 (code=exited, status=78)

Sep 26 22:31:11 Vivek-PC systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Sep 26 22:31:11 Vivek-PC php-fpm7.4[9683]: [26-Sep-2021 22:31:11] ERROR: unable to bind listening socket for address '/run/php/php7.4-fpm.sock': No such file or directory (2)
Sep 26 22:31:11 Vivek-PC php-fpm7.4[9683]: [26-Sep-2021 22:31:11] ERROR: FPM initialization failed
Sep 26 22:31:11 Vivek-PC systemd[1]: php7.4-fpm.service: Main process exited, code=exited, status=78/CONFIG
Sep 26 22:31:11 Vivek-PC systemd[1]: php7.4-fpm.service: Failed with result 'exit-code'.
Sep 26 22:31:11 Vivek-PC systemd[1]: Failed to start The PHP 7.4 FastCGI Process Manager.
dpkg: error processing package php7.4-fpm (--configure):
 installed php7.4-fpm package post-installation script subprocess returned error exit status 1

Revision history for this message
vivek1115 (vivek1115) wrote :
Bryce Harrington (bryce)
description: updated
Revision history for this message
Bryce Harrington (bryce) wrote :

Hi vivek,

Does it work if you do:

$ sudo mkdir -p /var/run/php/
$ sudo systemctl restart php7.4-fpm

I notice your /run directory is mounted as a temp filesystem, which should work but might be involved in whatever's gone wrong:
tmpfs 1218676 3820 1214856 1% /run

Fwiw, on my 20.04 system I have:

$ ls -l /var/run
lrwxrwxrwx 1 root root 4 Dec 17 2019 /var/run -> /run/
$ ls -ld /run
drwxr-xr-x 48 root root 1680 Oct 1 06:33 /run/

Can you check and see if your /run and /var/run are configured correctly, and see if creating the /var/run/php directory resolves the installation problem?

I spotted this stackoverflow question that seems to match what you're seeing:
https://stackoverflow.com/questions/65841710/installing-php-on-debian-returns-an-error-code

Changed in php7.4 (Ubuntu):
status: New → Incomplete
Revision history for this message
vivek1115 (vivek1115) wrote : Re: [Bug 1945687] Re: package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade: installed php7.4-fpm package post-installation script subprocess returned error exit status 1
Download full text (5.5 KiB)

[image: image.gif]Hi Bryce,

I am so sorry for the late reply.

Yes, my "/run" and "/var/run" directories are configured correctly.

Furthermore, when I create "/var/run/php" directory manually and restart
"php7.4-fpm" using "systemctl" then it works perfectly. For now I have
created a simple shell script and started it via "systemctl" to solve
this problem. I just reported it, so that you can take a look at it and
provide a fix in the next release, if needed.

I really appreciate your kind proposal and efforts and wish you a great day
ahead!

Best Regards,
Vivek Shukla

On Fri, Oct 1, 2021 at 7:15 PM Bryce Harrington <email address hidden>
wrote:

> Hi vivek,
>
> Does it work if you do:
>
> $ sudo mkdir -p /var/run/php/
> $ sudo systemctl restart php7.4-fpm
>
> I notice your /run directory is mounted as a temp filesystem, which should
> work but might be involved in whatever's gone wrong:
> tmpfs 1218676 3820 1214856 1% /run
>
> Fwiw, on my 20.04 system I have:
>
> $ ls -l /var/run
> lrwxrwxrwx 1 root root 4 Dec 17 2019 /var/run -> /run/
> $ ls -ld /run
> drwxr-xr-x 48 root root 1680 Oct 1 06:33 /run/
>
> Can you check and see if your /run and /var/run are configured
> correctly, and see if creating the /var/run/php directory resolves the
> installation problem?
>
> I spotted this stackoverflow question that seems to match what you're
> seeing:
>
> https://stackoverflow.com/questions/65841710/installing-php-on-debian-returns-an-error-code
>
> ** Changed in: php7.4 (Ubuntu)
> Status: New => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1945687
>
> Title:
> package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade:
> installed php7.4-fpm package post-installation script subprocess
> returned error exit status 1
>
> Status in php7.4 package in Ubuntu:
> Incomplete
>
> Bug description:
> No socket file is created for php-fpm
>
> ProblemType: Package
> DistroRelease: Ubuntu 20.04
> Package: php7.4-fpm 7.4.3-4ubuntu2.6
> ProcVersionSignature: Ubuntu 5.4.0-86.97-generic 5.4.133
> Uname: Linux 5.4.0-86-generic x86_64
> ApportVersion: 2.20.11-0ubuntu27.20
> Architecture: amd64
> CasperMD5CheckResult: skip
> Date: Sun Sep 26 22:31:12 2021
> ErrorMessage: installed php7.4-fpm package post-installation script
> subprocess returned error exit status 1
> InstallationDate: Installed on 2018-08-09 (1148 days ago)
> InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64
> (20180725)
> Python3Details: /usr/bin/python3.8, Python 3.8.10, python3-minimal,
> 3.8.2-0ubuntu2
> PythonDetails: /usr/bin/python2.7, Python 2.7.18, python-is-python2,
> 2.7.17-4
> RelatedPackageVersions:
> dpkg 1.19.7ubuntu3
> apt 2.0.6
> SourcePackage: php7.4
> Title: package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade:
> installed php7.4-fpm package post-installation script subprocess returned
> error exit status 1
> UpgradeStatus: Upgraded to focal on 2020-05-31 (486 days ago)
>
>
> Setting up php7.4-fpm (7.4.3-4ubuntu2.6) ...
> NOTICE: Not enabling PHP 7.4 FPM by default.
> ...

Read more...

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?

Revision history for this message
Dan Streetman (ddstreet) wrote :

> I notice your /run directory is mounted as a temp filesystem

that's normal, /run is a tmpfs on everyone's system

> Detected unsafe path transition / → /run during canonicalization of /run.

This means that the owner of your / and /run directories aren't the same, and more specifically that your / directory is probably not owned by root, can you check that? If so that is very likely the reason that systemd-tmpfiles didn't create the /run dir that php was expecting to use.

Revision history for this message
vivek1115 (vivek1115) wrote :
Download full text (4.9 KiB)

Hi Dan,

You are right. The owner of my / directory was not root but my regular
user. I set it back as root and now the problem is solved. I don't know how
it was changed, because I manually never changed the owner of my /
directory.

Anyway, thank you very much for providing support, solution and bug fix.
I wish you a great time and health ahead.

Yours sincerely,
Vivek Shukla

On Wed, Oct 13, 2021 at 2:30 PM Dan Streetman <email address hidden>
wrote:

> > I notice your /run directory is mounted as a temp filesystem
>
> that's normal, /run is a tmpfs on everyone's system
>
> > Detected unsafe path transition / → /run during canonicalization of
> /run.
>
> This means that the owner of your / and /run directories aren't the
> same, and more specifically that your / directory is probably not owned
> by root, can you check that? If so that is very likely the reason that
> systemd-tmpfiles didn't create the /run dir that php was expecting to
> use.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1945687
>
> Title:
> package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade:
> installed php7.4-fpm package post-installation script subprocess
> returned error exit status 1
>
> Status in php7.4 package in Ubuntu:
> Incomplete
>
> Bug description:
> No socket file is created for php-fpm
>
> ProblemType: Package
> DistroRelease: Ubuntu 20.04
> Package: php7.4-fpm 7.4.3-4ubuntu2.6
> ProcVersionSignature: Ubuntu 5.4.0-86.97-generic 5.4.133
> Uname: Linux 5.4.0-86-generic x86_64
> ApportVersion: 2.20.11-0ubuntu27.20
> Architecture: amd64
> CasperMD5CheckResult: skip
> Date: Sun Sep 26 22:31:12 2021
> ErrorMessage: installed php7.4-fpm package post-installation script
> subprocess returned error exit status 1
> InstallationDate: Installed on 2018-08-09 (1148 days ago)
> InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64
> (20180725)
> Python3Details: /usr/bin/python3.8, Python 3.8.10, python3-minimal,
> 3.8.2-0ubuntu2
> PythonDetails: /usr/bin/python2.7, Python 2.7.18, python-is-python2,
> 2.7.17-4
> RelatedPackageVersions:
> dpkg 1.19.7ubuntu3
> apt 2.0.6
> SourcePackage: php7.4
> Title: package php7.4-fpm 7.4.3-4ubuntu2.6 failed to install/upgrade:
> installed php7.4-fpm package post-installation script subprocess returned
> error exit status 1
> UpgradeStatus: Upgraded to focal on 2020-05-31 (486 days ago)
>
>
> Setting up php7.4-fpm (7.4.3-4ubuntu2.6) ...
> NOTICE: Not enabling PHP 7.4 FPM by default.
> NOTICE: To enable PHP 7.4 FPM in Apache2 do:
> NOTICE: a2enmod proxy_fcgi setenvif
> NOTICE: a2enconf php7.4-fpm
> NOTICE: You are seeing this message because you have apache2 package
> installed.
> Detected unsafe path transition / → /run during canonicalization of /run.
> Job for php7.4-fpm.service failed because the control process exited
> with error code.
> See "systemctl status php7.4-fpm.service" and "journalctl -xe" for
> details.
> invoke-rc.d: initscript php7.4-fpm, action "restart" failed.
> [0;1;31m● [0m php7.4-fpm.service - The PHP 7.4 FastCGI Process Manag...

Read more...

Revision history for this message
Paride Legovini (paride) wrote :

Hi Vivek, good to know the problem is gone. I'm marking this bug report as Invalid, but feel free to change its status back to New and comment back (or open a new bug report) if needed. Thanks!

Changed in php7.4 (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.