Can't login after update to 27.1.3

Dear nextcloud community, I need help with a problem:
I can’t login anymore.
This started after the last nextcloud update. My windows and android apps’ session are still alive, works fine, but I can’t make any new login. The browser logins are expired. I tried to make a new user, or change the php folder and files user/group to www-data, add 770 permission, but these are not working. Also I have plenty of space on both drives (100GB+), they are not full. I’m using the /var/www/nextcloud version of NC with www-data:www-data user/group

update1: I want to reinstall php, but ubuntu 22.10 is no longer supported, so I had to upgrade to 23.04. Everything is done, works fine, except Nextcloud. still the same, can’t login, the login page just refreshes after trying to login.
Also I tried sudo -u www-data php /var/www/nextcloud/occ maintenance:repair , not working.
There are no files created in /var/lib/php/sessions
I set this folder to use by php in php’s php.ini files (both php/8.1/apache2 and /cli folders, but I think this should be the default. It worked befor the nc update)

update2: if I chmod 777 -R /var/lib/php/sessions/ then it WORKS!! What is the problem then? It looks like it is something permission thing. Now there are files in the session folder, with www-data:www-data ownership! I think I shouldnt live with a chmod 777 session folder. it should be 770? So what can I do to make it work again?

update3: OK, the folder itself is 777, but the session files created are -rw-------. So it looks it’s safe, right? stuuuupid linux :man_facepalming::man_facepalming::man_facepalming:

Nextcloud version : 27.1.3.2
Operating system and version : Ubuntu 23.04
Apache or nginx version : Apache/2.4.54 (Ubuntu)
PHP version : PHP 8.1.7-1ubuntu3.5

The issue you are facing:
Can’t login.

Is this the first time you’ve seen this error? (Y/N): yes

Steps to replicate it:
Try to login from anywhere, from any device

The output of your Nextcloud log in Admin > Logging:

can't access

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

<?php
$CONFIG = array (
  'maintenance' => false,
  'instanceid' => ' 🥰🥰🥰',
  'passwordsalt' => ' 🥰🥰🥰',
  'secret' => ' 🥰🥰🥰',
  'allow_local_remote_servers' => true,
  'trusted_domains' => 
  array (
    0 => '192.168.31.85', //LAN address of the server
    1 => ' 🥰🥰🥰
  ),
  'trusted_proxies' => 
  array (
    0 => '172.19.0.2',
  ),
  'filelocking.enabled' => false,
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '27.1.3.2',
  'overwrite.cli.url' => 'http://192.168.31.85/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '🥰🥰🥰',
  'dbpassword' => '🥰🥰🥰',
  'installed' => true,
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Movie',
    1 => 'OC\\Preview\\PNG',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\GIF',
    4 => 'OC\\Preview\\BMP',
    5 => 'OC\\Preview\\XBitmap',
    6 => 'OC\\Preview\\MP3',
    7 => 'OC\\Preview\\MP4',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\PDF',
    11 => 'OC\\Preview\\MKV',
  ),
  'app_install_overwrite' => 
  array (
    0 => 'video_converter',
  ),
  'theme' => '',
  'loglevel' => 2,
  'memories.exiftool' => '/var/www/nextcloud/apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/nextcloud/apps/memories/bin-ext/go-vod-amd64',
  'memories.vod.ffmpeg' => '/usr/local/bin/ffmpeg',
  'memories.vod.ffprobe' => '/usr/local/bin/ffprobe',
  'memories.gis_type' => 1,
  'preview_max_x' => 4096,
  'preview_max_y' => 4096,
  'preview_max_memory' => 1280,
  'max_filesize' => '10G',
  'memories.vod.disable' => false,
  'memories.vod.vaapi' => true,
);

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

192.168.31.85:80 192.168.31.76 - - [05/Nov/2023:11:51:04 +0100] "POST /nextcloud/index.php/login HTTP/1.1" 303 1474 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
192.168.31.85:80 192.168.31.76 - - [05/Nov/2023:11:51:04 +0100] "GET /nextcloud/index.php/login?user=s&direct=1 HTTP/1.1" 200 8585 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
192.168.31.85:80 192.168.31.76 - - [05/Nov/2023:11:51:04 +0100] "GET /nextcloud/index.php/apps/unsplash/api/login.css HTTP/1.1" 200 1004 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
192.168.31.85:80 192.168.31.76 - - [05/Nov/2023:11:51:04 +0100] "GET /nextcloud/index.php/apps/theming/icon?v=b6589fc6 HTTP/1.1" 200 26162 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"v7mqa3fPGELNPQcbyyVi","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"v7mqa3fPGELNPQcbyyVi","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"v7mqa3fPGELNPQcbyyVi","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"v7mqa3fPGELNPQcbyyVi","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"v7mqa3fPGELNPQcbyyVi","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"v7mqa3fPGELNPQcbyyVi","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"JhY5awEJ41UucFE2WIQu","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/login?user=s&direct=1","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"JhY5awEJ41UucFE2WIQu","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/login?user=s&direct=1","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"JhY5awEJ41UucFE2WIQu","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/login?user=s&direct=1","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"JhY5awEJ41UucFE2WIQu","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/login?user=s&direct=1","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"JhY5awEJ41UucFE2WIQu","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/login?user=s&direct=1","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"JhY5awEJ41UucFE2WIQu","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/login?user=s&direct=1","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"KkZCBZYxp4NbBZbIh7mK","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/unsplash/api/login.css","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"KkZCBZYxp4NbBZbIh7mK","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/unsplash/api/login.css","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"KkZCBZYxp4NbBZbIh7mK","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/unsplash/api/login.css","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"KkZCBZYxp4NbBZbIh7mK","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/unsplash/api/login.css","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"ENDmH22K9QWy5jn7jQvW","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/theming/icon?v=b6589fc6","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"ENDmH22K9QWy5jn7jQvW","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/theming/icon?v=b6589fc6","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"ENDmH22K9QWy5jn7jQvW","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/theming/icon?v=b6589fc6","message":"session_start(): open(/var/lib/php/sessions/sess_014q887of38bq2reonnfni2jj5, O_RDWR) failed: Permission denied (13) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}
{"reqId":"ENDmH22K9QWy5jn7jQvW","level":3,"time":"2023-11-05T10:51:04+00:00","remoteAddr":"192.168.31.76","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/theming/icon?v=b6589fc6","message":"session_start(): Failed to read session data: files (path: /var/lib/php/sessions) at /var/www/nextcloud/lib/private/Session/Internal.php#222","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.3.2","data":{"app":"PHP"}}

Please do not use the half year dev beta Ubuntu versions. Please only use the Ubuntu LTS version e.g. Ubuntu 22.04 LTS and only dist-upgrade then in the next year (2024) from Ubuntu 22.04 LTS to Ubuntu 24.04 LTS , … Please also do not use Ubuntu 23.10. :skull:

Is your problem solved or not? Because of all your changes it might be better to reinstall Ubuntu 22.04 LTS (or Debian 12 Bookworm) and also reinstall Nextcloud. Please configure all new and only import the data. You can copy the data to the Nextcloud dirs and make occ files:scan --all. You can import e.g. contacts and calendar. But all shares are lost.

Requirements

You get all correct software (e.g. Apache2, MariaDB, PHP, …) from Ubuntu 22.04 LTS and Debian 12.