linuxserver / docker-nextcloud

GNU General Public License v3.0
678 stars 128 forks source link

[BUG] Cannot Execute any occ command - "Nextcloud is not installed - only a limited number of commands are available" #362

Closed atvking closed 9 months ago

atvking commented 9 months ago

Is there an existing issue for this?

Current Behavior

I am unable to execute seemingly any occ command and continually get the same errors.

when running sudo -u abc php /app/www/src/occ db:add-missing-indices I get:

Cannot write into "config" directory!
This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
See https://docs.nextcloud.com/server/27/go.php?to=admin-config

Then after running chown -R abc:abc /app/www/src/ (which I seem to have to do after ever restart to get past the error above) and sudo -u abc php /app/www/src/occ db:add-missing-indices again I get:

Nextcloud is not installed - only a limited number of commands are available
There are no commands defined in the "db" namespace.

I'm not sure which exact version this started happening on as I was unaware that "occ db:add-missing-indices" needed to be run with each update until trying to track down the fix for the file scan and preview generation commands I run periodically, which are:

sudo -u abc php /config/www/nextcloud/occ files:scan --path="path/to/files" and sudo -u abc php /config/www/nextcloud/occ preview:generate-all -vvv --path="path/to/files"

In my searching, I learned that the location of occ has changed from /config/www/nextcloud/ to /app/www/src/ (at least I think, otherwise I have no idea where I should be running these from) as I was initially receiving the following error:

"Could not open input file: /config/www/nextcloud/occ"

When I run sudo -u abc php /app/www/src/occ status I receive:

Nextcloud is not installed - only a limited number of commands are available
  - installed: false
  - version: 27.0.2.1
  - versionstring: 27.0.2
  - edition: 
  - maintenance: false
  - needsDbUpgrade: false
  - productname: Nextcloud
  - extendedSupport: false

I did an update from version 24.x to 27.x all at one time (multiple iterative updates, but all in the same sitting), which seemed to go well as I never had booting/access/gui issues and there were no errors that I recall during the update. That was about a month ago and I'm fairly certain I've run some occ commands since then but I'm not 100% sure.

Expected Behavior

occ commands execute as they did before updating to version 27

Steps To Reproduce

  1. In version 27.x
  2. Run sudo -u abc php /app/www/src/occ db:add-missing-indices
  3. Receive error
    Nextcloud is not installed - only a limited number of commands are available
    There are no commands defined in the "db" namespace.

Environment

- OS: Unraid
- How docker service was installed: Included in Unraid

CPU architecture

x86-64

Docker creation

docker run
  -d
  --name='nextcloud'
  --net='proxynet'
  -e TZ="America/New_York"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Tower"
  -e HOST_CONTAINERNAME="nextcloud"
  -e 'PUID'='99'
  -e 'PGID'='100'
  -e 'UMASK'='022'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='https://[IP]:[PORT:443]'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/nextcloud-logo.png'
  -p '1443:443/tcp'
  -v '/mnt/user/nextcloud/':'/data':'rw'
  -v '/mnt/user/photoprism/name1/':'/external storage/name1/photoprism':'rw'
  -v '/mnt/user/photoprism/name2/':'/external storage/name2/photoprism':'rw'
  -v '/mnt/user/movies/':'/external storage/unraid/movies':'rw'
  -v '/mnt/user/tv/':'/external storage/unraid/tv':'rw'
  -v '/mnt/user/syncthing/name2/':'/external storage/name2/syncthing':'rw'
  -v '/mnt/user/syncthing/name1/':'/external storage/name1/syncthing':'rw'
  -v '/mnt/user/appdata/nextcloud':'/config':'rw' 'lscr.io/linuxserver/nextcloud:latest'

Container logs

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    99
User GID:    100
───────────────────────────────────────

using keys found in /config/keys
Initializing nextcloud 27.0.2.1 (this can take a while) ...
Setting permissions
Initializing finished
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│ 2021-10-24 │ 2023-04-13 │ /config/nginx/nginx.conf                                               │
│ 2022-08-20 │ 2023-08-13 │ /config/nginx/ssl.conf                                                 │
│            │ 2023-06-23 │ /config/nginx/site-confs/default.conf                                  │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
[custom-init] No custom files found, skipping...
[ls.io-init] done.
github-actions[bot] commented 9 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

nemchik commented 9 months ago

The command should just be occ db:add-missing-indices

atvking commented 9 months ago

Wow, I swear that was among the first thing's few things I tried with no success (some error message like "Could not open input file: occ") so I quickly moved on to trying other commands. But you are 100% correct and I feel dumb haha! Thanks though!

It also works for my file scan and preview generation commands (which makes sense). In case someone finds this in the future I will note that I now need to escape the spaces in my directories as special characters with a backslash.

i.e.

occ files:scan --path="/user/files/path/to/directory\ with\ spaces"