Problem: App Installation Fails with Error About /etc/mysql.secret


The installation of an app fails with the following error message in the logfile:

IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/etc/mysql.secret'
    with open('/etc/mysql.secret') as f:
IOError: [Errno 2] File or directory not found: '/etc/mysql.secret'
    with open('/etc/mysql.secret') as f:


Verify MySQL (up to UCS 4.3-0) or MariaDB (starting from UCS 4.2-0) is properly installed.

Step 1

Check installation status.

dpkg -l| grep mysql-server
ii  mysql-server                  5.5.57-0.33        amd64            MySQL database server
dpkg -l| grep mariadb-server
ii  mariadb-server                  10.1.37-0        amd64            MariaDB database server

Step 2

Verify /etc/mysql.secret does not exist or is empty:

root@ucs:~$ ls -alh /etc/mysql.secret
ls: access to '/etc/mysql.secret' not possible: file or directory not found
# or size is "0":
-rw------- 1 root root 20 Mär 0 01:05 /etc/machine.secret

Step 3

Check if you can logon to the database as “root” with the root password.

root@ucs:~# mysql -h localhost -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.37-MariaDB-0+deb9u1 Debian 9.6

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit


Just add the root password to the missing file.

echo -n "YOUR_PASSWORD">/etc/mysql.secret
chmod 0600 /etc/mysql.secret

After this the installation of the app should run fine.

Next time use “univention-install” to install packages instead of using “apt” directly. Thus all Univention integration steps are done correctly.