Error updating to 11.0.3

Hello, I wanted to update from 11.0.2 to 11.0.3 and got an error, which you can see in the screenshot.
Although the Anti-Virus App is deactivated…

You need to set write permissions for the updater to be able to make the changes. Don’t forget to reset back to strong permissions after doing the upgrade!!!

https://docs.nextcloud.com/server/11/admin_manual/maintenance/update.html#setting-permissions-for-updating

@linucksrox thank you for your fast reply.
I did what you said, but there are still 2 Errors (see the Screenshot).

Dear Nextcloud Team, would you please update your Hardening Script in your Admin Manual?
I am exectly using this script and it seems that I run regulary in update problems. Of course the current update failed here, too.

This is your script. Why does it not work? Would you please update this first? Would make everybody’s life much more easier, what do you think?

Ah… I have to “un-harden” my nextcloud installation first before updating. After Update I have to harden it again. Sorry for my rude subtone…

but for me the “un-harden-script” didnt work, how you can see in my 2.screenshot

ja same here… this permament update failures make me sad…

Bummer, I don’t speak or read German, and pasting this error as an image makes it much more time consuming for me to translate. And I’m not totally sure how to type some of those characters :slight_smile:

Anyway, maybe this will help someone. I use the following two scripts to make my life easier, and I didn’t happen to run into any problems during any of the last several updates, including this one.

Set Strong Permissions:

#!/bin/bash
ocpath='/var/www/nextcloud'
datapath='/var/www/nextcloud/data'
htuser='www-data'
htgroup='www-data'
rootuser='root'

#printf "Creating possible missing Directories\n"
#mkdir -p $ocpath/updater

printf "chmod Files and Directories\n"
find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750

printf "chown Directories\n"
chown -R ${rootuser}:${htgroup} ${ocpath}/
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${datapath}
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
chown -R ${htuser}:${htgroup} ${ocpath}/updater/

chmod +x ${ocpath}/occ

printf "chmod/chown .htaccess\n"
if [ -f ${ocpath}/.htaccess ]
 then
  chmod 0644 ${ocpath}/.htaccess
  chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
fi
if [ -f ${datapath}/.htaccess ]
 then
  chmod 0644 ${datapath}/.htaccess
  chown ${rootuser}:${htgroup} ${datapath}/.htaccess
fi

Set Updater Permissions:

#!/bin/bash
# Sets permissions of the Nextcloud instance for updating

ocpath='/var/www/nextcloud'
htuser='www-data'
htgroup='www-data'

chown -R ${htuser}:${htgroup} ${ocpath}

There are files in the updater directory which should not be there. You can either try running the script I just posted (basically you need to recursively set write permissions so the updater can do its thing). Or you can remove everything in the updater directory that should not be there (just don’t delete index.php or updater.phar I think…).

Also if I’m guessing correctly, did that generic internal server error appear after attempting to do the update through the website? In any case, I’ve had success by following these basic steps:

  1. Put the server in maintenance mode
  2. Run the script to set updater permissions
  3. Initiate the update from the admin area (like in the first screenshot posted here)
  4. Leave maintenance mode on
  5. Run the upgrade using occ in the terminal (something like sudo -u www-data php /var/www/nextcloud/occ upgrade)
  6. Run the strong permissions script
  7. Take the site out of maintenance mode

I think using the command in step 5 will give you more useful information if anything goes wrong.
@jakobssystems I think you should attempt step 5 and see what happens.

I’ve exactly run those scripts and it still doesn’t work! Now I am trying to find out what happend…
And Step 5 is doing nothing: It just says: “Nextcloud is already latest version”

Ok, since it says it’s already the latest version, let’s assume the upgrade worked. Can you take the site out of maintenance mode and access it (step 6-7)? Where are you stuck now?
If you can log in, maybe you can access the error logs and find out what the error actually was.

I did what you said:
At 3. the same ploblem like before occurs.
Then 5. and I got the following answer:
“Nextcloud is in maintenance mode - no apps have been loaded
Nextcloud is in maintenance mode
Maybe an upgrade is already in process. Please check the logfile (data/nextcloud.log). If you want to re-run the upgrade procedure, remove the “maintenance mode” from config.php and call this script again.”

Can you post the tail end of your log? And did you happen to try turning maintenance mode off and running the upgrade again?

Which log do you mean? I tried updating after turning maintenance mode off -> same issue…

data/nextcloud.log

nextcloud/data/nextcloud.log:
{“reqId”:“5o8Kr+l0FpTx75KHhnYe”,“remoteAddr”:“192.168.1.129”,“app”:“PHP”,“message”:“mkdir(): Permission denied at /var/www/nextcloud/lib/private/Setup.php#289”,“level”:3,“time”:“2017-01-29T21:28:38+00:00”,“method”:“POST”,“url”:"/nextcloud/index.php",“user”:"–",“version”:""}
{“reqId”:“RNsvSVemtO78vvIMuHyq”,“remoteAddr”:“192.168.1.129”,“app”:“PHP”,“message”:“mkdir(): Permission denied at /var/www/nextcloud/lib/private/Setup.php#289”,“level”:3,“time”:“2017-01-29T21:39:18+00:00”,“method”:“POST”,“url”:"/nextcloud/index.php",“user”:"–",“version”:""}
{“reqId”:“gt2kPZ4ajc+dNZmDeO2E”,“remoteAddr”:“192.168.1.129”,“app”:“PHP”,“message”:“mkdir(): Permission denied at /var/www/nextcloud/lib/private/Setup.php#289”,“level”:3,“time”:“2017-01-29T21:47:04+00:00”,“method”:“POST”,“url”:"/nextcloud/index.php",“user”:"–",“version”:""}
{“reqId”:“AvDTEeRbySZ0E2pzvAKC”,“remoteAddr”:"::1",“app”:“PHP”,“message”:“mkdir(): Permission denied at /var/www/nextcloud/lib/private/Setup.php#289”,“level”:3,“time”:“2017-01-29T21:48:32+00:00”,“method”:“POST”,“url”:"/nextcloud/index.php",“user”:"–",“version”:""}

Ok, judging by the fact that you ran into permission issues even after running the updater permissions script, I don’t think it ran recursively or it didn’t run with the correct permissions. Either that or occ isn’t running with the correct permissions.

Assuming your web user is www-data,
Set updater permissions:
sudo chown -R www-data:www-data /var/www/nextcloud
If this had run correctly, you should not have run into more permission issues at the beginning.

Run the upgrade:
sudo -u www-data php /var/www/nextcloud/occ upgrade

the last command says “Nextcloud is already latest version”, but I am still on 11.0.2.

How can you tell you’re still on 11.0.2?

logging in as admin and going to settings…