#1033869 php7.4-fpm.service does not wait for network-fs and nss-lookup target

#1033869#5
Date:
2023-04-03 08:03:03 UTC
From:
To:
Dear Maintainer,

The service php7.4-fpm does not wait for network-fs.target and nss-lookup.target. When
configuring php7.4-fpm for a webroot on an NFS filesystem, the service php7.4-fpm
fails to start after boot with:

```
-- Boot 1d43e9ba3080404a96229328d8af48e3 --
Apr 03 09:06:41 edu3 systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Apr 03 09:06:42 edu3 php-fpm[575]: [ERROR] [pool klangundumwelt] the prefix '/home/klangundumwelt/public_html' does not exist or is not a directory
Apr 03 09:06:42 edu3 php-fpm7.4[575]: [ERROR] [pool klangundumwelt] the prefix '/home/klangundumwelt/public_html' does not exist or is not a directory
Apr 03 09:06:42 edu3 php-fpm7.4[575]: [ERROR] failed to post process the configuration
Apr 03 09:06:42 edu3 php-fpm7.4[575]: [ERROR] FPM initialization failed
Apr 03 09:06:42 edu3 php-fpm[575]: [ERROR] failed to post process the configuration
Apr 03 09:06:42 edu3 php-fpm[575]: [ERROR] FPM initialization failed
```

In this example, the nfs share is mounted on `/home/klangundumwelt`.

php7.4-fpm is configured differently from similar services like apache2:

```
# head -n 4 /lib/systemd/system/apache2.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/
```

vs.

```
# head -n 4 /lib/systemd/system/php7.4-fpm.service
[Unit]
Description=The PHP 7.4 FastCGI Process Manager
Documentation=man:php-fpm7.4(8)
After=network.target
```

I see no reason, why php7.4-fpm should not also wait for network-fs and nss-lookup.

Overriding `After` fixes the problem:

```
# cat /etc/systemd/system/php7.4-fpm.service.d/override.conf
[Unit]
After=
After=network.target remote-fs.target nss-lookup.target
```

Thanks for consideration,
Roman