Pritunl crashing after upgrade

Hello everyone,

I recently upgraded the packages on my Ubuntu 18.04 server. I then restarted the pritunl service.
Now it fails to start with the below error after running systemctl status pritunl:

● pritunl.service - Pritunl Daemon
   Loaded: loaded (/etc/systemd/system/pritunl.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2022-11-06 11:53:32 PST; 56s ago
  Process: 510 ExecStart=/usr/lib/pritunl/bin/pritunl start (code=exited, status=1/FAILURE)
 Main PID: 510 (code=exited, status=1/FAILURE)

Nov 06 11:53:32 xxx pritunl[510]:   File "/usr/lib/pritunl/bin/pritunl", line 13, in <module>
Nov 06 11:53:32 xxx pritunl[510]:     from importlib_metadata import distribution
Nov 06 11:53:32 xxx pritunl[510]: ModuleNotFoundError: No module named 'importlib_metadata'
Nov 06 11:53:32 xxx pritunl[510]: During handling of the above exception, another exception occurred:
Nov 06 11:53:32 xxx pritunl[510]: Traceback (most recent call last):
Nov 06 11:53:32 xxx pritunl[510]:   File "/usr/lib/pritunl/bin/pritunl", line 15, in <module>
Nov 06 11:53:32 xxx pritunl[510]:     from pkg_resources import load_entry_point
Nov 06 11:53:32 xxx pritunl[510]: ModuleNotFoundError: No module named 'pkg_resources'
Nov 06 11:53:32 xxx systemd[1]: pritunl.service: Main process exited, code=exited, status=1/FAILURE
Nov 06 11:53:32 xxx systemd[1]: pritunl.service: Failed with result 'exit-code'.

Any assistance would be greatly appreciated!

This is likely from using a repository for the incorrect version of Ubuntu. The repositories documentation has a list of available repositories.

Thanks for your reply @zach,

I’m running Ubuntu 18.04.6 LTS so I have used the Ubuntu Bionic repository.

Is this incorrect?

I can’t reproduce this issue, this can also occur if the system Python installation is modified.

Hiya @zach,

How strange. Can you please send me any commands to run for me to check this? What should the installation look like?

Below are the commands to install Pritunl on Ubuntu 18.04

sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list << EOF
deb https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse
EOF

sudo tee /etc/apt/sources.list.d/pritunl.list << EOF
deb https://repo.pritunl.com/stable/apt bionic main
EOF

sudo apt --assume-yes install gnupg
wget -qO- https://www.mongodb.org/static/pgp/server-5.0.asc | sudo tee /etc/apt/trusted.gpg.d/mongodb-org-5.0.asc
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 7568D9BB55FF9E5287D586017AE645C0CF8E292A
gpg --armor --export 7568D9BB55FF9E5287D586017AE645C0CF8E292A | sudo tee /etc/apt/trusted.gpg.d/pritunl.asc
sudo apt update
sudo apt --assume-yes install pritunl mongodb-org
sudo systemctl start pritunl mongod
sudo systemctl enable pritunl mongod

Hiya,

Thank you. I’ll try running those.

However, I already have pritunl installed on this server. It has been running fine for over a year and a half without any issues until now.

Would those work to fix the install?

Thanks

You will need to try reinstalling the Python and Pritunl packages.

Great, thanks.

I’ve ran that and the install was sucessfull. However when running sudo systemctl enable pritunl mongod I get the below:

Failed to enable unit: Unit file mongod.service does not exist.

@zach, This also appears when running sudo systemctl status pritunl:

Nov 07 16:47:09 xxx pritunl[7818]:   File "/usr/lib/pritunl/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1883, in __start_session
Nov 07 16:47:09 xxx pritunl[7818]:     server_session = self._get_server_session()
Nov 07 16:47:09 xxx pritunl[7818]:   File "/usr/lib/pritunl/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1921, in _get_server_session
Nov 07 16:47:09 xxx pritunl[7818]:     return self._topology.get_server_session()
Nov 07 16:47:09 xxx pritunl[7818]:   File "/usr/lib/pritunl/lib/python3.6/site-packages/pymongo/topology.py", line 520, in get_server_session
Nov 07 16:47:09 xxx pritunl[7818]:     session_timeout = self._check_session_support()
Nov 07 16:47:09 xxx pritunl[7818]:   File "/usr/lib/pritunl/lib/python3.6/site-packages/pymongo/topology.py", line 502, in _check_session_support
Nov 07 16:47:09 xxx pritunl[7818]:     None)
Nov 07 16:47:09 xxx pritunl[7818]:   File "/usr/lib/pritunl/lib/python3.6/site-packages/pymongo/topology.py", line 220, in _select_servers_loop
Nov 07 16:47:09 xxx pritunl[7818]:     (self._error_message(selector), timeout, self.description))

Hiya @zach,

Sorry for the ping. Are you able to shed any light onto this?

Thanks!

All the data is stored on the MongoDB database you can backup and restore the database on a new system with a working installation.

Hiya @zach,

Thanks for your help. I’ll try and do that.

Do you have any specific docs on how to apply that to Pritunl?

Thanks!

Nothing specific needs to be done with Pritunl. Typically the commands below can be used to archive the backup and restore it on a new server.

mongodump --db=pritunl
tar cf backup.tar dump

tar xf backup.tar
mongorestore --db=pritunl dump

Hiya @zach,

Great, thank you. I’ll attempt to do this.

Thanks!