pixelgazer
Posts: 3
Joined: Thu Apr 04, 2019 7:10 pm

php7.0-fpm.service: Start operation timed out. Terminating.

Thu Apr 04, 2019 7:57 pm

Hi.

I'm new here and I hope someone can point me in the right direction.

All was working well with my RPi Wordpress setup (Stretch Lite, nginx, php7.0, MariaDB, Adminer, Wordpress) until about a week ago when I noticed that upon booting the PHP7.0-fpm service was no longer starting. This of course was giving my visitors(me) the 502 Gateway error.

Manually starting the service with "sudo service php7.0-fpm start" gets the service running again without any issue.

The only feedback I'm getting is this from syslog:

Apr 4 14:59:04 MICROPIXELPUMPER systemd[1]: php7.0-fpm.service: Start operation timed out. Terminating.
Apr 4 14:59:04 MICROPIXELPUMPER systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
Apr 4 14:59:04 MICROPIXELPUMPER systemd[1]: php7.0-fpm.service: Unit entered failed state.
Apr 4 14:59:04 MICROPIXELPUMPER systemd[1]: php7.0-fpm.service: Failed with result 'timeout'.

I've tried changing the /etc/php/7.0/fpm/php.ini to log errors but the log stays error free.

I didn't do much between the time it was working to and the time I noticed it not working. But I do remember doing these things:
- updates: libsound2 and possibly python3-six (but i'm pretty certain that I had noticed the problem before the python update)
[UPDATE: made a backup of the working backup and used that SD image to update/upgrade the installation. PHP-7.0-FPM was starting fine - so the updates were not the problem]
- Installs: dnsutils, figlet
[UPDATE: the working setup does have dnsutils installed - that's not the problem]
- Enable ipv6 on my LAN - hmm... now that I write this maybe I can try turning it off... [UPDATE: Nope - going back to an IPv4 only LAN didn't change things]
- Possibly installed Webmin - but I have a feeling that all was working after this install, i'm just not sure. [UPDATE: Used a backup SD card from a few weeks ago and Webmin was installed and PHP7.0-FPM was starting fine]

What I know:
My php7.0-fpm configuration is correct - otherwise it would ALWAYS not start. And I did not modify it.
I found only one reference to this problem in my searches but it was related to php7.2 not php7.0 and the discussion was over my head because people were talking about kernel versions and virtual machines. I did not change the kernel.

It seems to me that something changed in the startup order or timing which causes the timeout. Starting php7.0-fpm manually doesn't fail because everything it needs is already loaded and running.

I've had a really fun time with my Raspberry Pi 3 B+ and this server setup. So much so that I just bought another one and got my original Pi B (with only 256 MB) off the shelf and working as a poor man's NAS. Fun times!

Thanks.

Andyroo

Re: php7.0-fpm.service: Start operation timed out. Terminating.

Fri Apr 05, 2019 2:05 am

Before you start it can you run:

Code: Select all

service php7.0-fpm status
It may show something more (or may not :roll: )

One thing that you could try is to set the Pi to wait for network connection in raspi-config to force network services to start (though not sure why CGI would be impacted by this).

One odd question - is this Pi headless (i.e. no keyboard / mouse)? As few hits show a timing issue with other services and you may be able to fix it with

Code: Select all

sudo apt install rng-tools
Not sure why but two or three links had this fix. Normally this is a fix for VNC and all it does is link the hardware random number generator to the software interfaces for random numbers and entropy...

pixelgazer
Posts: 3
Joined: Thu Apr 04, 2019 7:10 pm

Re: php7.0-fpm.service: Start operation timed out. Terminating.

Fri Apr 05, 2019 2:12 pm

Thanks for the response and the fix Andyroo.

Installing rng-tools fixed it.

Yes this a headless setup (SSH with RSA key)

The status after a reboot is:

● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
Active: activating (start) since Thu 2019-04-04 20:16:12 UTC; 16h ago
Docs: man:php-fpm7.0(8)
Main PID: 501 (php-fpm7.0)
CGroup: /system.slice/php7.0-fpm.service
└─501 /usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf

Apr 04 20:16:12 MICROPIXELPUMPER systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...

and the bullet is grey/white (ie. not green). Notice that there's no "Started" line.

After a few minutes:

● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Fri 2019-04-05 13:45:43 UTC; 7min ago
Docs: man:php-fpm7.0(8)
Process: 501 ExecStart=/usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf (code=killed, signal=TERM)
Main PID: 501 (code=killed, signal=TERM)

Apr 05 13:44:06 MICROPIXELPUMPER systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Apr 05 13:45:43 MICROPIXELPUMPER systemd[1]: php7.0-fpm.service: Start operation timed out. Terminating.
Apr 05 13:45:43 MICROPIXELPUMPER systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
Apr 05 13:45:43 MICROPIXELPUMPER systemd[1]: php7.0-fpm.service: Unit entered failed state.
Apr 05 13:45:43 MICROPIXELPUMPER systemd[1]: php7.0-fpm.service: Failed with result 'timeout'.


The status after a manual start is:

● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-04-05 13:14:50 UTC; 6s ago
Docs: man:php-fpm7.0(8)
Main PID: 1119 (php-fpm7.0)
Status: "Ready to handle connections"
CGroup: /system.slice/php7.0-fpm.service
├─1119 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
├─1253 php-fpm: pool www
└─1254 php-fpm: pool www

Apr 05 13:13:36 MICROPIXELPUMPER systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Apr 05 13:14:50 MICROPIXELPUMPER systemd[1]: Started The PHP 7.0 FastCGI Process Manager.

and the bullet is green. I noticed that it took longer to start this morning... say 30s where as it normally is 1s. But this is the first time I did manual start only a few seconds after it had booted up and had run the status command.

Hmm... I see a difference in the arguments used. Would that be the cause?

boot: --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf
manual: no args.

Waiting for a network connection at boot made no difference.

I noticed this when I looking at the output of journalctl -xe after a reboot

Apr 05 13:47:53 MICROPIXELPUMPER kernel: random: crng init done
Apr 05 13:47:53 MICROPIXELPUMPER kernel: random: 7 urandom warning(s) missed due to ratelimiting

Is the above significant?

AND FINALLY... installing rng-tools fixed the problem. php7.0-fpm is active and running after a reboot as soon as i'm able to login again. AWESOME!

Thanks again for the fix. I was about to go back to a week old backup and redo or port over the changed I had made since. You saved me a lot of time.

I still wonder what I did to cause this problem in the first place. I'd like to avoid it in the future.

Return to “Networking and servers”