Webmail internal server error, Failed to load password plugin config

When i open the webmail website I get internal server error and asking me to check the error logs. Nginx error log was empty but this was what was in the roundcube error log:

[04-Jun-2024 08:49:38 +0200]: PHP Error: Failed to load config from /var/lib/roundcube/plugins/password/config.inc.php in /var/lib/roundcube/program/lib/Roundcube/rcube_plugin.php on line 166 (GET /)
[04-Jun-2024 09:00:55 +0200]: DB Error: SQLSTATE[HY000] [1045] Access denied for user ‘roundcube’@‘localhost’ (using password: YES) in /var/lib/roundcube/program/lib/Roundcube/rcube_db.php on line 201 (GET /)

Execute these commands as root and try again:

chown -R hestiamail:www-data /etc/roundcube/
find /etc/roundcube/ -type f -iname "*php" -exec chmod 640 {} \;
chown -R hestiamail:www-data /var/lib/roundcube/
chown -R hestiamail:www-data /var/log/roundcube/

I have already executed these commands but I still have the same error

Did you install roundcube using apt?

no, used the install script to hestia and have recovered som backups,
latest error messages from roundcube is
[04-Jun-2024 09:57:06 +0200]: DB Error: SQLSTATE[HY000] [1045] Access denied for user ‘roundcube’@‘localhost’ (using password: YES) in /var/lib/roundcube/program/lib/Roundcube/rcube_db.php on line 201 (GET /)
and they repeat

Before trying to reinstall roundcube, show me the output of these commands:

ls -la /etc/roundcube
ls -la /usr/share/roundcube
ls -la /var/lib/roundcube
dpkg -l | grep 'roundcube'
mysql -uroot -e "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'roundcube'"
mysql -uroot -e 'SELECT user,host FROM mysql.user WHERE user = "roundcube";'

The backup you recovered included /etc/roundcube/config.inc.php file?

image
image


image

dpkg and the last sql command did not return anything and no I don’t think the backup had a roundcube config because the backup was from a non email hestia install

Two things:

1.- You didn’t execute these commands:

chown -R hestiamail:www-data /etc/roundcube/
find /etc/roundcube/ -type f -iname "*php" -exec chmod 640 {} \;
chown -R hestiamail:www-data /var/lib/roundcube/
chown -R hestiamail:www-data /var/log/roundcube/

2.- Seems you don’t have a roundcube db created, execute this command:

mysql -uroot -e 'show databases;' | grep -i roundcube

got this as output:
image

Ok, let’s modify the password for roundcube db user:

1.- Obtain the current password:

grep db_dsnw /etc/roundcube/config.inc.php | sed -E 's/^.*:(.*)@.*$/\1/'

2.- Change the password (replace HereThePassword by the password you got with above command):

mysql -uroot -e 'ALTER USER "roundcube"@"localhost" IDENTIFIED BY "HereThePassword"; flush privileges;'

3.- Remember to execute these commands:

chown -R hestiamail:www-data /etc/roundcube/
find /etc/roundcube/ -type f -iname "*php" -exec chmod 640 {} \;
chown -R hestiamail:www-data /var/lib/roundcube/
chown -R hestiamail:www-data /var/log/roundcube/

Use this, I’ve modified the quotes… remember to replace HereThePassword:

mysql -uroot -e "ALTER USER 'roundcube'@'localhost' IDENTIFIED BY 'HereThePassword'; flush privileges;"

What is your db version, is it mysql or mariadb?

mysql -V


mariadb

The same I use and the command works pretty fine.

Before giving the new commands, show me the roundcube users:

mysql -uroot -e 'SELECT user,host FROM mysql.user WHERE user = "roundcube";'

It does not return anything, seems like the users are gone

Ok, execute these two commands to create roundcube user (replace HereThePassword with the actual password):

mysql -uroot -e "GRANT ALL ON \`roundcube\`.* TO \`roundcube\`@\`%\` IDENTIFIED BY 'HereThePassword'"
mysql -uroot -e "GRANT ALL ON \`roundcube\`.* TO \`roundcube\`@\`localhost\` IDENTIFIED BY 'HereThePassword'"

Done, now the users are there:
image

Ok, now:

chown -R hestiamail:www-data /etc/roundcube/
find /etc/roundcube/ -type f -iname "*php" -exec chmod 640 {} \;
chown -R hestiamail:www-data /var/lib/roundcube/
chown -R hestiamail:www-data /var/log/roundcube/

And try to access webmail again.