When restarting pod error: "The username is already being used"
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: https://github.com/nextcloud/helm/blob/9ce989efe1c2770544f19d2a370fb587a42cefc5/charts/nextcloud/values.yaml#L63-L66

and when setting replicaCount: => 2, you get 404 errors when load balancer changes pod...
Having exactly the same issue.
Also using existingSecret does not fix it.
@wagnst Drop database and create again, or you can delete database, pvc, and helm chart and then reinstall the db helm chart.
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.
@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!
Confirm whether it is enabled pvc, config e.g.
persistence: enabled: trueotherwise 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
@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
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.
Here's where our probes are in the values.yaml: https://github.com/nextcloud/helm/blob/bf6cc4a9df0b3bffd3915dc940ddbec71976429e/charts/nextcloud/values.yaml#L467-L490
here's the persistence docs: https://github.com/nextcloud/helm/tree/main/charts/nextcloud#persistence-configurations
Closing as it's been a bit over a year without reply from original posters. If anyone in this thread is still having issues after running helm uninstall YOUR_RELEASE_NAME_HERE and deleting your database + PVCs, then trying again with persistence enabled and probes enabled, then please open a new issue with the new issue template (including your values.yaml).