After restore from backup stuck at CAN_INSTALL

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5):
Operating system and version (eg, Ubuntu 20.04): AWS Linux 3 Apache or nginx version _(eg, Apache 2.4.25)_: Apache/2.4.58 (Amazon Linux)PHP version _(eg, 7.4)_:PHP 8.2.9`

The issue you are facing:

Is this the first time you’ve seen this error? Y

Doing a routine update of the contacts app, my instance crashed (required a reboot).
When the server came back up it was stuck in maintenance mode. After waiting an hour, the system was still in maintenance mode.
I attempted to forcefully bring it out with occ maintenance --off.
While this changed the config file, the system still reported in maintenance mode.

I decided to restore from backup.

After restoring, I am now greeted with the CAN_INSTALL screen with the Setup permissions error in the log.


It looks like you are trying to reinstall your Nextcloud. However the file CAN_INSTALL is missing from your config directory. Please create the file CAN_INSTALL in your config folder to continue.

The output of your Nextcloud log in Admin > Logging:


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


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


{“reqId”:“ZXon5gWFV1ujwPvOUrptTgAAANI”,“level”:3,“time”:“2023-12-13T21:53:42+00:00”,“remoteAddr”:““,“user”:”–“,“app”:“PHP”,“method”:“PROPFIND”,“url”:”/index.php",“message”:"file_put_contents(/-data/.htaccess): Failed to open stream: Permission denied at //nextcloud/lib/private/Setup.php#607",“userAgent”:“–”,“version”:“”,“data”:{“app”:“PHP”}}
”,“user”:“–”,“app”:“PHP”,“method”:“GET”,“url”:“/data/htaccesstest.txt”,“message”:“file_put_contents(/-data/.htaccess): Failed to open stream: Permission denied at //nextcloud/lib/private/Setup.php#607”,“userAgent”:“Nextcloud Server Crawler”,“version”:“”,“data”:{“app”:“PHP”}}


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.


After a restore you need to fix the permissions.

I hope that is just linked with the permission problem. If that persist, be careful because it does not find the configuration and/or data and want to do a new install.

That is strange, an app update can break things so Nextcloud does not work. In such a case, check the logfiles first for errors, perhaps it is something obvious you can easily fix. If not, you can try to disable the app (with occ command) or worst case delete the app from the apps/ folder. However, it shouldn’t crash the whole server.

Thanks. I fixed the permission issue and I continue to receive the CAN_INSTALL message but nothing is being logged anymore.

Regarding the system crashing, I don’t believe that was due to nextcloud, but a server issue (poor timing).

I’m uncertain on where to dig into further.

you have a config.php in the /config folder?

And in the data folder, is there a .ocdata file (it is an empty file, that is normal)?

Thank you. I have them both

[root@srv]# ls -l nextcloud/config/config.php
-rw-r-----. 1 apache apache 1500 Dec 14 15:11 nextcloud/config/config.php
[root@srv]# ls -l owncloud-data/.ocdata
-rw-r–r–. 1 apache apache 0 Nov 24 21:52 owncloud-data/.ocdata
[root@srv]# cat owncloud-data/.ocdata