Shares get lost after restart (NC 19.0.1.1 Ubuntu Snap3 (22653))

Nextcloud version: 19.0.1snap3 (22653)
Operating system and version: Ubuntu 18.04

The issue you are facing:
Some (especially newly created) shares get lost after each restart of nextcloud service

Is this the first time you’ve seen this error?: Y
May be related to the last update (from 22400 to 22653)

Steps to replicate it:

  1. sudo snap restart nextcloud

The output of your Nextcloud log in Admin > Logging (at time of restart):

Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

    /snap/nextcloud/22653/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 889:

    OC\DB\Connection->connect()

    /snap/nextcloud/22653/htdocs/lib/private/DB/Connection.php - line 194:

    Doctrine\DBAL\Connection->executeQuery("SELECT * FROM `oc_appconfig`", [], [], null)

    /snap/nextcloud/22653/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 200:

    OC\DB\Connection->executeQuery("SELECT * FROM `oc_appconfig`", [], [])

    /snap/nextcloud/22653/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php - line 216:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /snap/nextcloud/22653/htdocs/lib/private/AppConfig.php - line 331:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /snap/nextcloud/22653/htdocs/lib/private/AppConfig.php - line 109:

    OC\AppConfig->loadConfigValues()

    /snap/nextcloud/22653/htdocs/lib/private/AppConfig.php - line 287:

    OC\AppConfig->getApps()

    /snap/nextcloud/22653/htdocs/lib/private/legacy/OC_App.php - line 883:

    OC\AppConfig->getValues(false, "installed_version")

    /snap/nextcloud/22653/htdocs/lib/private/Server.php - line 662:

    OC_App::getAppVersions()

    /snap/nextcloud/22653/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php - line 118:

    OC\Server->OC\{closure}("*** sensiti ... *")

    /snap/nextcloud/22653/htdocs/lib/private/ServerContainer.php - line 124:

    Pimple\Container->offsetGet("OC\\Memcache\\Factory")

    /snap/nextcloud/22653/htdocs/lib/private/Server.php - line 1699:

    OC\ServerContainer->query("OC\\Memcache\\Factory")

    /snap/nextcloud/22653/htdocs/lib/private/Server.php - line 853:

    OC\Server->getMemCacheFactory()

    /snap/nextcloud/22653/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php - line 118:

    OC\Server->OC\{closure}("*** sensiti ... *")

    /snap/nextcloud/22653/htdocs/lib/private/ServerContainer.php - line 124:

    Pimple\Container->offsetGet("OC\\App\\AppManager")

    /snap/nextcloud/22653/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 163:

    OC\ServerContainer->query("OC\\App\\AppManager")

    /snap/nextcloud/22653/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php - line 114:

    OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}("*** sensiti ... *")

    /snap/nextcloud/22653/htdocs/lib/private/ServerContainer.php - line 124:

    Pimple\Container->offsetGet("OCP\\App\\IAppManager")

    /snap/nextcloud/22653/htdocs/lib/private/Server.php - line 1889:

    OC\ServerContainer->query("OCP\\App\\IAppManager")

    /snap/nextcloud/22653/htdocs/lib/private/legacy/OC_App.php - line 347:

    OC\Server->getAppManager()

    /snap/nextcloud/22653/htdocs/lib/private/legacy/OC_App.php - line 114:

    OC_App::getEnabledApps()

    /snap/nextcloud/22653/htdocs/lib/base.php - line 647:

    OC_App::loadApps([ "session"])

    /snap/nextcloud/22653/htdocs/lib/base.php - line 1090:

    OC::init()

    /snap/nextcloud/22653/htdocs/cron.php - line 42:

    require_once("/snap/nextc ... p")

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'instanceid' => 'XXX',
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'XXX',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'overwrite.cli.url' => 'http://localhost',
  'dbtype' => 'mysql',
  'version' => '19.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XXX',
  'logtimezone' => 'UTC',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_from_address' => 'XXX',
  'mail_domain' => 'XXX',
  'mail_smtphost' => 'XXX',
  'mail_smtpport' => 'XXX',
  'mail_smtpsecure' => 'tls',
  'mail_smtpname' => 'XXX',
  'mail_smtppassword' => 'XXX',
  'loglevel' => 2,
  'maintenance' => false,
  'trashbin_retention_obligation' => '30,40',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'mysql.utf8mb4' => true,
  'theme' => '',
);

The output of your Apache/nginx/system log in /var/log/____:

[Wed Aug 26 19:13:31.647841 2020] [proxy_fcgi:error] [pid 30409:tid 140448039429888] [client XXX:52823] AH01067: Failed to read FastCGI header
[Wed Aug 26 19:13:31.647869 2020] [proxy_fcgi:error] [pid 30409:tid 140448039429888] (104)Connection reset by peer: [client XXX:52823] AH01075: Error dispatching request to :
[Wed Aug 26 19:13:31.651348 2020] [proxy_fcgi:error] [pid 30628:tid 140448156862208] [client XXX:65167] AH01067: Failed to read FastCGI header
[Wed Aug 26 19:13:31.651373 2020] [proxy_fcgi:error] [pid 30628:tid 140448156862208] (104)Connection reset by peer: [client XXX:65167] AH01075: Error dispatching request to :
[Wed Aug 26 19:13:31.653108 2020] [proxy_fcgi:error] [pid 30409:tid 140448853128960] [client XXX:35997] AH01067: Failed to read FastCGI header
[Wed Aug 26 19:13:31.653126 2020] [proxy_fcgi:error] [pid 30409:tid 140448853128960] (104)Connection reset by peer: [client XXX:35997] AH01075: Error dispatching request to :
[Wed Aug 26 19:13:31.655504 2020] [proxy_fcgi:error] [pid 30409:tid 140448811165440] [client XXX:52601] AH01067: Failed to read FastCGI header
[Wed Aug 26 19:13:31.655523 2020] [proxy_fcgi:error] [pid 30409:tid 140448811165440] (104)Connection reset by peer: [client XXX:52601] AH01075: Error dispatching request to :
[Wed Aug 26 19:13:31.658762 2020] [proxy_fcgi:error] [pid 30628:tid 140448752449280] [client XXX:49704] AH01067: Failed to read FastCGI header
[Wed Aug 26 19:13:31.658780 2020] [proxy_fcgi:error] [pid 30628:tid 140448752449280] (104)Connection reset by peer: [client XXX:49704] AH01075: Error dispatching request to :
[Wed Aug 26 19:13:31.658776 2020] [proxy_fcgi:error] [pid 30628:tid 140449146709760] (32)Broken pipe: [client XXX:50985] AH01075: Error dispatching request to : (sending stdin)
[Wed Aug 26 19:13:31.677665 2020] [proxy:error] [pid 30409:tid 140449146709760] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.677689 2020] [proxy_fcgi:error] [pid 30409:tid 140449146709760] [client XXX:49705] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.680915 2020] [proxy:error] [pid 30628:tid 140448500799232] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.680934 2020] [proxy_fcgi:error] [pid 30628:tid 140448500799232] [client XXX:4680] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.722727 2020] [proxy:error] [pid 30409:tid 140449188673280] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.722753 2020] [proxy_fcgi:error] [pid 30409:tid 140449188673280] [client XXX:52825] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.732674 2020] [proxy:error] [pid 30628:tid 140449188673280] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.732697 2020] [proxy_fcgi:error] [pid 30628:tid 140449188673280] [client XXX:50986] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.755135 2020] [proxy:error] [pid 30628:tid 140448467228416] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.755159 2020] [proxy_fcgi:error] [pid 30628:tid 140448467228416] [client XXX:49706] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.793391 2020] [proxy:error] [pid 30628:tid 140448492406528] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.793413 2020] [proxy_fcgi:error] [pid 30628:tid 140448492406528] [client XXX:52602] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.799650 2020] [proxy:error] [pid 30628:tid 140449155102464] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.799672 2020] [proxy_fcgi:error] [pid 30628:tid 140449155102464] [client XXX:65168] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.809929 2020] [proxy:error] [pid 30410:tid 140448744056576] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.809962 2020] [proxy_fcgi:error] [pid 30410:tid 140448744056576] [client XXX:52826] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.810558 2020] [proxy:error] [pid 30628:tid 140448744056576] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.810574 2020] [proxy_fcgi:error] [pid 30628:tid 140448744056576] [client XXX:50987] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.817307 2020] [proxy:error] [pid 30628:tid 140448735663872] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.817332 2020] [proxy_fcgi:error] [pid 30628:tid 140448735663872] [client XXX:4684] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.824019 2020] [proxy:error] [pid 30628:tid 140448173647616] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.824039 2020] [proxy_fcgi:error] [pid 30628:tid 140448173647616] [client XXX:39121] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.833067 2020] [proxy:error] [pid 30411:tid 140449155102464] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.833098 2020] [proxy_fcgi:error] [pid 30411:tid 140449155102464] [client XXX:49707] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.888806 2020] [proxy:error] [pid 30411:tid 140448215578368] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.888829 2020] [proxy_fcgi:error] [pid 30411:tid 140448215578368] [client XXX:52827] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.891848 2020] [proxy:error] [pid 30628:tid 140448769234688] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.891898 2020] [proxy_fcgi:error] [pid 30628:tid 140448769234688] [client XXX:50988] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.910783 2020] [proxy:error] [pid 30409:tid 140449180280576] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.910808 2020] [proxy_fcgi:error] [pid 30409:tid 140449180280576] [client XXX:49708] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.934845 2020] [proxy:error] [pid 30628:tid 140449171887872] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.934867 2020] [proxy_fcgi:error] [pid 30628:tid 140449171887872] [client XXX:52603] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:31.935038 2020] [proxy:error] [pid 30628:tid 140448752449280] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/sockets/php-fpm.sock (*) failed
[Wed Aug 26 19:13:31.935058 2020] [proxy_fcgi:error] [pid 30628:tid 140448752449280] [client XXX:4685] AH01079: failed to make connection to backend: httpd-UDS
[Wed Aug 26 19:13:32.022886 2020] [mpm_event:notice] [pid 30408:tid 140449339346944] AH00491: caught SIGTERM, shutting down
[Wed Aug 26 19:13:38.991431 2020] [ssl:warn] [pid 1778:tid 139916685287424] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed Aug 26 19:13:38.995654 2020] [ssl:warn] [pid 1778:tid 139916685287424] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Wed Aug 26 19:13:38.996578 2020] [mpm_event:notice] [pid 1778:tid 139916685287424] AH00489: Apache/2.4.46 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Wed Aug 26 19:13:38.996596 2020] [core:notice] [pid 1778:tid 139916685287424] AH00094: Command line: 'httpd -d /snap/nextcloud/22653 -D EnableHTTPS -D EnableHSTS -D FOREGROUND'
[Wed Aug 26 19:13:38.997702 2020] [unixd:alert] [pid 1781:tid 139916685287424] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 26 19:13:38.999161 2020] [unixd:alert] [pid 1779:tid 139916685287424] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 26 19:13:39.000008 2020] [unixd:alert] [pid 1780:tid 139916685287424] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 26 19:13:41.001855 2020] [unixd:alert] [pid 1934:tid 139916685287424] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 26 19:20:57.536092 2020] [unixd:alert] [pid 2784:tid 139916685287424] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive