nextcloudpi
nextcloudpi copied to clipboard
Ownership missmatch for mariadb and redis running lxc container on proxmox and wrong dbpassword
trafficstars
Hi Folks,
I ran the current LXC Image NextcloudPi_LXC_x86_v1.55.3.tar.gz on proxmox 8.3.2. The activation page didn't work. After looking through the logs I found ownership missmatch for mariadb and redis.
# id mysql
uid=101(mysql) gid=108(mysql) groups=108(mysql)
# ls -landh /var/lib/mysql/
drwxr-xr-x 6 991 993 4.0K Nov 8 20:44 /var/lib/mysql/
# id redis
uid=103(redis) gid=112(redis) groups=112(redis)
# ls -landh /var/lib/redis/ /var/log/redis/
drwxr-x--- 2 101 103 4.0K Nov 8 20:44 /var/lib/redis/
drwxr-s--- 2 101 4 4.0K Nov 8 20:44 /var/log/redis
Workaround to solve the issue (run commands as root):
chown -R redis:redis /var/lib/redis/ /var/log/redis/
chown -R mysql:mysql /var/lib/mysql/
chmod -R o+Xr /etc/redis/
systemctl start mariadb
systemctl start redis
After that I ran in the next issue clicking on activate: /var/log/ncp.log
Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES) in /var/www/nextcloud/lib/private/DB/Connection.php:233
My Workaround:
dbpassword=$(grep dbpassword /var/www/nextcloud/config/config.php | sed "s|^.*=> '||g; s|',$||g")
echo $dbpassword
echo "SET PASSWORD FOR 'ncadmin'@'localhost' = PASSWORD('$dbpassword');" | mysql