How to re-install an unrecoverable install while keeping all files and users?

So, it looks like I’ve messed up my install beyond repair (see Can't access "Apps" and "Settings->System").

My objective is to reinstall with a flawless transition from the user perspective. So everything from user options, to active shares and links should be migrated.
But it still needs to be a re-install from 0, because the server has bugs that make it un-updatable and disables access to apps.

Is that possible ? If there’s something in the docs about this I’d gladly follow it, but I couldn’t find something that matched my situation.

First have you tried disabling all apps?

2nd.

chown -R www-data:www-data nextcloud
find nextcloud/ -type d -exec chmod 750 {} \;
find nextcloud/ -type f -exec chmod 640 {} \;

Might not work as suspected where it may exit before completion as it may run in max input.
and might not chmod all underlaying directories/files

try

sudo find nextcloud/ -type d -print0 | sudo xargs -0 chmod 0750
sudo find nextcloud/ -type f -print0 | sudo xargs -0 chmod 0640

else

Depending on your actual version.

seen in your other post

Nextcloud version : 22.2.8

This all happened after a failed upgrade from 20 to 21. I continued using it with this bug, because it doesn’t prevent normal usage.

assumption is a great EVIL.
but lets assume you run NC v22 now
What should work is create a backup of everything. https://docs.nextcloud.com/server/22/admin_manual/maintenance/index.html

move current installation to nextcloud_old
create a fresh install NC v22 to /var/www/nextcloud
restore DATABASE ( not necessary )
restore USERDATA ( only when reside in the same directory as installation Not necessary in your case)
restore config.php

again next command is not necessary as you only refresh the installation and not touch the USERDATA or DATABASE

sudo -u www-data php [NCPATH]/occ maintenance:data-fingerprint

https://docs.nextcloud.com/server/22/admin_manual/configuration_server/occ_command.html#maintenance-commands

Login and reinstall apps or install trough occ.

1 Like

Basically migration one installation to another consists of the following steps:

https://docs.nextcloud.com/server/stable/admin_manual/maintenance/migrating.html

it depends where you messed you original install if the problem will migrate as well. give it a try… but there is no way to migrate “everything” until you migrate DB and storage…

1 Like

Thanks for your inputs.

Unaffortunately nothing worked, here’s what I did:

  • Disabled all disable-able apps, no change
  • Permissions were already good but I tried with the other syntax @Vincent_Stans gave me, no change
  • Decompressed a fresh NC 22, copied config.php from mine, re-applied permissions, aaaand… the error actually “migrated”: no change.

So, most probably, even migrating to a new server would migrate the error too; it must be in the database.

I guess I’ll reinstall everything manually and recreate users with ‘occ’, and I’ll have to notify users they’ll lose their shares. Other than that I think everything should be ok with that method.