Occ: Command "upgrade" is not defined

Just tried to upgrade from 10.0.0 to 10.0.1. This is my procedure:

root@himbeere /var/www/nextcloud # sudo -u www-data php occ maintenance:mode --on
root@himbeere /var/www/nextcloud # cd ..
root@himbeere /var/www/nextcloud # mv nextcloud nextcloud-10.0.0
root@himbeere /var/www # wget https://download.nextcloud.com/server/releases/nextcloud-10.0.1.zip
root@himbeere /var/www # unzip nextcloud-10.0.1
root@himbeere /var/www # chown -R www-data.www-data nextcloud
root@himbeere /var/www/nextcloud # sudo -u www-data php occ upgrade
Nextcloud is not installed - only a limited number of commands are available
                                                                  
  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "upgrade" is not defined.                               

root@himbeere /var/www/nextcloud # sudo -u www-data php occ status
Nextcloud is not installed - only a limited number of commands are available
  - installed: false
  - version: 9.1.1.5
  - versionstring: 10.0.1
  - edition: 

What can I do?

Best regards,

Franz

There’s no need to manually enable maintenance mode as it does this automatically during the upgrade procedure.

Also, occ should be given executable rights and should be ran like “./occ” and not “occ” as this implies it is a binary inside /usr/bin or /usr/local/bin.

Did you take a backup? There’s no need to download the latest version as the upgrade parameter downloads and backups up your current installation, and applies the update automatically.

All you simply need to do is…

cd /var/www/nextcloud
chmod +x occ
sudo -u www-data ./occ upgrade

Hope this helps.

Thank you for your reply.

Of course, you can make occ executable and run it this way. Calling it via php occ is possible, too, and does not need an executable file.
sudo -u www-data php occ maintenance:mode -on
and
sudo -u www-data php occ upgrade
worked in previous versions fine.
Of course, I took a backup. But that does no difference for upgrading and the failure.
And, finally, making occ executable and run it via ./occ returns the same message.

There’s no need to download the latest version as the upgrade parameter
downloads and backups up your current installation, and applies the
update automatically.

No. Doing it, returns:

root@himbeere /var/www/nextcloud # sudo -u www-data php occ upgrade
Nextcloud is already latest version

When I migrated from ownCloud, I read online and it said to delete everything in the folder EXCEPT the data & config folder. The reason why it thinks it is not installed is because it can’t connect to the database as the config file is not setup and only the sample exists. The best thing to do is to copy those two folders into the nextcloud directory replacing the existing ones from the unzipped version.

Then try to run the upgrade.

So, in a nutshell…

cd /var/www/nextcloud
rm -R data; rm -R config
cp -R …/nextcloud-10.0.0/data ./; cp -R …/nextcloud-10.0.0/config ./
sudo -u www-data php occ upgrade

This will basically delete the config and data folders inside the current nextcloud directory, and then copies those two folders from your backup into the nextcloud folder so it’s setup. Running the upgrade command should then work as it will detect a current installation and it should update.

Thank you, Crasha, you got it …
I copied the config directory to the new nextcloud folder (the data directory is not in /var/www) and startet occ upgrade. It worked as usual. Copying the theme, enabling the apps, was all I had to do.

Thank you, again,

Franz

You’re welcome! Glad it worked :slight_smile:

Current official documentation explicitly states putting it into maintenance mode with the OCC command.

See https://docs.nextcloud.com/server/11/admin_manual/maintenance/manual_upgrade.html for a complete “nutshell” update manual.