Notify_push - Failed to connect to Nextcloud database

Nextcloud version: 21.0.3
Operating system and version: Ubuntu 20.04.2 LTS
Installed via snap
PHP version: 7.4.21

Attempting to get notify_push set up due to incredibly slow and non responsive Nextcloud client syncs: Nextcloud Client Not Syncing

When I run “sudo nextcloud.occ notify_push:setup”, I am prompted to create the notify_push.service file at /etc/systemd/system/ and copy and paste the following content into that file:

Description = Push daemon for Nextcloud clients

ExecStart=/var/snap/nextcloud/28403/nextcloud/extra-apps/notify_push/bin/x86_64/notify_push /var/snap/nextcloud/28403/nextcloud/config/config.php

WantedBy =

My config.php DB information is below:


  • ‘datadirectory’ => ‘/var/snap/nextcloud/common/nextcloud/data’,*
  • ‘dbtype’ => ‘mysql’,*
  • ‘version’ => ‘’,*
  • ‘overwrite.cli.url’ => ‘’,*
  • ‘dbname’ => ‘nextcloud’,*
  • ‘dbhost’ => ‘localhost:/tmp/sockets/mysql.sock’,*
  • ‘dbport’ => ‘’,*
  • ‘dbtableprefix’ => ‘oc_’,*
  • ‘mysql.utf8mb4’ => true,*
  • ‘dbuser’ => ‘nextcloud’,*
  • ‘dbpassword’ => ‘REMOVED’,*

However when I try to start the notify_push.service, I am seeing the following errors:

0: Failed to connect to Nextcloud database
1: error communicating with the server: No such file or directory (os error 2)
2: No such file or directory (os error 2)
notify_push[406185]: Backtrace omitted.

Any help would be greatly appreciated.

Thank you.

If I change my ‘dbhost’ section in config.php to just ‘localhost’ the notify_push service will start successfully, but access to my Nextcloud is broken:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Obviously not a fix so I’ve reverted changes but figured it was worth mentioning…

Any help would be greatly appreciated.

bump please.

Your database socket is contained within a randomized subdirectory of /tmp, which the snap thinks is /tmp but actually isn’t on the host (this is part of the confinement model-- the snap can’t write all over your host’s /tmp). Which means your config.php only has meaning within the context of the snap, not the host. If you try to find the database socket using that config, you won’t find it. I’m not sure there’s a good solution to this. I feel like this should be connecting to a REST API hosted by a Nextcloud app instead of trying to share the database.

See this PR for some ideas how to configure this with the Nextcloud Snap Reflect changes needed for snap variant by omyno · Pull Request #98 · nextcloud/notify_push · GitHub

1 Like

Hey, that means it’s not randomized anymore eh? Okay that seems like a fine solution. Still seems weird to want to hit the db directly, but no matter.