Install Fails Ubuntu 20 and MySQL Group Replication

Hi all, I am trying to get the best HA solution working but the install is now failing.

This is the error:
<SQLAlchemy engine=mysql+pymysql://pi:***@localhost/pi?charset=utf8>
Traceback (most recent call last):
File “/opt/privacyidea/lib/python3.8/site-packages/pymysql/connections.py”, line 569, in connect
sock = socket.create_connection(
File “/usr/lib/python3.8/socket.py”, line 808, in create_connection
raise err
File “/usr/lib/python3.8/socket.py”, line 796, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

grep: /etc/mysql/debian.cnf: No such file or directory
grep: /etc/mysql/debian.cnf: No such file or directory
ERROR 1045 (28000): Access denied for user ‘–password=’@‘localhost’ (using password: NO)
ERROR 1045 (28000): Access denied for user ‘–password=’@‘localhost’ (using password: NO)

So what I have:
Ubuntu 20.04
PrivacyIDEA 3.5.1 (latest as of 1st Feb)

Basic install and fully updated.
I put the MySQL servers in a group replication which is tested and working.

Install 1)
I added the apt sources to install and ran the apt install privacyidea-apache2
Install failed with the above errors.

Install 2)
I removed the root password for mysql and tried again, still failed with the same error

Install 3)
I manually added the pi database with pi user and password to mysql, updated the file /etc/privacyidea/pi.cfg by adding this line SQLALCHEMY_DATABASE_URI = ‘mysql+pymysql://pi:****@localhost/pi’
Install fails with the same error

I can login with the root user and pi user with no isues.

Anyone have any ideas.

Thanks

Hi @mphayesuk
take a closer look at the error output!
There is a file missing.

Thanks for responding, I did notice that error, but its the DB errors that were concerning me the most.

To be honest I think there is a compatibility issue with Ubuntu 20.04 and PI-3.5.1

This time its a fresh install, just install the OS run the standard updates, add the sources for PI install and then install it.

Then run the backup command and I get this error. Is this a Python version problem??

root@t1s-mgs-mfa03:/opt/scripts# /opt/privacyidea/bin/pi-manage backup create
Traceback (most recent call last):
File “/usr/lib/python3.8/logging/config.py”, line 563, in configure
handler = self.configure_handler(handlers[name])
File “/usr/lib/python3.8/logging/config.py”, line 744, in configure_handler
result = factory(**kwargs)
File “/usr/lib/python3.8/logging/handlers.py”, line 148, in init
BaseRotatingHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.8/logging/handlers.py”, line 55, in init
logging.FileHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.8/logging/init.py”, line 1143, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python3.8/logging/init.py”, line 1172, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: ‘/var/log/privacyidea/privacyidea.log’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/opt/privacyidea/bin/pi-manage”, line 104, in
app = create_app(config_name=‘production’, silent=SILENT)
File “/opt/privacyidea/lib/python3.8/site-packages/privacyidea/app.py”, line 207, in create_app
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
File “/usr/lib/python3.8/logging/config.py”, line 808, in dictConfig
dictConfigClass(config).configure()
File “/usr/lib/python3.8/logging/config.py”, line 570, in configure
raise ValueError('Unable to configure handler ’
ValueError: Unable to configure handler ‘file’
root@t1s-mgs-mfa03:/opt/scripts#

You must not fiddle with a mysql server before installing privacyIDEA.

The privacyidea-apache2 package is ment as a ready to run installation. It works with an unmodified ubuntu. Thus you have two possibilities:

a) Install privacyidea-apache2 first and then break your mysql or

b) fiddle with mysql and then only install privacyidea-package (not privacyidea-apache2).

Thanks, I am already half-way through a modified/custom install, I am sure I can find a way to get it all working. Its another learning day.

Thanks

Ok I have run through these steps and it cant find the install package.

wget https://lancelot.netknights.it/NetKnights-Release.asc
gpg --import --import-options show-only --with-fingerprint NetKnights-Release.asc
apt-key add NetKnights-Release.asc
apt update
apt install privacyidea-package

I am doing something wrong??

Thanks

The name of the package is actually just “privacyidea”.

Thanks, any difference between using virtualenv and just running the Ubuntu installer??

The ubuntu package contains a virtualenv which is deployed at /opt/privacyidea and can be used via

$ source /opt/privacyidea/bin/activate