Failed to update to nextcloud 12.0.1 through Nextcloud updater


(Bill ) #1

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?

(Marc) #2

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- /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/

(Bill ) #3

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.

(Alessio Fattorini) #4

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

(Marc) #5


(Giacomo Sanchietti) #6

Nextcloud 12.0.2: ready for testing

(Alessio Fattorini) #7

@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 ?

(Marc) #8

Method 2 is enough, or do you want both?


(Alessio Fattorini) #9

Thanks! Wiki is enough for me

(Marc) #10

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

(Alessio Fattorini) #11

The method 2 looks cleaner

(Mark Edworthy) #12

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?

(Bill ) #13

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.

(Marc) #14

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.

(Marc) #15

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

(Mark Edworthy) #16

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