Failed to update to nextcloud 12.0.1 through Nextcloud updater

So using the next cloud admin login I tried to change to nextcloud 12.1 from 12.
The first error I encountered was assets folder in /usr/share/nextcloud which is empty. It had to be deleted for the upgrade to continue.
The next error now is: Delete old files Could not unlink: /usr/share/nextcloud/updater/…/.htaccess
Now when I try to login to nextcloud it just says "update in process"
So I tried restoring /usr/share/nextcloud/config/config.php and /var/lib/nethserver/nextcloud (love the new backup and restore!) however same problem.

My only other choice is to restore root and hope for the best but I’m nervous I’ll loose everything. Any ideas on how to fix this?

As the nextcloud installation comes from an rpm package I’d advice to use the update method provided by the distro (ask/wait for a new package release), and forget about nextcloud’s built-in updater.

I’ve recreated the problem and for me these two methods have worked (not to update nextcloud version but to get back on track).

Method 1:
Check if you still have the backup made by Nextcloud’s built-in updater:

ls -l /var/lib/nethserver/nextcloud/updater-*/backups/

If there’s a backup folder, do:

mysqldump nextcloud > nextcloud-$(date +%F-%T).sql    # optional
mv /usr/share/nextcloud /usr/share/nextcloud.bad
cp -aR /var/lib/nethserver/nextcloud/updater-*/backups/nextcloud-12.0.0.29 /usr/share/nextcloud    # change nextcloud version number accordingly
chown root:apache /usr/share/nextcloud
chmod 0755 /usr/share/nextcloud
sudo -u apache /opt/rh/rh-php56/root/usr/bin/php /usr/share/nextcloud/occ maintenance:mode --off

Method 2:

mysqldump nextcloud > nextcloud-$(date +%F-%T).sql    # optional
cp -aR /usr/share/nextcloud /usr/share/nextcloud.bad  # optional

Restore nextcloud’s config.php file form a backup (if no backup present, edit /usr/share/nextcloud/config/config.php deleting the lines referring to maintenance and updater secret)

yum -y remove nextcloud
yum install nethserver-nextcloud

If all is good, you can get rid of:

rm nextcloud-*.sql
rm -r /usr/share/nextcloud.bad/
3 Likes

I used method 2 as it seemed like less typing. Worked like a champ, I am back up and running. Thank you so much!

Edit: for the final rm command you might want to use rm -rf /usr/share/nextcloud.bad/ unless you really like typing the letter y.

@dnutan great answer.
I don’t want to miss this advice! How should we save it? Wiki? FAQ here?

Wiki.

1 Like

Nextcloud 12.0.2: ready for testing

1 Like

@dnutan can you open a new page? It will be always useful even if after 12.0.2 update!

Thanks @giacomo! @quality_team can you lend a hand? testing created!

@happnatious1 it is time to help us :slight_smile:
Do you wanna become a Quality Team Rookie? @des ?

1 Like

Method 2 is enough, or do you want both?

EDIT: howto:nextcloud [NethServer Wiki]

Thanks! Wiki is enough for me

enough for me as well, but I was asking about which of the proposed solutions :slight_smile:

The method 2 looks cleaner

Agree wth @alefattorini.
Just thinking, doesn’t the NS version of Nextcloud include the occ script / command, could you not just use a command like ‘occ update’ or ‘occ upgrade’ to achive similar resaults?

Don’t forget when i used the -r I had to confirm every file deletion and there are a lot of them.

As far as the quality team is concerned I’d be happy to help in any way I can. Nethserver makes a terrific server for my small business.

On my tests I used -rf to force deletion without confirmation, but ommitted it in the given instructions as it’s dangerous if there’s a misstype in the path.

Yes, occ is available, but I’m not aware of how to use it once nextcloud has been partially updated.

I have used occ on a failed update succesfully (NC version 11.0.4) and have recently installed / updated NC on my Banana PI / Debian project (originally installed NC v12.0.1, then upgraded it to v12.0.2).

Note: I needed to change file / directory permissions to achive the upgrade to 12.0.2 using the following commands:

cd /var/www/ (or the directory that the NC installation resides within)
chown root:www-data ./nextcloud -R
chmod g+w ./nextcloud -R