nextcloud icon indicating copy to clipboard operation
nextcloud copied to clipboard

phpsessionclean fails on removing session files

Open 0xphk opened this issue 5 years ago • 1 comments

Hi, unsure if this is a problem with the installation, but on Ubuntu 18.04 and Debian 10 the systemd-timer controlled phpsessionclean.service fails with similar errors on both systems, syslog:

sessionclean[24005]: find: cannot delete '/usr/local/tmp/sessions/sess_a5a9uj18v2qgsavdk2oq1carn7': Read-only file system

I can not find any clue, the permissions of the session files are 600 www-data:www-data which should be ok, but the session folder itself is 777 www-data:root with tempfs sticky bit.

I thought the 'root' group ownership of the sessions directory could be the problem but chown www-data:www-data does not fix this. I guess phpsessionclean is also run under www-data context.

Any help on this is appreciated, thank you

0xphk avatar May 28 '20 07:05 0xphk

Looks like this is a systemd related error, probably some user context issue.

As manually running session-clean works, the problem can be fixed by switching back to cron: systemctl disable --now phpsessionclean.timer

then modify /etc/cron.d/php and remove the systemd test condition from 09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi to 09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean

Now this uses cron again to run this in root context, so cleaning up old sessions works again. Maybe this helps another ppl.

0xphk avatar May 29 '20 08:05 0xphk