Self-Hosted Nextcloud Migration from CentOS to Ubuntu "Failed to read session data: files (path: tcp://localhost:6379?auth=[removed])"

Hi everyone!

I’m moving from CentOS to Ubuntu and running into a strange issue with Nextcloud.

I followed the guide here and the Maintenance Mode page displays correctly but I see errors in data/nextcloud.log referencing my Redis connection on the old server.

Since I saw this error before I disabled Redis on the old server and re-did the migration but I’m still seeing the same error. I confirmed that Redis isn’t being used in the system status page on the old server before doing the migration as well.

I cannot login to the web console but my Android version can access files and works without throwing any major errors.

Is something being preserved regarding my user session data in the database? Redis is completely off in the config but somehow the instance is looking to open files at a a location it shouldn’t even know about anymore.

config/config.php

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxx',
  'secret' => 'xxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'website.com',
  ),
  'datadirectory' => '/usr/local/nginx/website.com/data',
  'overwrite.cli.url' => 'https://website.com',
  'dbtype' => 'mysql',
  'version' => '25.0.6.1',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxxxxxxxx',
  'dbpassword' => 'xxxxxxxxx',
  'installed' => true,
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'root',
  'mail_domain' => 'website.com',
  'default_phone_region' => 'US',
  'maintenance' => true,
  'theme' => '',
  'loglevel' => 0,
  'app_install_overwrite' =>
  array (
    0 => 'bruteforcesettings',
    1 => 'calendar',
  ),
  'enable_previews' => true,
  'preview_max_x' => 1000,
  'preview_max_y' => 1000,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\PDF',
    3 => 'OC\\Preview\\MSOfficeDoc',
    4 => 'OC\\Preview\\JPEG',
    5 => 'OC\\Preview\\PNG',
    6 => 'OC\\Preview\\GIF',
    7 => 'OC\\Preview\\BMP',
    8 => 'OC\\Preview\\XBitmap',
    9 => 'OC\\Preview\\MP3',
    10 => 'OC\\Preview\\HEIC',
    11 => 'OC\\Preview\\Movie',
    12 => 'OC\\Preview\\MKV',
    13 => 'OC\\Preview\\MP4',
    14 => 'OC\\Preview\\AVI',
  ),
  'mysql.utf8mb4' => true,
  'data-fingerprint' => 'xxxxxxxxxxxxxxxx',
);

error from data/nextcloud.log

{"reqId":"gfZbniFpAu6CqNtHPguz","level":3,"time":"2023-05-18T14:24:33+00:00","remoteAddr":"67.149.253.87","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"session_start(): Failed to read session data: files (path: tcp://localhost:6379?auth=) at /usr/local/nginx/website.name/lib/private/Session/Internal.php#221"
,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0","version":"25.0.6.1","exception":{"Exception":"Error","Message":"session_start(): Failed to read session data: files (path: tcp://localhost:6379?auth=) at /usr/local/nginx/website.name/lib/private/Session/Internal.php#221","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"function":"session_start"},{"file":"/usr/local/nginx/website.name/lib/private/Session/Internal.php","line":221,
"function":"call_user_func_array"},{"file":"/usr/local/nginx/website.name/lib/private/Session/Internal.php","line":233,"function":"invoke","class":"OC\\Session\\Internal","type":"->"},{"file":"/usr/local/nginx/website.name/lib/private/Session/Internal.php",
"line":181,"function":"startSession","class":"OC\\Session\\Internal","type":"->"},{"file":"/usr/local/nginx/website.name/lib/private/Session/CryptoSessionData.php","line":169,
"function":"reopen","class":"OC\\Session\\Internal","type":"->"},
{"file":"/usr/local/nginx/website.name/lib/private/Session/CryptoSessionData.php","line":105,"function":"reopen","class":"OC\\Session\\CryptoSessionData","type":"->"},
{"file":"/usr/local/nginx/website.name/lib/private/legacy/OC_Util.php","line":736,"function":"set","class":"OC\\Session\\CryptoSessionData","type":"->"},
{"file":"/usr/local/nginx/website.name/lib/base.php","line":687,"function":"checkServer","class":"OC_Util","type":"::"},
{"file":"/usr/local/nginx/website.name/lib/base.php","line":1145,"function":"init","class":"OC","type":"::"},
{"file":"/usr/local/nginx/website.name/status.php","line":37,"args":["/usr/local/nginx/website.name/lib/base.php"],"function":"require_once"}],
"File":"/usr/local/nginx/website.name/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}

Sounds like your PHP config also has Redis setup for session storage. That is enabled outside of Nextcloud, but isn’t unusual or anything (though it’s a little advanced).

The parameters are either in your php.ini for your web server associated php installation or one if it’s include directories. The parameters are session.save_handler and session.save_path. You probably wantfiles and something like /tmp respectively.

P.S. You may want to just install Redis again - it’s fairly easy and you can use it for locking and caching too.

Hi jtr,

Thanks for the reply!

I checked and for cli and fpm they are both already set to “files” and “/var/lib/sessions”

Does it seem weird to you that the PW from config.php is showing up in the request as tcp://localhost:6379?auth=[redis password]?

The default php install shouldn’t know about that PW which is why I’m thinking it has something to do with session info or ‘cached’ config data.

Output from fpm and cli php.ini is below showing the handler is set to ‘files’. Also, the conf.d directories don’t have anything redis related except to load redis.so

root@:/usr/local/nginx/ncloud.x.com# grep session.save /etc/php/8.1/cli/php.ini
; https://php.net/session.save-handler
session.save_handler = files
;     session.save_path = "N;/path"
;     session.save_path = "N;MODE;/path"
; https://php.net/session.save-path
;session.save_path = "/var/lib/php/sessions"
;       (see session.save_path above), then garbage collection does *not*

root@x:/usr/local/nginx/ncloud.x.com# grep session.save /etc/php/8.1/fpm/php.ini
; https://php.net/session.save-handler
session.save_handler = files
;     session.save_path = "N;/path"
;     session.save_path = "N;MODE;/path"
; https://php.net/session.save-path
;session.save_path = "/var/lib/php/sessions"
;       (see session.save_path above), then garbage collection does *not*