Cannot create files or folder after setting up redis for memcache and transactional file locking

Click Here For Error logs

Error Log:

[webdav] Error: RedisException: No such file or directory at <<closure>>

 0. /var/www/html/lib/private/RedisFactory.php line 137
    Redis->pconnect("/var/run/redis/redis.sock", 0, 1, null, 0, 0)
 1. /var/www/html/lib/private/RedisFactory.php line 178
    OC\RedisFactory->create("*** sensitive parameters replaced ***")
 2. /var/www/html/lib/private/Memcache/Redis.php line 66
    OC\RedisFactory->getInstance()
 3. /var/www/html/lib/private/Memcache/Redis.php line 137
    OC\Memcache\Redis->getCache()
 4. /var/www/html/lib/private/Lock/MemcacheLockingProvider.php line 61
    OC\Memcache\Redis->inc("files/4fe49c68f3bcd831b504045a433b596d")
 5. /var/www/html/lib/private/Files/Storage/Common.php line 765
    OC\Lock\MemcacheLockingProvider->acquireLock("files/4fe49c68f3bcd831b504045a433b596d", 1, "home::partha::files/New folder")
 6. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 607
    OC\Files\Storage\Common->acquireLock("files/New folder", 1, ["OC\\Lock\\MemcacheLockingProvider"])
 7. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 607
    OC\Files\Storage\Wrapper\Wrapper->acquireLock("files/New folder", 1, ["OC\\Lock\\MemcacheLockingProvider"])
 8. /var/www/html/lib/private/Files/View.php line 1917
    OC\Files\Storage\Wrapper\Wrapper->acquireLock("files/New folder", 1, ["OC\\Lock\\MemcacheLockingProvider"])
 9. /var/www/html/lib/private/Files/View.php line 2030
    OC\Files\View->lockPath("/New folder", 1, false)
10. /var/www/html/lib/private/Files/View.php line 1123
    OC\Files\View->lockFile("/New folder", 1)
11. /var/www/html/lib/private/Files/View.php line 243
    OC\Files\View->basicOperation("mkdir", "/New folder", ["create","write"])
12. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 182
    OC\Files\View->mkdir("//New folder")
13. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1210
    OCA\DAV\Connector\Sabre\Directory->createDirectory("*** sensitive parameters replaced ***")
14. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 560
    Sabre\DAV\Server->createCollection("*** sensitive parameters replaced ***")
15. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpMkcol(["Sabre\\HTTP\\Request"], ["Sabre\\HTTP\\Response"])
16. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit("method:MKCOL", [["Sabre\\HTTP\\ ... ]])
17. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod(["Sabre\\HTTP\\Request"], ["Sabre\\HTTP\\Response"])
18. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
19. /var/www/html/apps/dav/lib/Server.php line 364
    Sabre\DAV\Server->exec()
20. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
21. /var/www/html/remote.php line 172
    require_once("/var/www/html/a ... p")



Nextcloud version : 27.0.0
Operating system and version : OS: Debian GNU/Linux 11 (bullseye) x86_64
Running inside a docker container
Apache or nginx version: Apache/2.4.56 (Debian)
PHP version : PHP 8.2.7 (cli) (built: Jun 14 2023 05:26:32) (NTS)

After the nextcloud 5 update i got the memcached error to properly configure APCu, it was already properly configured from before so after reading a bit into other similar issues in the forum i found the suggestion of setting up redis for memcache and transactional database locking. After some trial and error i finally managed to get all checks passed and redis for memcache was set up successfully. but now a issue has arised, i cannot create a new file or folder, i keep getting the message “Cannot/Failed to create file/folder”.

1 Like

Same issue here on Rocky Linux 8 - I had to disable Redis to be able to use the server - watching for an answer !

I was running into the same thing on my TrueNas setup for days: I could either get the memcahce locking setup warning to go away, or get nextcloud to function, but not both :joy:

Not entirely sure what I did to fix it, but many iterations of:
tweak setting; reset my system; log in to nextcloud and test; repeat eventually got me to a good state.

Ultimately here’s the config.php I landed on:

<?php
$CONFIG = array (
   // Some irrelevant things up here...
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost', // 
    'port' => 6379,
    'timeout' => 0.0,
    'password' => '[REDACTED]',
  ),
  // ... some more irrelevant things down here
);

In the above:

  • I think the ‘host’ differs from the official nextcloud docs in that it asks you to put ‘127.0.0.1’ as the host (which btw is also how the bind is specified by default in the redis.conf – I left that alone). I don’t think it should make any difference.
  • The port I specified is the default port in redis. I’ve seen some guides recommend port 0, but I think that’s for a socks(?) setup that I don’t know anything about, and doesn’t seem to play nice with the default stuff.
  • Redis passwords are off by default, so I enabled that in redis.conf and in the config.php – so that may be worth trying (I’m also not sure if no-password redis corresponds to config.php with an empty string password, of the field omitted altogether from the array).

redis-server --version
Redis server v=7.2.0 sha=00000000:0 malloc=libc bits=64 build=ff30b16e8131d22

php --version
PHP 8.2.9 (cli) (built: Aug 19 2023 01:17:15) (NTS)

freebsd-version
13.1-RELEASE-p5

I think part of my original issue was that when I tried to set this up, the nextcloud docs page was down, and I went to different websites which directed me to do fancier things (sockets?) than I’m capable of (never used redis, don’t know anything about redis).

A note to other people who run into this issue, I initially thought that it was a permissions problem, because the symptoms resemble those when your nextcloud user doesn’t have write permissions on the data directory, but adding the redis user to the www group (I think in most setups the group is ‘www-data’ or something), or visa versa didn’t do anything. A good way to check that this is your issue, is to just comment out the ‘memcache.locking’ property in your nextcloud config.php. Toggling this property (pre-fix) allowed me to toggle between the “I can create files in nextcloud” state, and the “security & setup warnings all pass” state.

My solution was to set the password in the config.php and in redis.conf:

(config.php)

‘redis’ =>
array (

‘password’ => ‘MySecretPassword’,
),

(/etc/redis/redis.conf)

requirepass MySecretPassword