Roundcube: "Unable to connect to the database!"

Today I had to find out that after weeks of problem-free operation suddenly mail no longer synchronizes. When testing with webmail I get the error message.
“Unable to connect to the database!”

I restarted the server, no changes.
What can I do

  • to check it
  • to analyze whether it is a general mail or a special webmail problem
  • to repair it

I am a bit at a loss.

If I try to reninstal/remove roundcube

[root@ns ~]# yum remove roundcubemail
Loaded plugins: changelog, fastestmirror, nethserver_events
No Match for argument: roundcubemail
No Packages marked for removal
[root@ns ~]#
[root@ns ~]# yum reinstall roundcubemail
Loaded plugins: changelog, fastestmirror, nethserver_events
No Match for argument: roundcubemail
Loading mirror speeds from cached hostfile
 * ce-base: centos.mirror.server24.net
 * ce-extras: centos.mirror.server24.net
 * ce-sclo-rh: centos.mirror.server24.net
 * ce-sclo-sclo: centos.mirror.server24.net
 * ce-updates: centos.mirror.server24.net
 * epel: mirror.de.leaseweb.net
 * nethforge: mirror.alpix.eu
 * nethserver-base: mirror.alpix.eu
 * nethserver-updates: mirror.alpix.eu
 * stephdl: nethesis-mirror.nokken.co.uk
Package(s) roundcubemail available, but not installed.
Error: Nothing to do
[root@ns ~]#
[root@ns ~]# yum reinstall roundcubemail --enablerepo=stephdl-roundcubemail
Loaded plugins: changelog, fastestmirror, nethserver_events
No Match for argument: roundcubemail
Loading mirror speeds from cached hostfile
 * ce-base: centos.mirror.server24.net
 * ce-extras: centos.mirror.server24.net
 * ce-sclo-rh: centos.mirror.server24.net
 * ce-sclo-sclo: centos.mirror.server24.net
 * ce-updates: centos.mirror.server24.net
 * epel: mirror.23m.com
 * nethforge: mirror.alpix.eu
 * nethserver-base: mirror.alpix.eu
 * nethserver-updates: mirror.alpix.eu
 * stephdl: nethesis-mirror.nokken.co.uk
 * stephdl-roundcubemail: nethesis-mirror.nokken.co.uk
Package(s) roundcubemail available, but not installed.
Error: Nothing to do
[root@ns ~]#

But in Applications…:

Thank you, Marko

what i found:

[root@ns ~]# yum list nethserver-roundcubemail*
Loaded plugins: changelog, fastestmirror, nethserver_events
Loading mirror speeds from cached hostfile
 * ce-base: centos.mirror.server24.net
 * ce-extras: centos.mirror.server24.net
 * ce-sclo-rh: centos.mirror.server24.net
 * ce-sclo-sclo: centos.mirror.server24.net
 * ce-updates: centos.mirror.server24.net
 * epel: mirror.23m.com
 * nethforge: mirror.alpix.eu
 * nethserver-base: mirror.alpix.eu
 * nethserver-updates: mirror.alpix.eu
 * stephdl: nethesis-mirror.nokken.co.uk
Installed Packages
nethserver-roundcubemail-next.noarch                                          1.5.3-1.ns7                                          @nethforge        
Available Packages
nethserver-roundcubemail.noarch                                               1.5.1-1.ns7                                          nethserver-updates
[root@ns ~]#

I reinstalled it an the the pronlem with roundcube is fixed.

What are the differences between this three different roundcubemail packages?
Which is recommended to use?

after reboot, the same error occurs

I removed nethserver-roundcubemail-next (1.5.3) an installed nethserver-roundcubemail 1.5.1

webmail now also survives a reboot.

I can send and receive mails within webmail.

roundcubemail is just a web application, it is not guilty if it cannot connect to a mysql database, what is the status of

systemctl status rh-mariadb105-mariadb@roundcubemail.service

what means the statement above please

1 Like
root@ns ~]# systemctl status rh-mariadb105-mariadb@roundcubemail.service
● rh-mariadb105-mariadb@roundcubemail.service - MariaDB 10.5 database server
   Loaded: loaded (/etc/systemd/system/rh-mariadb105-mariadb@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
[root@ns ~]#

but roundcube 1.5.1 still works.

Like you can see the service is stopped but also disabled, this is the culprit why after the boot roundcubemail could not connect to mariadb

Use always the last version please

I tried to enable and start the service.

[root@ns ~]# systemctl status rh-mariadb105-mariadb@roundcubemail.service
● rh-mariadb105-mariadb@roundcubemail.service - MariaDB 10.5 database server
   Loaded: loaded (/etc/systemd/system/rh-mariadb105-mariadb@.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2022-03-27 21:31:46 CEST; 30s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/

Mar 27 21:31:46 ns.myserver.de systemd[1]: Starting MariaDB 10.5 database server...
Mar 27 21:31:46 ns.myserver.de scl[2723]: Socket file /var/lib/mysql/mysql.sock exists.
Mar 27 21:31:46 ns.myserver.de scl[2723]: Is another MySQL daemon already running with the same unix socket?
Mar 27 21:31:46 ns.myserver.de scl[2723]: Please, stop the process using the socket /var/lib/mysql/mysql.sock or remove the file manually to start the service.
Mar 27 21:31:46 ns.myserver.de systemd[1]: rh-mariadb105-mariadb@roundcubemail.service: control process exited, code=exited status=1
Mar 27 21:31:46 ns.myserver.de systemd[1]: Failed to start MariaDB 10.5 database server.
Mar 27 21:31:46 ns.myserver.de systemd[1]: Unit rh-mariadb105-mariadb@roundcubemail.service entered failed state.
Mar 27 21:31:46 ns.myserver.de systemd[1]: rh-mariadb105-mariadb@roundcubemail.service failed.
[root@ns ~]# systemctl start rh-mariadb105-mariadb@roundcubemail.service
Job for rh-mariadb105-mariadb@roundcubemail.service failed because the control process exited with error code. See "systemctl status rh-mariadb105-mariadb@roundcubemail.service" and "journalctl -xe" for details.
[root@ns ~]# journalctl -xe
-- Subject: Unit rh-mariadb105-mariadb@roundcubemail.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rh-mariadb105-mariadb@roundcubemail.service has begun starting up.
Mar 27 21:31:46 ns.myserver.de scl[2723]: Socket file /var/lib/mysql/mysql.sock exists.
Mar 27 21:31:46 ns.myserver.de scl[2723]: Is another MySQL daemon already running with the same unix socket?
Mar 27 21:31:46 ns.myserver.de scl[2723]: Please, stop the process using the socket /var/lib/mysql/mysql.sock or remove the file manually to start the service.
Mar 27 21:31:46 ns.myserver.de systemd[1]: rh-mariadb105-mariadb@roundcubemail.service: control process exited, code=exited status=1
Mar 27 21:31:46 ns.myserver.de systemd[1]: Failed to start MariaDB 10.5 database server.
-- Subject: Unit rh-mariadb105-mariadb@roundcubemail.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rh-mariadb105-mariadb@roundcubemail.service has failed.
-- 
-- The result is failed.
Mar 27 21:31:46 ns.myserver.de systemd[1]: Unit rh-mariadb105-mariadb@roundcubemail.service entered failed state.
Mar 27 21:31:46 ns.myserver.de systemd[1]: rh-mariadb105-mariadb@roundcubemail.service failed.
Mar 27 21:31:46 ns.myserver.de polkitd[767]: Unregistered Authentication Agent for unix-process:2710:979313 (system bus name :1.841, object path /org/freedesktop/PolicyKit1/Authent
Mar 27 21:31:51 ns.myserver.de kernel: Shorewall:net2fw:DROP:IN=eth0 OUT= MAC=5a:5d:fb:d7:74:6c:2c:6b:f5:a0:77:c0:08:00 SRC=192.241.223.237 DST=89.58.36.207 LEN=40 TOS=0x00 PREC=0x
Mar 27 21:32:11 ns.myserver.de polkitd[767]: Registered Authentication Agent for unix-process:2784:981805 (system bus name :1.842 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Mar 27 21:32:11 ns.myserver.de systemd[1]: Reloading.
Mar 27 21:32:11 ns.myserver.de systemd[1]: [/usr/lib/systemd/system/netdata.service:56] Failed to parse capability in bounding/ambient set, ignoring: CAP_PERFMON
Mar 27 21:32:11 ns.myserver.de systemd[1]: [/usr/lib/systemd/system/netdata.service:73] Unknown lvalue 'ProtectControlGroups' in section 'Service'
Mar 27 21:32:11 ns.myserver.de polkitd[767]: Unregistered Authentication Agent for unix-process:2784:981805 (system bus name :1.842, object path /org/freedesktop/PolicyKit1/Authent
Mar 27 21:32:33 ns.myserver.de kernel: Shorewall:net2fw:DROP:IN=eth0 OUT= MAC=5a:5d:fb:d7:74:6c:2c:6b:f5:a0:77:c0:08:00 SRC=135.148.121.109 DST=89.58.36.207 LEN=40 TOS=0x00 PREC=0x
Mar 27 21:32:37 ns.myserver.de polkitd[767]: Registered Authentication Agent for unix-process:3144:984454 (system bus name :1.843 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Mar 27 21:32:37 ns.myserver.de systemd[1]: Starting MariaDB 10.5 database server...
-- Subject: Unit rh-mariadb105-mariadb@roundcubemail.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rh-mariadb105-mariadb@roundcubemail.service has begun starting up.
Mar 27 21:32:37 ns.myserver.de scl[3157]: Socket file /var/lib/mysql/mysql.sock exists.
Mar 27 21:32:37 ns.myserver.de scl[3157]: Is another MySQL daemon already running with the same unix socket?
Mar 27 21:32:37 ns.myserver.de scl[3157]: Please, stop the process using the socket /var/lib/mysql/mysql.sock or remove the file manually to start the service.
Mar 27 21:32:37 ns.myserver.de systemd[1]: rh-mariadb105-mariadb@roundcubemail.service: control process exited, code=exited status=1
Mar 27 21:32:37 ns.myserver.de systemd[1]: Failed to start MariaDB 10.5 database server.
-- Subject: Unit rh-mariadb105-mariadb@roundcubemail.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rh-mariadb105-mariadb@roundcubemail.service has failed.
-- 
-- The result is failed.
Mar 27 21:32:37 ns.myserver.de systemd[1]: Unit rh-mariadb105-mariadb@roundcubemail.service entered failed state.
Mar 27 21:32:37 ns.myserver.de systemd[1]: rh-mariadb105-mariadb@roundcubemail.service failed.
Mar 27 21:32:37 ns.myserver.de polkitd[767]: Unregistered Authentication Agent for unix-process:3144:984454 (system bus name :1.843, object path /org/freedesktop/PolicyKit1/Authent
Mar 27 21:32:38 ns.myserver.de kernel: Shorewall:net2fw:DROP:IN=eth0 OUT= MAC=5a:5d:fb:d7:74:6c:2c:6b:f5:a0:77:c0:08:00 SRC=74.91.27.242 DST=89.58.36.207 LEN=40 TOS=0x00 PREC=0x00 
Mar 27 21:32:40 ns.myserver.de sshd[3197]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=179.43.154.155  user=root
Mar 27 21:32:40 ns.myserver.de sshd[3197]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Mar 27 21:32:40 ns.myserver.de sshd[3197]: pam_listfile(sshd:auth): Refused user root for service sshd
Mar 27 21:32:42 ns.myserver.de sshd[3197]: Failed password for root from 179.43.154.155 port 35522 ssh2
Mar 27 21:32:42 ns.myserver.de sshd[3197]: Connection closed by 179.43.154.155 port 35522 [preauth]

I have to admit, I’m feeling a little overwhelmed right now.

systemctl cat rh-mariadb105-mariadb@roundcubemail.service

What is the output ?

[root@ns ~]# systemctl cat rh-mariadb105-mariadb@roundcubemail.service
# /etc/systemd/system/rh-mariadb105-mariadb@.service
# NethServer replaces original systemd unit to avoid conflicts with nethserver-mysql
# This file disabled unit name aliasing:
#  Alias=mysql.service
#  Alias=mysqld.service

[Unit]
Description=MariaDB 10.5 database server
Documentation=man:mysqld(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=notify
User=mysql
Group=mysql

# Load collections set to enabled for this service
EnvironmentFile=/opt/rh/rh-mariadb105/service-environment

# We want to start server only inside "scl enable" invocation
ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mariadb105

ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-socket --defaults-group-suffix=.%I
ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-prepare-db-dir --defaults-group-suffix=.%I %n
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/rh-mariadb105-mariadb@.service.d/MY_SPECIAL.conf
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=/opt/rh/rh-mariadb105/root/usr/libexec/mysqld-scl-helper enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysqld --defaults-group-suffix=.%I --basedir=/opt/
ExecStartPost=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-upgrade --defaults-group-suffix=.%I

# Setting this to true can break replication and the Type=notify settings
# See also bind-address mysqld option.
PrivateNetwork=false

KillMode=process
KillSignal=SIGTERM

# Don't want to see an automated SIGKILL ever
SendSIGKILL=no

# Restart crashed server only, on-failure would also restart, for example, when
# my.cnf contains unknown option
Restart=on-abort
RestartSec=5s

UMask=007

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Place temp files in a secure directory, not /tmp
PrivateTmp=true

rpm -qa | grep roundcube

[root@ns ~]# rpm -qa | grep roundcube
nethserver-roundcubemail-1.5.1-1.ns7.noarch
roundcubemail-1.4.13-1.ns7.noarch
[root@ns ~]#

You need the last version of nethserver-roundcubemail-next to use the new rhmariadb105

ok, I installed it again. I hope the former trouble will not occurs again.

[root@ns ~]# rpm -qa | grep roundcube
nethserver-roundcubemail-next-1.5.3-1.ns7.noarch
[root@ns ~]#
[root@ns ~]# systemctl status rh-mariadb105-mariadb@roundcubemail.service
● rh-mariadb105-mariadb@roundcubemail.service - MariaDB 10.5 database server
   Loaded: loaded (/etc/systemd/system/rh-mariadb105-mariadb@.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/rh-mariadb105-mariadb@roundcubemail.service.d
           └─nethserver.conf
   Active: active (running) since Mon 2022-03-28 16:00:17 CEST; 1min 32s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 19330 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/system-rh\x2dmariadb105\x2dmariadb.slice/rh-mariadb105-mariadb@roundcubemail.service
           └─19330 /opt/rh/rh-mariadb105/root/usr/libexec/mysqld --defaults-group-suffix=.roundcubemail --basedir=/op...

Mar 28 16:00:17 ns.myserver.de systemd[1]: Starting MariaDB 10.5 database server...
Mar 28 16:00:17 ns.myserver.de scl[19285]: Database MariaDB is probably initialized in /var/opt/rh/...one.
Mar 28 16:00:17 ns.myserver.de scl[19285]: If this is not the case, make sure the /var/opt/rh/rh-ma...dir.
Mar 28 16:00:17 ns.myserver.de mysqld-scl-helper[19330]: 2022-03-28 16:00:17 0 [Note] /opt/rh/rh-mari.....
Mar 28 16:00:17 ns.myserver.de mysqld-scl-helper[19330]: 2022-03-28 16:00:17 0 [Warning] Could not in...4)
Mar 28 16:00:17 ns.myserver.de mysqld-scl-helper[19330]: 2022-03-28 16:00:17 0 [Warning] Changed limi...0)
Mar 28 16:00:17 ns.myserver.de systemd[1]: Started MariaDB 10.5 database server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ns ~]#

So it is up now, roundcube is workable ?

It seems so. I restarted the server w/o problem.
Mysterious…
Yesterday we had the daylight saving time changeover. Can that have had something to do with it?

Thank you for support.

1 Like

Use always the last version please

Following your recommendation, I uninstalled nethserver-roundcubemail on another server a few days ago and installed nethserver-roundcubemail-next This morning I found that nethserver backup failed.
Further investigation revealed that rh-mariadb105-mariadb@roundcubemail.service had died.

So I uninstalled nethserver-roundcubemail-next and reinstalled it. Now not only webmail is working again, but also the backup is working again.

I am really surprised that…

  • the same error occurs on two independent systems (even on different infrastructures)
  • such an error immediately ruins the backup.

This discussion is going too far here, but it also makes it even clearer that the existing backup module is in urgent need of renovation. Especially in case of failure, one would have to be able to fall back on a fault-tolerant backup system. If the failure of a MariaDB (for whatever reason it fails) causes the backup to stop working, the backup module is of no use to me because I can’t trust it.

best regards, Marko

…and again. Database is in death, Backup failed.
…and reinstalled again