Command "maintenance:install" is not defined

I followed the documentation down to the letter (using vm installation script) to install Nextcloud but when it comes to finalize the installation (using nextcloud wizard or occ command line) I get stuck :

sudo -u www-data php /var/www/nextcloud/occ maintenance:install    
--database "mysql"    --database-name "owncloud"     --database-user "root"    
--database-pass "password"    --admin-user "admin"    --admin-pass "password"

                                                 
  Command "maintenance:install" is not defined.  
                                                 
  Did you mean one of these?                     
      app:install                                
      maintenance:data-fingerprint               
      maintenance:mimetype:update-db             
      maintenance:mimetype:update-js             
      maintenance:mode                           
      maintenance:repair                         
      maintenance:theme:update                   
      maintenance:update:htaccess 

app:install does not seem to have what is needed.

trying to use the wizard, i get greeted with this message :

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

cat /var/log/apache2/error.log :

[Thu Sep 26 16:50:52.489768 2019] [mpm_prefork:notice] [pid 8171] AH00171: Graceful restart requested, doing restart
[Thu Sep 26 16:50:52.784706 2019] [http2:warn] [pid 8171] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Thu Sep 26 16:50:52.784740 2019] [http2:warn] [pid 8171] AH02951: mod_ssl does not seem to be enabled
[Thu Sep 26 16:50:52.921460 2019] [mpm_prefork:notice] [pid 8171] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Thu Sep 26 16:50:52.921531 2019] [core:notice] [pid 8171] AH00094: Command line: '/usr/sbin/apache2'

maybe useful nextcloud/config/config.php :

<?php
$CONFIG = array (
  'passwordsalt' => 'hiding it just in case',
  'secret' => 'hiding it just in case',
  'trusted_domains' => 
  array (
    0 => 'localhost',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '16.0.4.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncadmin',
  'dbpassword' => 'hiding it just in case',
  'installed' => true,
  'instanceid' => 'ocnzzmrxsvnn',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => '1800',
  'log_rotate_size' => '10485760',
  'trashbin_retention_obligation' => 'auto, 180',
  'versions_retention_obligation' => 'auto, 365',
  'simpleSignUpLink.shown' => 'false',

  'memcache.local' => '\OC\Memcache\APCu',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => 'hiding it just in case',
  ),
);
#cat /etc/apache2/sites-enabled/nextcloud.conf 
Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud

</Directory>

I spent quite some time on linux but I’m still a newbie, I know close to nothing about php and apache.

some additional details

  • I am running a “home server” on Ubuntu 18.04 freshly installed.
  • I had to edit nextcloud_install_production.sh to stop package checking/checking if it was a clean vm since i’m not running a vm.
  • nextcloud-startup-script.sh could not be run because it brought down my network interface and wouldn’t bring it back up, thus conducting tests on a non-working network connection. I couldn’t find the responsible code part.

Edit

I edited nextcloud-startup-script.sh so that it could be run to the end. Lots of things have been installed, including DBMS. I think it’s a step forward but eventually I still get the server internal error.
I’m starting to think it’s a configuration problem with apache2 configuration but I can’t figure it out.

since the config.php is populated i don’t think you have to run occ maintenance:install again.

i’m not sure but in my config.php this lines

all have double \\

  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',

anything in the nextcloud.log?

Thanks for your answer, but I found a workaround eventually. My problem was that nextcloud’s documentation about apache2 webserver configuration was not extensive enough. I had to tinker a lot with apache2 to find errors fix them and so on.

This tutorial https://tutorials.ubuntu.com/tutorial/install-and-configure-apache#4 put me on the right track.

I’ve done a lot of DIYing so there must be a lot of flaws but at least that’s a start !

I don’t know if I should mark my answer as a solution since the problem is still unsolved : I completely had to get off of documentation’s track, avoiding occ and installation wizard to make it work.

The nextcloud/vm setup script runs occ maintenance:install for you. After the script everything is finish. No need to do something else. I guess by repeating some steps from the docs you might have broke the system.

I installed nextcloud the debian way. ran things only once, as I said down to the letter according to the documentation. but then I got the error command not defined.

But like you said vm scripts did the job eventually after some modifications.

I am not sure if this has already been explained and I missed it, but in Nextcloud 17.0.0.9 there is no longer a maintenance:install command line option as described in https://docs.nextcloud.com/server/17/admin_manual/installation/command_line_installation.html. Is this a bug, or was the command removed but the docs not updated? Either way, how do you perform the CLI installation without it now?

The command is there.

Now I see why I was confused. Different commands are available depending on the state of the server. I was running the occ list command after the installation was performed, so maintenance:install was no longer listed. When I run occ list before installing, I indeed see the maintenance:install option.

1 Like