PHP and opendkim not working after reboot

What type of hardware are you using: Raspberry Pi 3, 4+
What YunoHost version are you running: 12.0.17
How are you able to access your server: The webadmin
SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: YunoHost installed on top of Raspberry Pi OS lite, external drive mounted in fstab, running Nextcloud

Describe your issue

Hello, after each reboot, php and opendkim services do not work. I’m not sure if the two errors are related, but I think so.
The PHP error :

Jun 12 08:36:05 php-fpm8.3[1135]: [12-Jun-2025 08:36:05] ERROR: unable to bind listening socket for address '/var/run/php/php8.3-fpm-nextcloud.sock': No such file or directory (2)
Jun 12 08:36:05 php-fpm8.3[1135]: [12-Jun-2025 08:36:05] ERROR: FPM initialization failed
Jun 12 08:36:05 systemd[1]: php8.3-fpm.service: Main process exited, code=exited, status=78/CONFIG
Jun 12 08:36:05 systemd[1]: php8.3-fpm.service: Failed with result 'exit-code'.
Jun 12 08:36:05 systemd[1]: Failed to start php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager.

The opendkim error :

Jun 10 13:13:14 opendkim[2686]: can't write pid to /run/opendkim/opendkim.pid: No such file or directory
Jun 10 13:13:14 systemd[1]: opendkim.service: Can't open PID file /run/opendkim/opendkim.pid (yet?) after start: No such file or directory

I can manually resolve the problems like this :
For PHP:

sudo mkdir -p /var/run/php/

For opendkim

sudo mkdir -p /run/opendkim/
sudo chown opendkim:opendkim /run/opendkim/
sudo chmod 755 /run/opendkim/

Then I can restart the two services in the web-admin. But after a reboot the problems are back.

During an update of PHP I saw the following error which might be related :

Detected unsafe path transition / (owned by debianadmin) → /run (owned by root) during canonicalization of /run.

“debianadmin” is the admin which was created during the installation of the underlying RaspberryPi OS. The YunoHost-Admin is a different one.

Share relevant logs or error messages

Hello @clay
A few questions to clarify the situation:

  • can you post the output of namei -l /var/run/php ? My guess is that it’s an ownership misconfiguration : / should be owned by root.
  • Is it the file /var/run/php/php8.3-fpm-nextcloud.sockor the directory /var/run/php that does not exist when you restart?
  • Can you post the content of /etc/php/8.3/fpm/pool.d/nextcloud.conf?
1 Like

Hi @otm33
Thank you for your reply.

Here come my answers:

  • output of namei -l /var/run/php:
f: /var/run/php
drwxr-xr-x debianadmin debianadmin /
drwxr-xr-x root     root     var
lrwxrwxrwx root     root     run -> /run
drwxr-xr-x debianadmin debianadmin   /
drwxr-xr-x root     root       run
drwxr-xr-x root     root     php
  • The directory /var/run/php does not exist after a reboot. Neither does the directory /run/opendkim

  • the content of /etc/php/8.3/fpm/pool.d/nextcloud.conf:

[nextcloud]

user = nextcloud
group = nextcloud

chdir = /var/www/nextcloud

listen = /var/run/php/php8.3-fpm-nextcloud.sock
listen.owner = www-data
listen.group = www-data

pm = ondemand
pm.max_children = 16
pm.max_requests = 500
request_terminate_timeout = 1d

pm.process_idle_timeout = 10s
php_admin_value[upload_max_filesize] = 10G
php_admin_value[post_max_size] = 10G
php_admin_value[memory_limit] = 512M

; Additional php.ini defines, specific to this pool of workers.
env[PATH] = $PATH
php_value[default_charset] = UTF-8
; OPcache is already activated by default
; php_value[opcache.enable]=1
; The following parameters are nevertheless recommended for Nextcloud
; see here: https://docs.nextcloud.com/server/20/admin_manual/installation/server_tuning.html#enable-php-opcache
php_value[opcache.enable_cli]=1
php_value[opcache.interned_strings_buffer]=32
php_value[opcache.max_accelerated_files]=10000
php_value[opcache.memory_consumption]=128
php_value[opcache.save_comments]=1
php_value[opcache.revalidate_freq]=60
; https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#configuring-php
php_value[output_buffering]=0
; https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html#id1
php_value[apc.enabled]=1
php_value[apc.enable_cli]=1```

Unless there is a specific need, you should restore ownership of / to root.

1 Like

I think this happened by accident or automatically in the install-process. I can’t remember to have done this on purpose. Can you help me to safely change this to how it should be?

sudo chown root:root /

Problem solved, PHP and opendkim are running after a reboot. Thank you very much :slight_smile: