Can an actual upgrade be done instead of a re-install?

I note that in the maintenance guide there is a detailed description of how to create a new Ubuntu 22.04 and migrate one’s data to that. I’d be keen to rather do an upgrade from 18.04 using do-release-upgrade and then re-installing mailinabox.

I did attempt and the process almost completed, but on one of the last steps in the installation process I get a python error:

Installing Mail-in-a-Box system management daemon...
setup/functions.sh: line 10: 50419 Aborted                 "$@" &> "$OUTPUT"

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip
-----------------------------------------
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f0d8f295740 (most recent call first):
-----------------------------------------

Is that a bad idea (to upgrade) or can I fix this? I did try a lot of general python advice, including purging python completely and reinstalling it, but the error remains.

1 Like

In theory it sure is possible to do a do-release-upgrade, however in practice it turns out there are so many VPS Ubuntu images out there, each with their own quircks, that it’s very difficult to support. That’s why the maintenance guide is simplified in that regard, so everybody has a more or less clean start, by simply having a clean install of Ubuntu 22.04.

I’m not using some VPS version of Ubuntu, but the stock standard installed from Ubuntu.com. You’re right, I can start from scratch on 22.04, but it’s a lot more work imho, that simply running an upgrade.

Anyway, I’ll do a re-installation and see how that goes.

Apologies, I was talking about the generic situation, not yours specifically.
If it helps, I did try a release upgrade in the past, but after spending too much time on resolving issues, I gave up and started with a new image. That was faster in the end.

I’ve also never tried this path to upgrade, mainly because this isn’t a documented approach, and I didn’t want my mail server offline while I ran down every issue that might come up. That being said, here’s my idea about what’s going on with that error you’re seeing.

MiaB creates a virtual environment during setup. That will include the python version and modules+versions that were part of the distro at the time of creation. So, when you upgrade Ubuntu, Python and various Python packages, pip, etc, get upgraded as well at the system level. However, the virtual environment won’t be upgraded along with it. So, now you have the Python ecosystem from Ubuntu 22.04 on the server, but a virtual env from an Ubuntu 18.04 era.

This is just a theory, and it might be completely off, but if you’re still interested in making this work, that’s where I’d start looking.

I thought it would be a lot more work too. In the end it would have been quicker to just reinstall and restore from backups.

The re-install seems hard because the guide overcomplicates it with duplicity restore, secret keys etc, but you can simply rsync the whole /home/user-data directory from the old server to the new one, then install mailinabox

1 Like

I think @MXDNS successfully did release upgrade but for a completely different issue.
As per this post IPv6 getting fe80:: prefix - #4 by vele

For example, Ubuntu 18.04 LTS will only upgrade to Ubuntu 20.04 LTS after the 20.04.1 point release.

This is good for VPS providers that lack a 22 image. In your case is easier to download the 22.04 iso and avoid any problems

I actually tried to upgrade to 20.04 and then to 22.04, but it finally failed with the python issue. I rolled back to the original after that.

We are a VPS provider, which is why I’m attempting to do an upgrade path for our clients to choose. But maybe some other time when the upgrade is not so severe, and/or when we have a resource available who is skilled in python :slight_smile:

I am not sure what you mean. Are you using an image of a VPS provider or you are loading an ISO to a VPS provider since they don’t have a 22 own image? VPS providers have own scripts security patches which might be preventing do-release upgrade. . If you are trying to use an older VPS image and trying to upgrade @MXDNS was successful in this. Ask him.

EDIT:
OK Sorry.

Now I read this.
Good luck than.

Thismight help with the python error:

If you’re still interested in giving this another attempt for your customers, I’d suggest after you’ve upgraded the distro to 22.04, but before you run the mailinabox setup, you move (or remove) the python virtual environment directory. This will cause the mailinabox setup to create it again from scratch. The directory I’m referring to is /usr/local/lib/mailinabox/env.