Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation script is failing on ubuntu 22.04 #2335

Closed
LuD1161 opened this issue Nov 27, 2023 · 28 comments
Closed

Installation script is failing on ubuntu 22.04 #2335

LuD1161 opened this issue Nov 27, 2023 · 28 comments

Comments

@LuD1161
Copy link

LuD1161 commented Nov 27, 2023

First of all thanks for the awesome project 馃憢

I've previously install MIAB on ubuntu 22.04 LTS, almost 4-5 months back. But now it's failing.
There are multiple issues and some solutions that I did for them -

  1. virtualenv installation folders, path have changed. Hence now this is failing at setup/management.sh line number 34 & 39.
    I fixed this by adding the correct path like this -
image

However, I am getting into this error -

DEPRECATION: distro-info 1.1build1 has a non-standard version number. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of distro-info or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: pypng, expiringdict, exclusiveprocess, rtyaml, qrcode, pyotp, pycparser, psutil, pillow, multidict, MarkupSafe, itsdangerous, gunicorn, frozenlist, click, blinker, attrs, async-timeout, yarl, Werkzeug, Jinja2, cffi, aiosignal, pycares, flask, cryptography, aiohttp, aiodns, postfix-mta-sts-resolver
  Attempting uninstall: blinker
    Found existing installation: blinker 1.4
ERROR: Cannot uninstall 'blinker'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Has someone faced a similar issue ?

OS version

image
@MarcosBL
Copy link

MarcosBL commented Nov 27, 2023

+1 breaking here with the exact steps and errors. Seems the same as in #2272 but with no solution so no clues

@kiekerjan
Copy link
Contributor

There is some discussion here that seems to describe the same issue. However, I would first like to get some additional information, like:

  • Did you get a fresh Ubuntu 22.04 VPS? Or upgrade an existing one?
  • How did you install the system, which command are you using?
  • There might be a VPS specific issue. Which provider are you using?

Instead of changing code, could you post the original issues (errors, messages, installation output etc) you're facing?

@samos028
Copy link

Exactly same problem for me:

  • Fresh 22.04 install using ubuntu-22.04.3-live-server-amd64.iso
  • command launched: curl -s https://mailinabox.email/setup.sh | sudo -E bash
  • output:
    ...
    Successfully uninstalled click-8.0.3
    Attempting uninstall: blinker
    Found existing installation: blinker 1.4
    ERROR: Cannot uninstall 'blinker'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

  • I'm providing VPS, so not a provider problem

@LuD1161
Copy link
Author

LuD1161 commented Nov 27, 2023

There is some discussion here that seems to describe the same issue. However, I would first like to get some additional information, like:

* Did you get a fresh Ubuntu 22.04 VPS? Or upgrade an existing one?

* How did you install the system, which command are you using?

* There might be a VPS specific issue. Which provider are you using?

Instead of changing code, could you post the original issues (errors, messages, installation output etc) you're facing?

Hey @kiekerjan 馃憢
Thanks for the reply. It's a fresh install on contabo ( vps host ). Contabo is the one that allows for SMTP. hence using that, if anyone has any other better alternatives, I am all ears 馃槃

@samos028
Copy link

To make things work quickly I removed blinker (dpkg -r python3-blinker) and its associated packages, and it worked. Definitively not the ideal method, but good enough for now and for my needs.

@dms00
Copy link

dms00 commented Nov 28, 2023

The code in management.sh hasn't changed in many years, and I've confirmed that the paths are correct on my MiaB Ubuntu 22.04. So, I believe the issue is, why did virtualenv create the python venv with everything under local/bin instead of bin on the affected systems?

I found this with a quick google search, maybe it will help you to resolve the issue:
https://askubuntu.com/questions/1406304/virtualenv-installs-envs-into-local-bin-instead-of-bin

@dms00
Copy link

dms00 commented Nov 28, 2023

Okay, after a quick review, the tl;dr version is, if you add this to your environment it should fix how the venv is being built:

export DEB_PYTHON_INSTALL_LAYOUT='deb'

The setup script only appears to build the virtualenv if the directory is missing, so you will need to first remove that venv directory, /usr/local/lib/mailinabox/venv, before re-running the install. And if you're using sudo to run mailinabox, make sure that the environment variable is being preserved by using the --preserve-env option.

@awkto
Copy link

awkto commented Nov 28, 2023

This worked for me, adding the env var as per @dms00
export DEB_PYTHON_INSTALL_LAYOUT='deb'

@dms00
Copy link

dms00 commented Nov 28, 2023

Thanks for the feedback. Glad it worked.

I didn't have any way to test this fix because I cannot reproduce this problem on my MiaB server. So, there's more going on here than I understand at this point.

@dms00
Copy link

dms00 commented Nov 28, 2023

This comment from the "askubuntu.com" link I posted seems to be crucial:

Screenshot 2023-11-27 at 19 46 37

Could someone who has this problem on their system, please check if you have python3-distutils installed on your system? And if you do not, please install it and see if that resolves the issue.

@RobWW
Copy link

RobWW commented Nov 28, 2023

My bad luck, tonight I decided to test installing mailinabox on a fresh Ubuntu 22.04 (LTS) x64 Digital Ocean instance and have run into the above error. Python3-distutils version 3.10.8-1~22.04 does appear to be installed:

sudo apt-get install python3-distutils
python3-distutils is already the newest version (3.10.8-1~22.04).

dpkg -S python3-distutils
python3-distutils: /usr/share/lintian/overrides/python3-distutils
python3-distutils: /usr/share/doc/python3-distutils/copyright
python3-distutils: /usr/share/doc/python3-distutils
python3-distutils: /usr/share/doc/python3-distutils/changelog.Debian.gz
python3-distutils: /usr/share/doc/python3-distutils/README.Debian

Edit: the instructions to "export DEB_PYTHON_INSTALL_LAYOUT='deb'" fixed the crash.

@LuD1161
Copy link
Author

LuD1161 commented Nov 28, 2023

Hey Everyone 馃憢

Thanks for helping resolve the issue.
@kiekerjan I had a look at your fork, I see a lot of improvements there. Thanks for maintaining it.

@LuD1161
Copy link
Author

LuD1161 commented Nov 28, 2023

I've just set the env var on a fresh machine ( didn't even run apt update or apt upgrade ) and it worked 馃槃
export DEB_PYTHON_INSTALL_LAYOUT='deb' Thanks @dms00 for the suggestion 馃槃
image

@MarcosBL
Copy link

@dms00 suggestion worked like a charm, thanks mate !

export DEB_PYTHON_INSTALL_LAYOUT='deb'

@LuD1161
Copy link
Author

LuD1161 commented Nov 28, 2023

Closing this issue for now.

@LuD1161 LuD1161 closed this as completed Nov 28, 2023
@ypeskov
Copy link

ypeskov commented Nov 28, 2023

But maybe it should be at least documented somehow? I yesterday also stuck with it and the above solution worked. But it looks like a workaround and not a robust solution.

@kiekerjan
Copy link
Contributor

And depending on the cause we might want to include a code change to management.sh

@JoshData
Copy link
Member

Great sleuthing! We'll set this environment variable automatically in the next Mail-in-a-Box update (see 371f5bc).

@capitancurt
Copy link

capitancurt commented Nov 28, 2023

I tried everything I could think of last night.
This morning, I tried a bare metal install, no updates, ran
#export DEB_PYTHON_INSTALL_LAYOUT='deb'
prior to any command, then ran the install,
#sudo apt install curl locales -y
#sudo dpkg-reconfigure locales
#sudo curl -L https://power-mailinabox.net/setup.sh | sudo bash

and this happens...still....

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Installing nsd (DNS server)...
Generating DNSSEC signing keys...
No keypair found. Generating daemon's PGP keypair...
Generated key with fingerprint 9288A8DBC35E8C7CB22A63940AB01FD56FF954BC
Installing Postfix (SMTP server)...
Installing Dovecot (IMAP server)...
Creating new user database: /home/user-data/mail/users.sqlite
Installing OpenDKIM/OpenDMARC...
Installing SpamAssassin...
Installing Nginx (web server)...
Installing Roundcube (webmail)...
Installing Nextcloud (contacts/calendar)...

Upgrading to Nextcloud version 24.0.7

Nextcloud is already latest version
photos 1.6.0 disabled
dashboard 7.4.0 disabled
activity 2.16.0 disabled
Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip

setup/functions.sh: line 17: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

@ypeskov
Copy link

ypeskov commented Nov 28, 2023

I tried everything I could think of last night. This morning, I tried a bare metal install, no updates, ran #export DEB_PYTHON_INSTALL_LAYOUT='deb' prior to any command, then ran the install, #sudo apt install curl locales -y #sudo dpkg-reconfigure locales #sudo curl -L https://power-mailinabox.net/setup.sh | sudo bash

and this happens...still....

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Installing nsd (DNS server)... Generating DNSSEC signing keys... No keypair found. Generating daemon's PGP keypair... Generated key with fingerprint 9288A8DBC35E8C7CB22A63940AB01FD56FF954BC Installing Postfix (SMTP server)... Installing Dovecot (IMAP server)... Creating new user database: /home/user-data/mail/users.sqlite Installing OpenDKIM/OpenDMARC... Installing SpamAssassin... Installing Nginx (web server)... Installing Roundcube (webmail)... Installing Nextcloud (contacts/calendar)...

Upgrading to Nextcloud version 24.0.7

Nextcloud is already latest version photos 1.6.0 disabled dashboard 7.4.0 disabled activity 2.16.0 disabled Installing Z-Push (Exchange/ActiveSync server)... Installing Mail-in-a-Box system management daemon...

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip

setup/functions.sh: line 17: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

you should run with the option --preserve-env

#sudo --preserve-env curl -L https://power-mailinabox.net/setup.sh | sudo --preserve-env bash

in my case it was like this:
$ export DEB_PYTHON_INSTALL_LAYOUT='deb'
$ sudo --preserve-env curl -s https://mailinabox.email/setup.sh | sudo -E bash

@capitancurt
Copy link

capitancurt commented Nov 28, 2023

--= THIS WORKED FOR ME==--
(subject: stand alone pc, with Ubuntu server 22.04 loaded from downloaded image from 11-27-23, no other commands given from first boot other than changing the root password)

#export DEB_PYTHON_INSTALL_LAYOUT='deb'
#sudo --preserve-env curl -L https://power-mailinabox.net/setup.sh | sudo --preserve-env bash

Thank you all.

@capitancurt
Copy link

After a "successful installation", I get a new error on the Admin Backup page.
[Errno 2] No such file or directory: '/usr/local/bin/duplicity'

@awkto
Copy link

awkto commented Nov 29, 2023

It is still failing for me. I tried the solutions proposed

export DEB_PYTHON_INSTALL_LAYOUT=  'deb'
sudo --preserve-env curl -L https://power-mailinabox.net/setup.sh | sudo --preserve-env bash

Still fails at

Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip
-----------------------------------------
setup/functions.sh: line 17: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

Can't install Mailinabox on Ubuntu 22.04

@demha-theFirstOne
Copy link

demha-theFirstOne commented Nov 29, 2023

Hello
I have the same issue. I try the work arround with --preserve and that's not better.
I'm starting from a fresh install, nothing on the vps , I try with an apt update or from scratch and the issue always occur.
I also try to create a virtual link to pip as it works fine (if I try "pip install --upgrade pip", it s ok, thats only the path who is wrong) , but its another fail. There is a fix or a previous stable release I can try ?

If i relanch the script after a sudo --preserve-env pip install --upgrade pip I got this new error information :
Installing Mail-in-a-Box system management daemon...

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip

setup/functions.sh: line 19: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

  • connect to 0.0.0.60 port 80 failed: Connection timed out
  • Failed to connect to 0.0.0.60 port 80 after 129901 ms: Connection timed out
  • Closing connection 1

@capitancurt
Copy link

capitancurt commented Nov 30, 2023

I just repeated the experiment...baremetal...tried Ubuntu server 23...but Dave hasn't addressed 23 yet...so, I loaded Ubuntu Server 20.04

Only commands given prior to installation was to change the root password.

I ran the standard install procedure, and everything appears to be working just fine...seems that Jammy just broke itself. Bummer.

So, at lease I have an option. ( I have a large project where I will be loading up a few dozen iterations of PMIAB..so I was about to panic.)

I have run all updates, and nothing appears broken.

@KaiserRuben
Copy link

Just as a quick note for people trying the above mentioned fix.
You need to run the command before anything else, otherwise it wont work.

So, get a VM, connect, run export DEB_PYTHON_INSTALL_LAYOUT='deb', then as second step, run sudo --preserve-env curl -s https://mailinabox.email/setup.sh | sudo -E bash.

@nishchayjeet
Copy link

Quick note if still getting error - /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

  1. Set the Environment Variable:
    export DEB_PYTHON_INSTALL_LAYOUT='deb'
  2. . Remove the Existing Virtual Environment:
    sudo rm -r /usr/local/lib/mailinabox/env
  3. sudo --preserve-env curl -s https://mailinabox.email/setup.sh | sudo -E bash

These 3 steps should run the installation without errors

@HusseinKhazem
Copy link

Remove Current Python Enviroment and then re create it and try running the script again. Worked for me

rm -rf /usr/local/lib/mailinabox/env >> REMOVE ENVIROMENT

apt install python3.10-venv >> DOWNLOAD VENV

python3 -m venv /usr/local/lib/mailinabox/env >> CREATE NEW VIRTUAL ENV

Run the Script Again, It definitely should work, i updated 5 mail servers all of them faced this problem and i fixed all of them like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests