[SOLVED] Ncadmin database password and ncp update issues

Opening a new thread here as my previous posts have been tagged onto existing (and solved) threads (some in wrong section).

Environ: RasPi 3 B+ With NCP docker-compose install (stable for some months)

NC Config
datadirectory /data/nextcloud/data
dbtype mysql
version 15.0.8.1
overwrite.cli.url https://*redacted/
dbname nextcloud
dbhost localhost
dbport
dbtableprefix oc_
mysql.utf8mb4 1
dbuser ncadmin
dbpassword ****redacted
installed 1
instanceid ocypc7j5jmvr
memcache.local \OC\Memcache\Redis
memcache.locking \OC\Memcache\Redis
redis
host /var/run/redis/redis.sock
port 0
timeout 0
password ****redacted
NCP Info
NextCloudPi version v1.12.7
NextCloudPi image NextCloudPi_docker_11-30-18
distribution Debian GNU/Linux 9 \n \l
automount no
USB devices none
datadir /data/nextcloud/data
data in SD yes
data filesystem ext2/ext3
data disk usage 15G/59G
rootfs usage 15G/59G
swapfile /var/swap
dbdir /data/database
Nextcloud check ok
Nextcloud version 15.0.8.1
HTTPD service up
PHP service up
MariaDB service up
Redis service up
Postfix service up
internet check ok
port check 80 closed
port check 443 closed
IP 172.18.0.2
gateway 172.18.0.1
interface eth0
certificates redacted
NAT loopback no
uptime 21min

Issue: After some erroneous database changes (yeah OK I know…!) (see this post for bg) I keepo finding that NC cannot start due to database access permission problem for the ncadmin user
SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES)
, sure enough checking the configs I see that the NCP side the ncadmin password has changed after restart/reboot.
Manually changing this in the NC config (/data/nextcloud/config/config.php) resolves the issue (as does manually changing the pass in the database, but I keep getting back to the issue of ncadmin password mismatch.

Checking the NCP-provisioning script I can more or less see what is happening and to where, but it’s not clear to me whether this script is run regularly or just at initial first start up after install.

What ideally needs to be done is to reset the ncadmin user permissions back to default but IDK how this is best done tbh. Had a go with ncp-config from the cli but don’t recall seeing any password reset options for the DB user ncadmin…

Currently NC is running but cannot upgrade NCP to 1.13.0 from 1.12.7 log output here:

ncp-log
        # ncp-update
        Downloading updates
        Performing updates
        Cannot load Zend OPcache - it was already loaded
        Config value squareSizes for app previewgenerator set to 32
        Cannot load Zend OPcache - it was already loaded
        Config value widthSizes for app previewgenerator set to 128 256 512
        Cannot load Zend OPcache - it was already loaded
        Config value heightSizes for app previewgenerator set to 128 256
        Cannot load Zend OPcache - it was already loaded
        System config value jpeg_quality set to string 60
        Running unattended-upgrades
        Unattended upgrades active: yes (autoreboot true)
        --2019-06-03 09:41:18--  https://packages.sury.org/php/apt.gpg
        Resolving packages.sury.org (packages.sury.org)... 104.31.94.169, 104.31.95.169, 2606:4700:30::681f:5ea9, ...
        Connecting to packages.sury.org (packages.sury.org)|104.31.94.169|:443... connected.
        HTTP request sent, awaiting response... 200 OK
        Length: 1769 (1.7K) [application/octet-stream]
        Saving to: '/etc/apt/trusted.gpg.d/php.gpg'
        /etc/apt/trusted.gpg.d/php.gp 100%[=================================================>]   1.73K  --.-KB/s    in 0s
        2019-06-03 09:41:19 (6.04 MB/s) - '/etc/apt/trusted.gpg.d/php.gpg' saved [1769/1769]
        Running nc-notify-updates
        Restarting periodic command scheduler: cronStopping periodic command scheduler: cron.
        Starting periodic command scheduler: cron.
        update web notifications enabled
        Installing nc-backup
        Hit:1 http://security.debian.org/debian-security stretch/updates InRelease
        Ign:2 http://deb.debian.org/debian stretch InRelease
        Hit:3 http://deb.debian.org/debian stretch-updates InRelease
        Hit:4 http://deb.debian.org/debian stretch Release 
        Hit:5 https://packages.sury.org/php stretch InRelease
        Reading package lists... Done
        Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        pigz is already the newest version (2.3.4-1).
        0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
        Installing nc-restore
        Hit:1 http://security.debian.org/debian-security stretch/updates InRelease
        Ign:2 http://deb.debian.org/debian stretch InRelease
        Hit:3 http://deb.debian.org/debian stretch-updates InRelease
        Hit:4 http://deb.debian.org/debian stretch Release
        Hit:5 https://packages.sury.org/php stretch InRelease
        Reading package lists... Done
        Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        file is already the newest version (1:5.30-1+deb9u2).
        0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
        ./update.sh: line 235: /etc/fail2ban/filter.d/ufwban.conf: No such file or directory

The Zend opcache errors appeared related to this https://github.com/nextcloud/nextcloudpi/issues/416
but deleting the offending line in /etc/php/7.2/… does not resolve the matter…

Also some concerning DB log error messages after each restart:

mysql.log

2019-06-03 9:21:42 1995397936 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer…
2019-06-03 9:21:43 1995397936 [Note] InnoDB: 128 rollback segment(s) are active.
2019-06-03 9:21:43 1995397936 [Note] InnoDB: Waiting for purge to start
2019-06-03 9:21:43 1995397936 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 845850815
2019-06-03 9:21:43 1111487296 [Note] InnoDB: Dumping buffer pool(s) not yet started
2019-06-03 9:21:43 1995397936 [Note] Plugin ‘FEEDBACK’ is disabled.
2019-06-03 9:21:43 1995397936 [Note] Recovering after a crash using tc.log
2019-06-03 9:21:43 1995397936 [Note] Starting crash recovery…
2019-06-03 9:21:43 1995397936 [Note] Crash recovery finished.
2019-06-03 9:21:43 1995397936 [Note] Server socket created on IP: ‘127.0.0.1’.
2019-06-03 9:21:43 1995397936 [ERROR] mysqld: Table ‘./mysql/user’ is marked as crashed and should be repaired
2019-06-03 9:21:43 1995397936 [Warning] Checking table: ‘./mysql/user’
2019-06-03 9:21:43 1995397936 [ERROR] mysql.user: 1 client is using or hasn’t closed the table properly
2019-06-03 9:21:43 1995397936 [ERROR] mysqld: Table ‘./mysql/db’ is marked as crashed and should be repaired
2019-06-03 9:21:43 1995397936 [Warning] Checking table: ‘./mysql/db’
2019-06-03 9:21:43 1995397936 [ERROR] mysql.db: 1 client is using or hasn’t closed the table properly
2019-06-03 9:21:43 1995397936 [Note] mysqld: ready for connections.
Version: ‘10.1.38-MariaDB-0+deb9u1’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 Debian 9.8

Any ideas?

I’ll fix the upgrade problem, thanks for reporting.

Regarding ncp-provisioning it runs at every docker startup.

You can ignore the Zend opcache warning.

Can we get the full docker logs for the container to see what’s going on?

you should be able to upgrade now

Yep upgrades to 1.13.0 ok now (y) thanks!

ncp.log from last upgrade

[ unattended-upgrades ]
Unattended upgrades active: yes (autoreboot true)

[ nc-notify-updates ]
Restarting periodic command scheduler: cronStopping periodic command scheduler: cron.
Starting periodic command scheduler: cron.
update web notifications enabled

[ nc-limits ]
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.

[ nc-limits ]
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.

[ unattended-upgrades ]
Unattended upgrades active: yes (autoreboot true)

[ nc-notify-updates ]
Restarting periodic command scheduler: cronStopping periodic command scheduler: cron.
Starting periodic command scheduler: cron.
update web notifications enabled

[ unattended-upgrades ]
Unattended upgrades active: yes (autoreboot true)

[ nc-notify-updates ]
Restarting periodic command scheduler: cronStopping periodic command scheduler: cron.
Starting periodic command scheduler: cron.
update web notifications enabled

docker logs nextcloudpi --tail 200

stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
tail: no process found
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-05-30 13:30:36 1995852592 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
tail: no process found
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-05-30 13:47:49 1995762480 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Init done
Starting PHP-fpm
Starting Apache
Starting mariaDB
2019-05-31 10:19:03 1995963184 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 81 …
Starting Redis
Starting Cron
Starting Postfix
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
tail: no process found
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-05-31 11:12:06 1995946800 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Init done
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-05-31 16:17:20 1996348208 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111 “Connection refused”)
Init done
Starting PHP-fpm
Cannot load Zend OPcache - it was already loaded
Starting Apache
Starting mariaDB
2019-06-02 14:13:10 1995504432 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Redis
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping MariaDB database server: mysqld failed!
Starting MariaDB database server: mysqld already running.
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Cannot load Zend OPcache - it was already loaded
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 14:18:05 1996213040 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 81 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 14:29:45 1995569968 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 14:52:16 1995860784 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 15:27:57 1995746096 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Stopping mariaDB
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 15:51:25 1996344112 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 16:15:17 1995721520 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-02 16:17:44 1995561776 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 81 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-03 9:00:05 1995762480 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done
stopping Cron…
stopping Redis…
stopping Postfix…
stopping logs…
Stopping apache
Stopping PHP-fpm
Stopping mariaDB
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’
Starting PHP-fpm
Starting Apache
Starting mariaDB
Starting Redis
2019-06-03 9:21:41 1995397936 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 80 …
Starting Cron
Starting Postfix
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 1 set to string 172.18.0.2
Cannot load Zend OPcache - it was already loaded
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done

Now to try restart of docker container, half suspecting some DB corruption is the root cause but lets see, will report back once tried.

As suspected, after reboot/restart NCP has updated the ncadmin DB password in but this is not being reflected in the mysql DB itself (Redis updates are seen)

NCP config
datadirectory /data/nextcloud/data
dbtype mysql
version 15.0.8.1
overwrite.cli.url https://red.act.ed/
dbname nextcloud
dbhost localhost
dbport
dbtableprefix oc_
mysql.utf8mb4 1
dbuser ncadmin
dbpassword eXzSEY***************************65KdvMTzsAE=
installed 1
instanceid ocypc7j5jmvr
memcache.local \OC\Memcache\Redis
memcache.locking \OC\Memcache\Redis
redis
host /var/run/redis/redis.sock
port 0
timeout 0
password PFwCfoWo********************2yT97d124=
mail_smtpmode smtp
mail_smtpauthtype LOGIN
mail_from_address admin
overwriteprotocol https
maintenance
theme
loglevel 2
mail_sendmailmode smtp
mail_smtpsecure ssl
mail_smtpport 25
mail_smtpauth 1
updater.release.channel beta
mail_smtpname
mail_smtppassword
jpeg_quality 60
mysql conf ncadmin

MariaDB [(none)]> show grants for ‘ncadmin’@‘localhost’;
±---------------------------------------------------------------------------------------------------------------+
| Grants for ncadmin@localhost |
±---------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO ‘ncadmin’@‘localhost’ IDENTIFIED BY PASSWORD '69156*****************E5DF601DD’ |
| GRANT ALL PRIVILEGES ON nextcloud.
TO ‘ncadmin’@‘localhost’ |
±---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Can see root db access denied to NCP provisioner:

docker nextcloudpi log

2019-06-04 10:29:26 1995967280 [Note] mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 81 …
System config value trusted_domains => 1 set to string 172.18.0.2
System config value trusted_domains => 6 set to string 192.168.1.5
Provisioning
Provisioning Redis password
Updating NextCloud config with Redis password
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Updating NextCloud config with MariaDB password
Running nc-limits
Using 728297472B for PHP
Using 4 PHP threads
Using 388425318 memory for the database
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
Init done

I have previously had to reset the root password due to issue after adding DB for Rainloop contact s locked me out! >.< lol but I didn’t mess with ncadmin acc. Manually setting the correct/desired password in the config.php and in the DB itself resolves the issue but the passwords are changed NCP end on reboot again.

Iirc when I first tried logging into the MariaDB I was able to access without entering password, just need to revert to this config and all should be well again right…?

[Edit]
In short, the ncp provisioning service that resets the ncadmin and redis passwords on re/boot is not setting these in the DB for some reason (no doubt related to me having manually set them previously). How can I restore this functionality?

check the password in /root/.my.cnf maybe

That is getting updated on each restart also, but the database is not getting updated.
Just need to debug this process but I see no details in the docker or ncp logs that indicate what is wrong, other than root a acess denied which won’t be helping things I guess. Will have time later today for more tests.
Again I’d like to confirm that on new setup, MySQL access to the monitor/cli doesn’t require password is that correct? I’ll have a look at revoking the requirement of password to the sql monitor for the root/ncadmin accounts to see if this has any impact.

OK so the password in /root/.my.conf is the hashed ver of ‘default’ which you would expect (from checking the provisioning script).

Setting this manually to ‘default’ (fwiw) then running just the DB provisioning part of the provisioning script fails:

# ./mariadbprovivionncadmin.sh
Provisioning MariaDB password
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Which isn’t surprising if the root DB account now also is identified by password (it is, this happened manually :wink: ):

| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '98E4FY928***redacted***9WQBR9Q7BR' WITH GRANT OPTION |

So according to this post MariaDB now allows root access without password as it authenticates via Unix socket instead (this appeared to be the case in NCP when I first logged into sql from the prompt as root). So I tried setting the default auth method for root db access to Unix-socket as per this suggestion and now the provisioning script completes without error.
Problem still remains that the hashed password is being passed to config.php rather than the er…default password of ‘default’. Manually setting this back to default then resolved NC access issue (of course without correct password php cannot start NC).

So somewhere NC is getting the hashed ncadmin password which doesn’t work, I don’t recall previous (to recent issues) seeing a hashed password in the NCP config web :4443/?app=config page but now on each restart/update etc, the password is being hashed in config.php (which is great if it works! lol)

OK finally seemed to have solved this one myself, so in case anyone else meddles with their database manually and ends up breaking NCP, what I finally needed to do was revert the default MariaBD root account authentication to unix_socket rather than via password which I accidentally/mistakenly set :slight_smile:

from the MySql command prompt:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED VIA unix_socket;

FLUSH PRIVILEGES; 

I restarted the docker container (which previously would result in NC failing to start and all appears to be working as expected.

[Edit] After a hard power cycle NCP did not come back up (as it had previously) but restarting the NCP Docker container resolved the issue, which perhaps is another issue…

1 Like