Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When restarting pod error: "The username is already being used" #52

Open
ivantorrellas opened this issue Dec 15, 2020 · 8 comments
Open

Comments

@ivantorrellas
Copy link

ivantorrellas commented Dec 15, 2020

I'm getting this issue when restarting the pod, using any postgresql or mariadb, the new pod always tries to install like is a fresh install.

I'm passing username and password in the values file:

nextcloud:
host: nextcloud.kube.home
username: admin
password: changeme

image

@ivantorrellas
Copy link
Author

and when setting replicaCount: => 2, you get 404 errors when load balancer changes pod...

@wagnst
Copy link

wagnst commented Mar 13, 2021

Having exactly the same issue.
Also using existingSecret does not fix it.

@vasanthaganeshk
Copy link

@wagnst Drop database and create again, or you can delete database pvc and helm chart and reinstall the db helm chart.

@iutx
Copy link

iutx commented Apr 20, 2022

Confirm whether it is enabled pvc, config e.g.

persistence:
  enabled: true

otherwise you will not be able to record whether you have installed it.

@jessebot
Copy link
Collaborator

@iutx has a good suggestion :) I'm still happy to help a bit though, if anyone is still having issues in this thread. If you would like further asisstance, could you please post your values.yaml (please remove sensitive data first) and the version of helm chart you are using? Thank you!

@luizjr
Copy link

luizjr commented Jan 31, 2023

Confirm whether it is enabled pvc, config e.g.

persistence:
  enabled: true

otherwise you will not be able to record whether you have installed it.

When I set persistent to true it gives an internal error, when I disable it it keeps trying to reinstall every time there is an update or restart the container

@jessebot
Copy link
Collaborator

@luizjr could you please give us a bit more info:

  • the rest of your values.yaml (after removing any sensitive info)
  • the error you're seeing and where you see it
  • Any logs you have would also be helpful in narrowing the issue

@zaro
Copy link

zaro commented Jun 18, 2023

UPDATE: the issue was caused by database being already initialised. I was testing with mariadb-operator, and was deleting the whole database before nextcloud install , but didn't notice that the same PVC for mariadb is being reused , so the data was actually not being deleted.

@jessebot I am having the same issue. Here are the chart values :

## Official nextcloud image version
## ref: https://hub.docker.com/r/library/nextcloud/tags/
ingress:
  enabled: true
  # className: nginx
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 4G
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/server-snippet: |-
      server_tokens off;
      proxy_hide_header X-Powered-By;
      rewrite ^/.well-known/webfinger /index.php/.well-known/webfinger last;
      rewrite ^/.well-known/nodeinfo /index.php/.well-known/nodeinfo last;
      rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
      rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json;
      location = /.well-known/carddav {
        return 301 $scheme://$host/remote.php/dav;
      }
      location = /.well-known/caldav {
        return 301 $scheme://$host/remote.php/dav;
      }
      location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
      }
      location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
      }
      location ~ ^/(?:autotest|occ|issue|indie|db_|console) {
        deny all;
      }
  tls:
    - secretName: nextcloud-tls
      hosts:
        - nc.mydomain.net
  labels: {}
  path: /
  pathType: Prefix


nextcloud:
  host: nc.mydomain.net
  username: admin
  password: mariadb
  mail:
    enabled: false
    fromAddress: user
    domain: domain.com
    smtp:
      host: domain.com
      secure: ssl
      port: 465
      authtype: LOGIN
      name: user
      password: pass
  # For example, to use S3 as primary storage
  # ref: https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3
  #
  configs:
    s3.config.php: |-
      <?php
      $CONFIG = array (
        'objectstore' => array(
          'class' => '\\OC\\Files\\ObjectStore\\S3',
          'arguments' => array(
            'bucket'     => 'nc-test',
            'autocreate' => true,
            'key'        => 'xxx',
            'secret'     => 'xxxx',
            'region'     => 'optional',
            'hostname'   => 'xxx',
            'use_ssl'    => true,
            'use_path_style' => true,
          )
        )
      );

persistence:
  enabled: true

internalDatabase:
  enabled: false
  name: nextcloud

##
## External database configuration
##
externalDatabase:
  enabled: true

  ## Supported database engines: mysql or postgresql
  type: mysql

  ## Database host
  host: mariadb.default.svc

  ## Database user
  user: mariadb

  ## Database password
  password: mariadb

  ## Database name
  database: testdb

redis:
  enabled: false
  auth:
    enabled: true
    password: 'changeme'
    # name of an existing secret with Redis® credentials (instead of auth.password), must be created ahead of time
    existingSecret: ""
    # Password key to be retrieved from existing secret
    existingSecretPasswordKey: ""


cronjob:
  enabled: true

## DEBUG
livenessProbe:
  enabled: false

startupProbe:
  enabled: false

chart version is nextcloud-3.5.13 and after install the nextcloud container logs look like this :

Initializing nextcloud 26.0.2.1 ...
New nextcloud instance
Installing with MySQL database
Starting nextcloud installation
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Retrying install...
The username is already being used
Installing of nextcloud failed!

After that the pod restarts, and then apache is starting but when you open NC only this error message is shown :

Error
It looks like you are trying to reinstall your Nextcloud. However the file CAN_INSTALL is missing from your config directory. Please create the file CAN_INSTALL in your config folder to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants