ddavness / power-mailinabox

A Mail-in-a-Box with extra capabilities and more customizability. Not just for power users!
Creative Commons Zero v1.0 Universal
168 stars 32 forks source link

Python error and issue after updating to Bullseye #42

Closed mannp closed 2 years ago

mannp commented 2 years ago

Hi there

I thought I updated to 0.56 yestersday and then upgraded to debian 11.

The upgrade seemed to go well and everything appeared to be working, but this morning my box is down.

I tried to upgrade again, but am getting this error... it appears I am not on 0.56 or the update script is not getting 0.56 with Debian 11 maybe?

My admin gateway is 502 but the base domain displays the correct html page.

Any help would be appreciated :) thanks in advance

Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...
setup/functions.sh: line 7:  5880 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: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f0526e1f740 (most recent call first):

Edit: Tried purging python and pip and rerunning the install script but nothing I have tried works...same error.

Google is full of reports of the error but, a convoluted mess of answers, that either don't work or are not appropriate here.

ddavness commented 2 years ago

Trying to reproduce the issue:

Not exactly sure where this could fail, I'll get back to you if I find anything interesting.

ddavness commented 2 years ago

Update - I was able to reproduce the issue. Band-aid solution is to run the following command:

sudo rm -rf /usr/local/lib/mailinabox/env

Then re-run the setup as usual. This will force the setup to re-create the management environment from scratch instead of using old python versions.

ddavness commented 2 years ago

Or... update again, because it should be fixed now :)

https://github.com/ddavness/power-mailinabox/releases/tag/v56.1

mannp commented 2 years ago

Glad you were able to reproduce and fix, thank you.

I was so close to removing the env, based on suggestions around the web, but wasn't sure of the consequences, lol.

Now I do and see your change :)

Thanks again.

elif [ "$(cat $venv/.oscode)" != $(get_os_code) ]; then
    echo "Existing management environment is from an earlier version of the OS you're running."
    echo "Re-creating Python environment..."
    rm -rf $venv
    hide_output virtualenv -ppython3 $venv
fi