nextcloud / updater

:arrows_counterclockwise: The updater app to keep your Nextcloud up-to-date
GNU Affero General Public License v3.0
45 stars 33 forks source link

Permission denied for 'occ' #260

Open solracsf opened 4 years ago

solracsf commented 4 years ago

When executing sudo -u www-data php updater.phar, process can't be finished correctly because of permissions.

sudo -u www-data php -f updater.phar
Nextcloud Updater - version: v16.0.3-3-ga0c2b25 dirty

Current version is 17.0.1.

Update to Nextcloud 17.0.2 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-17.0.2.zip
Open changelog ↗

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] Y
sh: 1: ./occ: Permission denied

Keep maintenance mode active? [y/N] N
sh: 1: ./occ: Permission denied

Maintenance mode is disabled

Answering no to the first and executing sudo -u www-data php occ upgrade followed by sudo -u www-data php occ maintenance:mode --off is fine, but it should be executed inside the first command.

Everything goes fine if sudo -u www-data php ./updater/updater.phar

SKJoy commented 11 months ago

Do you mean only the php ./updater/updater.phar is good enough?

joshtrichards commented 5 months ago

We should be checking the return values from both the system() calls and using them to report the proper status:

https://github.com/nextcloud/updater/blob/4af30bdab591f6d7e9ad51b36d1b6525e5c1bf86/lib/UpdateCommand.php#L308-L341

Right now we capture them but don't use them to detect failure. :facepalm: