Redis error with newly installed nextcloud 24.0.2

Also had the same with previous 24 versions. I do the initial setup in a Linux server installing from command-line (without containers). When I do php occ app:list, I get:

An unhandled exception has been thrown:
RedisException: No such file or directory in /var/www/nextcloud/lib/private/RedisFactory.php:137
Stack trace:
#0 /var/www/nextcloud/lib/private/RedisFactory.php(137): Redis->pconnect()
#1 /var/www/nextcloud/lib/private/RedisFactory.php(178): OC\RedisFactory->create()
#2 /var/www/nextcloud/lib/private/Memcache/Redis.php(43): OC\RedisFactory->getInstance()
#3 /var/www/nextcloud/lib/private/Memcache/Factory.php(118): OC\Memcache\Redis->__construct()
#4 /var/www/nextcloud/lib/private/Server.php(1106): OC\Memcache\Factory->createLocking()
#5 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC\{closure}()
#6 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#7 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#8 /var/www/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#9 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#10 /var/www/nextcloud/lib/private/Server.php(2082): OC\AppFramework\Utility\SimpleContainer->get()
#11 /var/www/nextcloud/lib/private/Files/View.php(122): OC\Server->getLockingProvider()
#12 /var/www/nextcloud/lib/private/Server.php(454): OC\Files\View->__construct()
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC\{closure}()
#14 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#15 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#16 /var/www/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#17 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\ServerContainer->query()
#18 /var/www/nextcloud/lib/private/Server.php(1445): OC\AppFramework\Utility\SimpleContainer->get()
#19 /var/www/nextcloud/lib/base.php(602): OC\Server->boot()
#20 /var/www/nextcloud/lib/base.php(1104): OC::init()
#21 /var/www/nextcloud/console.php(48): require_once('/var/www/nextcl...')
#22 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#23 {main}

Despite the error being: No such file or directory in /var/www/nextcloud/lib/private/RedisFactory.php, this file exists. I did some research and I see that my Redis conf says there should be a redis.sock file on /var/run/redis/ but it does not exist. I have installed redis-server on Debian bullseye with apt-get.

Any idea how can I fix it?

1 Like

Did you also install the php-redis package?

Afaik a default installation of Redis on Debian is listening on port 6379 at localhost (127.0.0.1:6379)

You can check by entering the following command: ps ax | grep redis

You would then add a section like this to your config.php:

'redis' => [
     'host' => 'localhost',
     'port' => 6379,
],

If you have configured Nextcloud to connect to Redis via Unix Socket, which is the recommended way, you also have to configure Redis accordingly and set the correct permissions:

cp /etc/redis/redis.conf /etc/redis/redis.conf.bak

sed -i "s/port 6379/port 0/" /etc/redis/redis.conf

sed -i s/\#\ unixsocket/\unixsocket/g /etc/redis/redis.conf

sed -i "s/unixsocketperm 700/unixsocketperm 770/" /etc/redis/redis.conf

sed -i "s/# maxclients 10000/maxclients 10240/" /etc/redis/redis.conf

usermod -aG redis www-data

cp /etc/sysctl.conf /etc/sysctl.conf.bak

sed -i '$avm.overcommit_memory = 1' /etc/sysctl.conf

reboot now

Sources:

https://www.c-rieger.de/nextcloud-installationsanleitung-apache2-fast-track/

https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/caching_configuration.html#id2

1 Like

Wow, that is great. It worked as charm. Something was wrong in my config most probably. Thanks!

1 Like

I had the same problem. I updated my Ubuntu from 20.04.4 LTS (focal) up to version 22.04.1 LTS (jammy), afterwards my nextcloud didn’t work and I could not connect to the nextcloud.

journalctl -xe
zeigte Fehler an:
notify_push[827]: Failed to setup redis subscription: Error while running redis query

I solved this problem using the command
apt-get install php-redis

THANK YOU BB77 !!!

1 Like