Dbpassword changes on every reboot

I have moved my ncp installation to docker. So far so good. But since then on every reboot the dbpassword is changed. Is that a feature? It makes my backup script break after every reboot, since I have to change the password.

For the docker installation, the database password is supplied via an environment variable. It will always be set to that. Be certain you have correctly supplied the password.
See the docker README file for more information.

Thanks for the hint. But does it also apply to the nextcloudpi docker image? In those docs this is not mentioned.

https://hub.docker.com/r/ownyourbits/nextcloudpi/

I’m not familiar with the nextcloudpi implementation, sorry.

AFAIK auto-resetting-db-password is not a NCP feature.
I’ve always used de -v option in docker to mount a local drive or folder persistently, I have never encountered a reset of any password. It saves all data over reboots. Even when removing and re-creating the container, when using the same Volume.

How did you create your ncp container initially?
Maybe run ncp-report and/or post ncp.log via pastebin service, for someone to see if that reveals the issue.

1 Like

I have mounted a local folder in docker as well.

I moved the installation by backing-up the “normal” ncp installation and then restoring that backup within the docker container.

NextCloudPi diagnostics

NextCloudPi version  v1.38.6
NextCloudPi image    NextCloudPi_docker_01-19-21
distribution         Debian GNU/Linux 10 \n \l
automount            no
USB devices          sda 
datadir              /var/www/nextcloud/data
data in SD           yes
data filesystem      ext2/ext3
data disk usage      935G/2.0T
rootfs usage         935G/2.0T
swapfile             /var/swap
dbdir                /data/database
Nextcloud check      ok
Nextcloud version    20.0.12.1
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        open
port check 443       open
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               3days

Nextcloud configuration

{
    "system": {
        "debug": false,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "5": "nextcloudpi.local",
            "7": "nextcloudpi",
            "8": "nextcloudpi.lan",
            "1": "172.17.0.3",
            "11": "77.1.106.247",
            "20": "nextcloudpi",
            "22": "nextcloudpi"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "20.0.12.1",
        "overwrite.cli.url": "https:\/\/yxc.selfhost.eu\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/data\/nextcloud\/data\/tmp",
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https",
        "maintenance": false,
        "logfile": "\/var\/www\/nextcloud\/data\/nextcloud.log",
        "jpeg_quality": "60",
        "mail_sendmailmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": "2",
        "data-fingerprint": "e013003db00479ea369d931592e40436",
        "theme": "",
        "log_type": "file",
        "has_rebuilt_cache": true,
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\Image",
            "OC\\Preview\\Movie",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MKV",
            "OC\\Preview\\MP4",
            "OC\\Preview\\AVI"
        ],
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": []
    }
}

HTTPd logs

[Fri Sep 10 18:06:44.771865 2021] [ssl:warn] [pid 91:tid 3070021040] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Sep 10 18:06:44.799938 2021] [ssl:warn] [pid 92:tid 3070021040] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Sep 10 18:06:44.805644 2021] [mpm_event:notice] [pid 92:tid 3070021040] AH00489: Apache/2.4.38 (Debian) OpenSSL/1.1.1d configured -- resuming normal operations
[Fri Sep 10 18:06:44.805762 2021] [core:notice] [pid 92:tid 3070021040] AH00094: Command line: '/usr/sbin/apache2'
[Sun Sep 12 06:33:03.047642 2021] [mpm_event:notice] [pid 92:tid 3070021040] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun Sep 12 06:33:03.421061 2021] [ssl:warn] [pid 92:tid 3070021040] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 12 06:33:03.605185 2021] [mpm_event:notice] [pid 92:tid 3070021040] AH00489: Apache/2.4.38 (Debian) OpenSSL/1.1.1d configured -- resuming normal operations
[Sun Sep 12 06:33:03.605245 2021] [core:notice] [pid 92:tid 3070021040] AH00094: Command line: '/usr/sbin/apache2'
[Sun Sep 12 06:33:03.605265 2021] [mpm_event:notice] [pid 92:tid 3070021040] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun Sep 12 06:33:03.628953 2021] [ssl:warn] [pid 92:tid 3070021040] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 12 06:33:03.630506 2021] [mpm_event:notice] [pid 92:tid 3070021040] AH00489: Apache/2.4.38 (Debian) OpenSSL/1.1.1d configured -- resuming normal operations
[Sun Sep 12 06:33:03.630554 2021] [core:notice] [pid 92:tid 3070021040] AH00094: Command line: '/usr/sbin/apache2'

Database logs

2021-09-10 18:06:45 0 [Note] InnoDB: 10.3.22 started; log sequence number 3036484695; transaction id 4304783
2021-09-10 18:06:45 0 [Note] InnoDB: Loading buffer pool(s) from /data/database/ib_buffer_pool
2021-09-10 18:06:45 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-09-10 18:06:45 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-09-10 18:06:45 0 [Note] Reading of all Master_info entries succeeded
2021-09-10 18:06:45 0 [Note] Added new Master_info '' to hash table
2021-09-10 18:06:45 0 [Note] mysqld: ready for connections.
Version: '10.3.22-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 10
2021-09-10 18:06:46 0 [Note] InnoDB: Buffer pool(s) load completed at 210910 18:06:46
2021-09-10 18:06:50 0 [Note] mysqld (initiated by: root[root] @ localhost []): Normal shutdown
2021-09-10 18:06:50 0 [Note] Event Scheduler: Purging the queue. 0 events
2021-09-10 18:06:50 0 [Note] InnoDB: FTS optimize thread exiting.
2021-09-10 18:06:50 0 [Note] InnoDB: Starting shutdown...
2021-09-10 18:06:50 0 [Note] InnoDB: Dumping buffer pool(s) to /data/database/ib_buffer_pool
2021-09-10 18:06:50 0 [Note] InnoDB: Instance 0, restricted to 4095 pages due to innodb_buf_pool_dump_pct=25
2021-09-10 18:06:50 0 [Note] InnoDB: Buffer pool(s) dump completed at 210910 18:06:50
2021-09-10 18:06:52 0 [Note] InnoDB: Shutdown completed; log sequence number 3036484704; transaction id 4304786
2021-09-10 18:06:52 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-09-10 18:06:52 0 [Note] mysqld: Shutdown complete


It seems that it is indeed re-created on every reboot. I migrated the data without migrating ncp or nextcloud themselves. And I still do get a new MySQL passwor after every reboot.

seem to hint in the same direction.