Hi i have just tried using RPI-CLONE to take a backup of the disk attached and seemed to work OK…
then i thought id be smart and put nextcloudn into maintenance mode & stopping apache & mysql
sudo php /var/www/nextcloud/occ maintenance:mode --on
sudo systemctl stop apache2
sudo systemctl stop mariadb
backup ran again, seemingly OK
then restarted sql/apache & turned maintenance mode off
sudo systemctl start mariadb
sudo systemctl restart apache2
sudo php /var/www/nextcloud/occ maintenance:mode --off
but now i get when trying to login
Error
is there something else i need to do to get it out of maintenenace mode?
(i have tried enabling/disabling again & restarting)
Thanks!
[/details]
Nextcloud version (eg, 20.0.5): 23.0
Operating system and version (eg, Ubuntu 20.04): rasppi bullseye
Apache or nginx version (eg, Apache 2.4.25): not sure
PHP version (eg, 7.4): 7.4
ah i seem to of fixed it by running
sudo chmod 660 /var/www/nextcloud/config/config.php
sudo chown root:www-data /var/www/nextcloud/config/config.php
question… should this need to be ran after going in and out of maintenance mode or is it a bug?
thanks!
Someone/thing changed the permissions. Try putting it in maintenance mode and then recheck permissions on the config.php file. Then take it out of maintenance and check again. Perhaps for some reason the cloning script you are using is doing it or just user error?
ls -l /var/www/nextcloud/config/
hi thanks for the reply…
I’ve just done the same again without the rpi-clone
maintenance mode on
stop Apache
stop mysql
start mysql
start Apache
maintenance mode off
same error, I had to do the permissions again on the config, so must be some oddness with maintenance mode, at least I know what to if I need to clone the drive again.
cheers
try this instead:
Turn on maintenance mode. Then check the permissions on /var/www/nextcloud/config/config.php
See if it changed. If it didnt then do the same with apache. If it does then an idea would be to check your .htaccess file to see if something is not right there.
To my understanding, You do not need to stop apache or mysql in order to run a backup.
Thanks again, its definatley the maintenance mode on, then off that triggers this, ive just done
show permissions/maint on/off and login fails again with the original error until i do the chmod
output below
pi@nc:/var/www/nextcloud/config $ ls -l /var/www/nextcloud/config/
total 72
-rw-rw---- 1 root www-data 1187 Jan 12 17:17 config.php
-rw-rw---- 1 root www-data 672 Dec 19 16:13 config.php.save
-rw-r–r-- 1 www-data www-data 62977 Nov 26 20:51 config.sample.php
pi@nc:/var/www/nextcloud/config $ sudo php /var/www/nextcloud/occ maintenance:mode --on
Maintenance mode enabled
pi@nc:/var/www/nextcloud/config $ ls -l /var/www/nextcloud/config/
total 72
-rw-r----- 1 root www-data 1186 Jan 13 09:30 config.php
-rw-rw---- 1 root www-data 672 Dec 19 16:13 config.php.save
-rw-r–r-- 1 www-data www-data 62977 Nov 26 20:51 config.sample.php
pi@nc:/var/www/nextcloud/config $ sudo php /var/www/nextcloud/occ maintenance:mode --off
Maintenance mode disabled
pi@nc:/var/www/nextcloud/config $ ls -l /var/www/nextcloud/config/
total 72
-rw-r----- 1 root www-data 1187 Jan 13 09:30 config.php
-rw-rw---- 1 root www-data 672 Dec 19 16:13 config.php.save
-rw-r–r-- 1 www-data www-data 62977 Nov 26 20:51 config.sample.php
THIS NOW GIVES THE LOGIN ERROR
pi@nc:/var/www/nextcloud/config $ sudo chmod 660 /var/www/nextcloud/config/config.php
sudo chown root:www-data /var/www/nextcloud/config/config.php
pi@nc:/var/www/nextcloud/config $ ls -l /var/www/nextcloud/config/
total 72
-rw-rw---- 1 root www-data 1187 Jan 13 09:30 config.php
-rw-rw---- 1 root www-data 672 Dec 19 16:13 config.php.save
-rw-r–r-- 1 www-data www-data 62977 Nov 26 20:51 config.sample.php
LOGIN ERROR NOW FIXED
I have two NC systems setup. One is production for a client and the other one is my test bed on a VM. In both of them the config.php file is:
-rw-r----- 1 www-data www-data 1370 Jan 12 17:21 config.php
I run maintence with the command:
sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:mode --on
Might try that.
EDIT: --define is for caching with APC. If you do not have it then just omit the --define statement.
1 Like
ah! thanks i’ll give that a go later today when i get back, many thanks for your help!
I guess coffee412 is right. Sounds good to run the occ commands in the usercontext of www-data and not as root like you tried before.
2 Likes