Unable to execute `occ` command

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 27.1.4-fpm-alpine
Operating system and version: fpm-alpine
Apache or nginx version: nginx 1.25.3 (alpine)
PHP version: 8.2.13

The issue you are facing:

Getting an exception when trying to execute any occ commands on a new deployment of Nextcloud 27, the output is:

> docker exec -it -u www-data nextcloud-app sh
> /var/www/html $ php occ -h
> An unhandled exception has been thrown:
> Symfony\Component\Console\Exception\LogicException: The command defined in "OCA\Support\Command\SystemReport" cannot have an empty name. in /var/www/html/3rdparty/symfony/console/Application.php:541
> Stack trace:
> #0 /var/www/html/lib/private/Console/Application.php(230): Symfony\Component\Console\Application->add(Object(OCA\Support\Command\SystemReport))
> #1 /var/www/html/lib/private/Console/Application.php(131): OC\Console\Application->loadCommandsFromInfoXml(Array)
> #2 /var/www/html/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #3 /var/www/html/occ(11): require_once('/var/www/html/c...')
> #4 (main)

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

Steps to replicate it:

  1. Follow directions here (https://github.com/nextcloud/docker/blob/master/.examples/README.md) to deploy a full fpm-alpine NC + nginx proxy using the docker compose approach.
  2. Docker into the app container using docker exec -it -u www-data nextcloud-app sh
  3. Execute the command php occ -h

The output of your Nextcloud log in Admin > Logging:

No logs

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nextcloud-redis',
    'password' => '',
    'port' => ===== REDACTED =====,
  ),
  'instanceid' => '===== REDACTED =====',
  'passwordsalt' => '===== REDACTED =====',
  'secret' => '===== REDACTED =====',
  'trusted_domains' => 
  array (
    0 => '===== REDACTED =====',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '27.1.4.1',
  'overwrite.cli.url' => '===== REDACTED =====',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '===== REDACTED =====',
  'dbpassword' => '===== REDACTED =====',
  'installed' => true,
);

Dockerfile for app:

FROM nextcloud:27.1.4-fpm-alpine

RUN set -ex; \
    \
    apk add --no-cache \
        ffmpeg \
        imagemagick \
  procps \
        samba-client \
        supervisor \
#        libreoffice \
    ;

RUN set -ex; \
    \
    apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        imap-dev \
        krb5-dev \
        openssl-dev \
        samba-dev \
        bzip2-dev \
        gmp-dev \
    ; \
    \
    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
    docker-php-ext-install \
        bz2 \
        imap \
        gmp \
    ; \
    pecl install smbclient; \
    docker-php-ext-enable smbclient; \
    \
    runDeps="$( \
        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
            | tr ',' '\n' \
            | sort -u \
            | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
    )"; \
    apk add --virtual .nextcloud-phpext-rundeps $runDeps; \
    apk del .build-deps

RUN mkdir -p \
    /var/log/supervisord \
    /var/run/supervisord \
;

COPY supervisord.conf /etc/supervisord.conf

ENV NEXTCLOUD_UPDATE=1

CMD ["/usr/bin/supervisord"]

Dockerfile for web:

FROM nginx:alpine

COPY nginx.conf /etc/nginx/nginx.conf

Docker Compose file:

version: '3.7'

services:
  db:
    container_name: nextcloud-db
    hostname: nextcloud-db
    image: mariadb:10.6
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW      ### --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    restart: always
    volumes:
      - db:/var/lib/mysql:Z
    environment:
      - MYSQL_PASSWORD={{{REDACTED}}}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_DISABLE_UPGRADE_BACKUP=1
      - MYSQL_ROOT_PASSWORD={{{REDACTED}}}
    networks:
      - nextcloud-default

  redis:
    container_name: nextcloud-redis
    hostname: nextcloud-redis
    image: redis:alpine
    restart: always
    networks:
      - nextcloud-default

  app:
    build:
      context: ./app
    container_name: nextcloud-app
    hostname: nextcloud-app
    image: myown/nextcloud:27.1.4-fpm-alpine
    restart: always
    volumes:
      - nextcloud:/var/www/html:z
      - www2:/usr/local/etc/php-fpm.d
    environment:
      - MYSQL_HOST=nextcloud-db
      - REDIS_HOST=nextcloud-redis
      - MYSQL_PASSWORD={{{REDACTED}}}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_DISABLE_UPGRADE_BACKUP=1
    depends_on:
      - db
      - redis
    networks:
      - nextcloud-default

  web:
    build: ./web
    container_name: nextcloud-web
    hostname: nextcloud-web
    image: myown/nginx:fpm-alpine-nextcloud
    restart: always
    volumes:
      - nextcloud:/var/www/html:z,ro
    environment:
      - VIRTUAL_HOST={{{REDACTED}}}
      - LETSENCRYPT_HOST={{{REDACTED}}}
      - LETSENCRYPT_EMAIL={{{REDACTED}}}
    depends_on:
      - app
    networks:
      - nextcloud-default
      - proxy-default

  cron:
    build:
      context: ./app
    container_name: nextcloud-cron
    hostname: nextcloud-cron
    image: myown/nextcloud:27.1.4-fpm-alpine
    restart: always
    volumes:
      - nextcloud:/var/www/html:z
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis
    networks:
      - nextcloud-default


volumes:
  db:
    name: "nextcloud-db"
    driver_opts:
      type: none
      device: {{{REDACTED}}}
      o: bind
  nextcloud:
    name: "nextcloud-nextcloud"
    driver_opts:
      type: none
      device: {{{REDACTED}}}
  www2:
    name: "nextcloud-www2"
    driver_opts:
      type: none
      device: {{{REDACTED}}}
      o: bind

networks:
  cyco-proxy-default:
    name: proxy-default
    external: true
  nextcloud-default:
    name: nextcloud-default

Are you using a Dockerfile from there too or just a Compose file?

It would be helpful if you just post your actual Compose and/or Dockerfile since there are a million examples (and likely some of your own customizations.

1 Like

I updated the original post with my Dockerfiles and compose file. The Docker file are mostly based on https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm-alpine/Dockerfile.

I haven’t looked too closely yet, but:

  • Can you reproduce the behavior without your customized Dockerfile? That would tell you/us where to focus our troubleshooting efforts
  • Have you made any other changes or is this just an initial default installation otherwise? The error is coming from the support app, suggesting something is strange about your environment.

I’m getting a weird docker pull error trying to instantiate a new set of compose containers.

docker pull nextcloud:27.1.4-fpm-alpine
27.1.4-fpm-alpine: Pulling from library/nextcloud
c926b61bad3b: Already exists 
e8e26b626c27: Already exists 
23427f6f19cc: Already exists 
938ee652f0dd: Already exists 
3732066280a1: Already exists 
23dfeb871e9d: Already exists 
71442a0585dd: Already exists 
930182f44a16: Already exists 
100698e2eb12: Already exists 
f1b065e10a03: Already exists 
03a0c3dcbe85: Already exists 
994aac72ac95: Already exists 
f1f6abb16514: Already exists 
ae29e36ec6d4: Already exists 
14c8ba147a3e: Already exists 
b89303186e07: Already exists 
**layers from manifest don't match image configuration**

I’m doing the pull from an Ubuntu 22.04.3 LTS. It’s pulls successfully from my Mac though, not sure if this is a Ubuntu only issue?

That one shows up in the search engines (in general not on this forum) so might want to poke around there a bit.

Also might be worth comparing/checking your Docker Engine version to make sure it’s updated/consistent across the board.

Hi, looks like for some reason, the earlier pull of the official 27.1.4 version of the NC docker image to my local had corrupted layers. I execute a docker compose down -v -rmi --remove-orphan to clean up all local references and cache to the local image with the corrupted layers. Then I was able to successfully pull the 27.1.4 image again, and rebuild my customized image with the --no-cache option. Issue went away after the rebuild. Thanks for all the help and insights.

2 Likes