Command "files" is not defined

This is what I did

  1. Installed DietPi on a Raspberry Pi 3B.
  2. Used dietpi-software to install the latest version of nextcloud.
  3. added an external HDD with correct permissions i.e. www-data and 0770
  4. Nextcloud is running fine with the drive and data working fine.
  5. Copy all of the files from the old drive to the new drive and re did permissions i.e www-data and 0770

Now the next step was to follow the docs and scan all the files.

Now occ as a command works fine

root@dietpi:/var/www/nextcloud# sudo -u www-data php ./occ
Nextcloud is in maintenance mode - no apps have been loaded

Pai Cloud 20.0.4

  command [options] [arguments]

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --no-warnings     Skip global warnings, show command output only
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  check                                  check dependencies of the server environment
  help                                   Displays help for a command
  list                                   Lists commands
  status                                 show some status information
  upgrade                                run upgrade routines after installation of a new release. The release has to be installed before.
  app:check-code                         check code to be compliant
  app:disable                            disable an app
  app:enable                             enable an app
  app:getpath                            Get an absolute path to the app directory
  app:install                            install an app
  app:list                               List all available apps
  app:remove                             remove an app
  app:update                             update an app or all apps
  background:ajax                        Use ajax to run background jobs
  background:cron                        Use cron to run background jobs
  background:webcron                     Use webcron to run background jobs
  broadcast:test                         test the SSE broadcaster
  config:app:delete                      Delete an app config value
  config:app:get                         Get an app config value
  config:app:set                         Set an app config value
  config:import                          Import a list of configs
  config:list                            List all configs
  config:system:delete                   Delete a system config value
  config:system:get                      Get a system config value
  config:system:set                      Set a system config value
  db:add-missing-columns                 Add missing optional columns to the database tables
  db:add-missing-indices                 Add missing indices to the database tables
  db:add-missing-primary-keys            Add missing primary keys to the database tables
  db:convert-filecache-bigint            Convert the ID columns of the filecache to BigInt
  db:convert-mysql-charset               Convert charset of MySQL/MariaDB to use utf8mb4
  db:convert-type                        Convert the Nextcloud database to the newly configured one
  encryption:change-key-storage-root     Change key storage root
  encryption:decrypt-all                 Disable server-side encryption and decrypt all files
  encryption:disable                     Disable encryption
  encryption:enable                      Enable encryption
  encryption:encrypt-all                 Encrypt all files for all users
  encryption:list-modules                List all available encryption modules
  encryption:migrate-key-storage-format  Migrate the format of the keystorage to a newer format
  encryption:set-default-module          Set the encryption default module
  encryption:show-key-storage-root       Show current key storage root
  encryption:status                      Lists the current status of encryption
  group:add                              Add a group
  group:adduser                          add a user to a group
  group:delete                           Remove a group
  group:list                             list configured groups
  group:removeuser                       remove a user from a group
  integrity:check-app                    Check integrity of an app using a signature.
  integrity:check-core                   Check integrity of core code using a signature.
  integrity:sign-app                     Signs an app using a private key.
  integrity:sign-core                    Sign core using a private key.
  l10n:createjs                          Create javascript translation files for a given app
  log:file                               manipulate logging backend
  log:manage                             manage logging configuration
  maintenance:data-fingerprint           update the systems data-fingerprint after a backup is restored
  maintenance:mimetype:update-db         Update database mimetypes and update filecache
  maintenance:mimetype:update-js         Update mimetypelist.js
  maintenance:mode                       set maintenance mode
  maintenance:repair                     repair this installation
  maintenance:theme:update               Apply custom theme changes
  maintenance:update:htaccess            Updates the .htaccess file
  migrations:execute                     Execute a single migration version manually.
  migrations:migrate                     Execute a migration to a specified version or the latest available version.
  migrations:status                      View the status of a set of migrations.
  preview:repair                         distributes the existing previews into subfolders
  security:bruteforce:reset              resets bruteforce attemps for given IP address
  security:certificates                  list trusted certificates
  security:certificates:import           import trusted certificate
  security:certificates:remove           remove trusted certificate
  twofactorauth:cleanup                  Clean up the two-factor user-provider association of an uninstalled/removed provider
  twofactorauth:disable                  Disable two-factor authentication for a user
  twofactorauth:enable                   Enable two-factor authentication for a user
  twofactorauth:enforce                  Enabled/disable enforced two-factor authentication
  twofactorauth:state                    Get the two-factor authentication (2FA) state of a user
  user:add                               adds a user
  user:delete                            deletes the specified user
  user:disable                           disables the specified user
  user:enable                            enables the specified user
  user:info                              show user info
  user:lastseen                          shows when the user was logged in last time
  user:list                              list configured users
  user:report                            shows how many users have access
  user:resetpassword                     Resets the password of the named user
  user:setting                           Read and modify user settings

What I want to do is scan all my files but I get

root@dietpi:/var/www/nextcloud# sudo -u www-data php ./occ files
Nextcloud is in maintenance mode - no apps have been loaded

  Command "files" is not defined.  

I don’t know what to do. I was thinking of trying maintenance:repair but don’t know if that’s the right way to go to fix this.
Here is my PHP version

PHP 7.3.19-1~deb10u1 (cli) (built: Jul  5 2020 06:46:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.19, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.19-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

Here is my MySQL version
mariadb Ver 15.1 Distrib 10.3.27-MariaDB, for debian-linux-gnueabihf (armv8l) using readline 5.2

I hope I have given all the information you may need to help me thanks

See the docs at:

Your command is not complete.

Bildschirmfoto 2020-12-30 um 17.23.08

The occ command works but not files

root@eietpi:/var/www/nextcloud# sudo -u www-data php ./occ files:scan
Nextcloud is in maintenance mode - no apps have been loaded

  There are no commands defined in the "files" namespace.  


I get the same error if I try cleanup, scan-app-data or even transfer-ownership.
Again what should I do.

Which apps have you installed and enabled? You can list them with occ command as well.

This is what I have enabled

root@dietpi:/var/www/nextcloud# sudo -u www-data php ./occ app:list 
Nextcloud is in maintenance mode - no apps have been loaded

  - accessibility: 1.6.0
  - activity: 2.13.4
  - calendar: 2.1.2
  - carnet: 0.23.7
  - cloud_federation_api: 1.3.0
  - comments: 1.10.0
  - contacts: 3.4.2
  - contactsinteraction: 1.1.0
  - dashboard: 7.0.0
  - dav: 1.16.2
  - event_update_notification: 1.1.0
  - federatedfilesharing: 1.10.2
  - federation: 1.10.1
  - files: 1.15.0
  - files_markdown: 2.3.1
  - files_pdfviewer: 2.0.1
  - files_rightclick: 0.17.0
  - files_sharing: 1.12.1
  - files_trashbin: 1.10.1
  - files_versions: 1.13.0
  - files_videoplayer: 1.9.0
  - firstrunwizard: 2.9.0
  - integration_github: 0.0.14
  - logreader: 2.5.0
  - lookup_server_connector: 1.8.0
  - nextcloud_announcements: 1.9.0
  - notifications: 2.8.0
  - oauth2: 1.8.0
  - password_policy: 1.10.1
  - photos: 1.2.1
  - privacy: 1.4.0
  - provisioning_api: 1.10.0
  - recommendations: 0.8.0
  - serverinfo: 1.10.0
  - settings: 1.2.0
  - sharebymail: 1.10.0
  - support: 1.3.0
  - survey_client: 1.8.0
  - systemtags: 1.10.0
  - text: 3.1.0
  - theming: 1.11.0
  - twofactor_backupcodes: 1.9.0
  - updatenotification: 1.10.0
  - user_status: 1.0.1
  - viewer: 1.4.0
  - weather_status: 1.0.0
  - workflowengine: 2.2.0
  - admin_audit
  - encryption
  - files_external
  - user_ldap

I can see if I go to core folder I see no files directory

root@dietpi:/var/www/nextcloud# cd core
root@dietpi:/var/www/nextcloud/core# ls
Application.php  Db            Service  img                   shipped.json    vendor
BackgroundJobs   Exception     ajax     js                    signature.json  webpack.test.js
Command          Middleware    css      l10n                  skeleton
Controller       Migrations    doc      register_command.php  strings.php
Data             Notification  fonts    routes.php            templates

Please see this message.

I put it in maintenance mode, so that I up my files but that didn’t work because I files:scan didn’t exist

Looks like your app folder is at another place. Check your config.php file for the location.

Maybe this is the reason you cannot use occ commands from files namespace.

This my config.php file I don’t think I see any app directory in here

$CONFIG = array (
  'passwordsalt' => 'ge/lX+ftI11lddSG9Be7KZCb2lawe9',
  'secret' => 'SWIRcMw5YpHUgSFWxgfvQ2Qn8jHaKtbeCbHBl94D6a6VofaF',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '*',
  'datadirectory' => '/userData',
  'dbtype' => 'mysql',
  'version' => '',
  'hashingThreads' => 4,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
  'overwrite.cli.url' => 'http://localhost/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_rodude123',
  'dbpassword' => '98zc0sIeReMRIpisw4S9Ir2DDgne5X',
  'installed' => true,
  'instanceid' => 'ocobedp3zjam',
  'maintenance' => true,

That’s not the reason why, I re-downloaded manually from nextcloud and moved it over and now it works

1 Like

Sorry, apps should be under


What your are expecting to see there?

When I went to apps folder or core folder I was expecting to see the files directory but it wasn’t there so I re downloaded it manually.

so, the problem solves if you do not put the cloud unter maintenance…
you had to scan for new files if your cloud is in normal mode…
i dont know why… but i tested it:
Nextcloud in maintenance mode: i get this error: There are no commands defined in the “files” namespace.
Nextcloud not in maintenance mode: no error and it scans all data correctly.

1 Like