[Fixed, no idea why] Failed upgrading installation on alpine linux, occ won't upgrade, showing "Nextcloud is not installed - only a limited number of commands are available"

Update: Redo the upgrade process resulted in successful upgrade, still have no idea what caused the error in the first place.

Nextcloud version (eg, 20.0.5): 24.0.9
Operating system and version (eg, Ubuntu 20.04): Alpine Linux v3.17
Apache or nginx version (eg, Apache 2.4.25): Apache2 2.4.55
PHP version (eg, 7.4): 8.1

The issue you are facing:
I had a nextcloud 24.0.9 installation on alpine linux v3.17, and I intend to do a manual upgrade to 25.0.4. After following the steps in the admin manual, I got stuck on step 14:
launch the upgrade from the command line using occ

I tried upgrade after I substitute users to apache, and do php occ upgrade and was greeted with the following message:

Nextcloud is not installed - only a limited number of commands are available
Command "upgrade" is not defined.  

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Install an older version of nextcloud on alpine linux.
  2. Follow the guide to manually upgrade nextcloud server

The output of your Nextcloud log in Admin > Logging:
I cannot access the panel now.

The output of your config.php file in /path/to/nextcloud (This is the config.php from my older installation):

<?php
$CONFIG = array (
  'instanceid' => 'ocinjis8bwr3',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '192.168.122.182',
  ),
  'datadirectory' => '/var/ncdata',
  'dbtype' => 'mysql',
  'version' => '24.0.9.2',
  'overwrite.cli.url' => 'http://192.168.122.182',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'installed' => true,
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.locking' => '\OC\Memcache\Redis',
  'memcache.local' => '\OC\Memcache\Redis',
  'redis' => [
          'host'        => '/run/redis/redis.sock',
          'port'        => 0,
  ],
  'maintenance_window_start' => 16,
  'maintenance' => false,
);

The output of your Apache log in /var/log/.
Nothing useful, but if you still want to see:

nextcloud.log in new installation folder /nextcloud/data/nextcloud.log

Hi @moresoka

This line in your Apache log file could be a clue:

Double check, if the new config.php is realy exactly the same.

just a suspicion

Happy hacking

Oh that’s when I mistakenly put

"maintenance" => true,

before the config array (and the quotation mark is wrong) and Apache won’t start up. I fixed that before encountered with this error.

That’s a documentation error in
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/backup.html#maintenance-mode