8000 Latest MongoDB images require AVX instructions - Debian VMs fail to run · Issue #4321 · wekan/wekan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Latest MongoDB images require AVX instructions - Debian VMs fail to run #4321

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bryanpedini opened this issue Jan 24, 2022 · 36 comments
Open

Comments

@bryanpedini
Copy link

Issue

After the latest update the mongodb image keeps restarting complaining about AVX instructions.

Server Setup Information

  • Did you test in newest Wekan?: YES
  • Did you configure root-url correctly so Wekan cards open correctly (see https://github.com/wekan/wekan/wiki/Settings)? YES
  • Operating System: Debian
  • Deployment Method (Snap/Docker/Sandstorm/bundle/source): Docker
  • Http frontend if any (Caddy, Nginx, Apache, see config examples from Wekan GitHub wiki first): Nginx reverse proxy to localhost:port
  • Node.js Version: the one provided in Docker image 00478f580306
  • MongoDB Version: latest Docker image, commit ee13a1eacac9
  • What webbrowser version are you using (Wekan should work on all modern browsers that support Javascript)? Irrelevant (Ferdi App)

/etc/os-release:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

uname -a:

Linux <hostname> 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux

docker image ls: (before and after today's update)

REPOSITORY                TAG              IMAGE ID       CREATED         SIZE
wekanteam/wekan           latest           00478f580306   35 hours ago    558MB
mongo                     latest           ee13a1eacac9   2 weeks ago     696MB
wekanteam/wekan           <none>           95ab2d50c8f5   13 months ago   638MB
mongo                     <none>           3068f6bb852e   13 months ago   493MB

Problem description

After the latest update (today) the wekandb container is continously restarting with the following error message:

$ docker compose logs
wekan-db   | WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
wekan-db   |   see https://jira.mongodb.org/browse/SERVER-54407
wekan-db   |   see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
wekan-db   |   see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814

Reproduction Steps

  • Download / copypaste the docker-compose.yml in a Debian Buster virtual machine (at least this is my setup)
  • Run the compose stack (I have compose v2, tho it should not matter)
  • Fail

Logs

The wekan image is working but cannot connect to the database, the wekandb logs are provided above.

Proposed solution

Either:

  • Document this thing somewhere where stupid users like me who just run apt update && apt upgrade -y can reference something and know what's actually going on before digging through GitHub issues and Jira tickets and all that good stuff
  • Default to MongoDB 4.x something (or at least for now), which is what I'm gonna do right now
  • Both the above 🤷🏻
@timdonovanuk
Copy link
timdonovanuk commented Mar 15, 2022

I tried the example docker-compose and it has image: mongo:4.4 in. I'm still getting this error edit: warning 🤦

I guess it's just a warning but it's disconcerting that the mongo log has zero other entries apart from this.

@saschafoerster
Copy link

I tried to create a development machine on an old Intel Atom board, so I can better check and test the migration from (still broken) snap to docker: but then I have the issue, that I can't test Mongo 5+ as I also get this error message:

wekan-db   | 
wekan-db   | WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
wekan-db   |   see https://jira.mongodb.org/browse/SERVER-54407
wekan-db   |   see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
wekan-db   |   see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814
wekan-db   | 
wekan-db exited with code 132

@xet7
Copy link
Member
xet7 commented Jul 31, 2022

@saschafoerster

I don't know is there any other MongoDB 5+ compatible database. So I presume using WeKan on that old Intel Atom board waits some future time where WeKan could have support for other databases than MongoDB.

@williamtrelawny
Copy link
Contributor

see this post from MongoDB folks: https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610

@bryanpedini run cat /proc/cpuinfo and look up your CPU model on Intel Ark and Ctrl+F for "AVX" to see if it has that support.

This is not an issue of OS support or Wekan support- it's a hard requirement of MongoDB that your CPU has AVX support.

@xet7
Copy link
Member
xet7 commented Aug 31, 2022

@willman42

Thanks for info!

That's not the only problem with MongoDB:

  • MongoDB uses too much disk space (compared to SQLite), RAM and CPU
  • Only Go driver still supports older MongoDB versions like Snap's 3.2.2. Other programming language drivers have dropped support for older MongoDB versions.

My MongoDB to SQLite scripts are still in progress, and will also need many code changes.

I'm not so sure will there be progress with lungo. Mostly I just like SQL better. Some NewSQL databases are also very interesting with their git branching like features, but I have not tested them well enough yet. Similar could be maybe emulated by saving just IDs and deduplicating database records to save space, but that would complicate queries a lot.

@xet7
Copy link
Member
xet7 commented Aug 31, 2022

For migrations, I did also take a little look at MongoDB raw database format, and tried to compile it, but that's maybe going too far. I'm not sure yet. Sure it would be useful to convert directly from raw files, that would make it unnecessary to use 4 hours to restore 500 GB mongodump back to running MongoDB server.

https://www.percona.com/blog/2021/05/18/wiredtiger-file-forensics-part-1-building-wt/

@xet7
Copy link
Member
xet7 commented Aug 31, 2022

I did also try to start FerretDB with docker-compose but did not figure it out well yet, does it work at all:

#787 (comment)

@williamtrelawny
Copy link
Contributor

Yeah I understand you want to migrate away from MongoDB (join the club!), but specifically regarding the OP's issue of MongoDB requiring AVX instructions, there's really nothing he can do except limit installs of MDB to <v5.0 until they upgrade their CPU to something on this list of CPUs supporting AVX.

@xet7
Copy link
Member
xet7 commented Aug 31, 2022

@willman42

Does Qemu support emulating AVX ? ;)

@xet7
Copy link
Member
xet7 commented Aug 31, 2022

Or, should I fork MongoDB, and remove AVX code? ;)

@xet7
Copy link
Member
xet7 commented Aug 31, 2022

MongoDB is really huge amount of code. I tried compiling it, but it was just too much.

SQLite compiles fast.

@williamtrelawny
Copy link
Contributor

@willman42

Does Qemu support emulating AVX ? ;)

Not sure- in my Proxmox environment (which uses Linux KVM) I had to switch my docker host vm from the default "kvm64" vCPU type to the "host" type which essentially just passes thru to the host. So kvm64 doesn't support AVX, but I dont have a list of what all does/not.

@razum2um
Copy link

@xet7 what are real minimum wekan's mongodb requirements? afair, there's nothing what forces (will force) to upgrade to 5x, right?

besides, somebody could care about mongodb's license

The last versions licensed as AGPL version 3 are 4.0.3 (stable) and 4.1.4

tbh, I don't understand a lot of things happening

  • why should we upgrade mongodb and believe the new version is better
  • why 22K users have to fit inside 1 server
  • why SaaS are trying to serve the whole world in 1 central place (in contrast how mastodon works)
  • why not to stay a perfect thing for small-mid size and support server-to-server interactions

@xet7
Copy link
Member
xet7 commented Jan 29, 2023

@razum2um

Your question moved to #4578 (comment)

@bryanpedini
Copy link
Author
bryanpedini commented Jan 30, 2023

@willman42
Does Qemu support emulating AVX ? ;)

Not sure- in my Proxmox environment (which uses Linux KVM) I had to switch my docker host vm from the default "kvm64" vCPU type to the "host" type which essentially just passes thru to the host.

I'm no massive company with giant datacenter, I have a homelab with two different old computers (and admittedly one fairly recent 1U server) running a Proxmox cluster...
Configuring any vm to "host" can result to unexpected behavior in migrations / ha scenarios as the system does not allow to move a running vm to a computer that has a different cpu capability set than the host its originating from. Shit to good cpu ok, good to shit meh, nope!

But it also wouldn't matter actually, since even if the host fail and the vm is spin up from cold boot since everything crashed, you would still encounter these problems where the cpu of the old pcs doesn't support AVX, which is fairly recent as of hardware integration. I still don't understand why we've come along and built decades of software going throug physical capacitors the size of a tube then the microcontroller then punch cards then the floppy drives then cds then dvds then multicore cpus then the 5GHz barrier then now chiplet designs to fit 64c/128t on a single mainstream prosumer threadripper cpu and we now decided we need avx to store data in a fridging database? wtf is wrong with us all humans that we absolutely need to overcomplicate our lives otherwise we're not happy about it?

Just document the fact that VMs and the like, without AVX support, don't play nice alongside mongo 5, you need to upgrade to latest mongo 4 but can't jump.
And accelerate the transition away from that IMHO complicated (and crap design) noSQL db and we'll all be fine...

yes a little bit of a hot take but hey, we're still talking about it and I don't think mongo will accept any potential wekan's suggestion to drop AVX requirements just because a rando guy on a rando project had a problem with it

@razum2um
Copy link

btw, I'm also running wekan & mongodb in a kvm-based docker host (also proxmox) and default qemu's kvm64 doesn't contain AVX, thanks to Lauri got to know Meteor pushes towards newer versions, charged type to host as well and upgraded mongodb

old pcs doesn't support AVX, which is fairly recent as of hardware integration

it was Sandy Bridge ~2008, I clearly see mongodb's dev motivation

we now decided we need avx to store data in a fridging database

frankly speaking, it's the first db I've seen to require it be default, normally low-level guys do feature detection at runtime, e.g. ffmpeg

upstream ticket: https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2

@xet7
Copy link
Member
xet7 commented Jan 30, 2023

@bryanpedini

I don't think mongo will accept any potential wekan's suggestion to drop AVX requirements just because a rando guy on a rando project had a problem with it

I presume most WeKan users are using free Community version of MongoDB, so we are not paying customers of MongoDB.

@bryanpedini
Copy link
Author
bryanpedini commented Jan 31, 2023

frankly speaking, it's the first db I've seen to require it be default, normally low-level guys do feature detection at runtime, e.g. ffmpeg

Exactly

I presume most WeKan users are using free Community version of MongoDB, so we are not paying customers of MongoDB.

And exactly this too.

Those are precisely the point, IMHO a db doesn't need AVX, and by having such a requirement it defeats the purpose of docker &/or virtualization. So either you compile mongo yourself removing that requirement (might be buggy & you're on your own), or you do a centralized mongo instance on a machine without HA and without containers and all your applications don't have their little mongo instance but all connect to that central one, or you set "host" in your vm and risk losing the ability to migrate over HA scenarios due to cpu discrepancies...

Doesn't the mongo team see that this doesn't benefit anyone? What is avx even used for TO STORE DATA on a fridging noSQL db?? Native hardware accelerated encryption or what?

IMHO wekan could just move over to anything but mongo (honestly I haven't seen anything a mariadb relational db can't do that a nosql can, but that's just me).

@xet7
Copy link
Member
xet7 commented Feb 1, 2023

Mongo is huge amount of code to compile. I failed to try to compile it, even on bare metal server with big amount of cores it takes a lot of steps and time, not recommended.

SQLite is easy and fast to compile.

MariaDB and PostgreSQL do not run on DOS, Amiga and CloudFlare Workers D1. SQLite does run.

There is rqlite for client-server version of SQLite, if needed.

There is LiteStream fos streaming backups of SQLite.

There is BedrockDB for massive scale and additional features.

Some have moved from PostgreSQL to SQLite because PostgreSQL is more expensive to manage, problems with VACUUM that takes a long time, etc.

SQLite is preferred database for https://sandstorm.io

@bryanpedini
Copy link
Author
bryanpedini commented Feb 1, 2023

SQLite is easy and fast to compile.
Some have moved from PostgreSQL to SQLite
SQLite is preferred database for https://sandstorm.io

Let's just fork the project, move to SQLite, and f*k Mongo and its requirements then...
IK it's a lot of work, but surely less than making Mongo work on devices its not supposed to because <the devs decided so>. IMHO a DB should enable the additional software to store data on it without too much thinking, not breaking compatibility and restricting the devices the additional software can run on. Also Wekan model of going with latest tag in its docker-compose.yml made sure that when mongo broke the camels' back with 5.x, Wekan users experienced trouble on upgrading.
I never ever EVER go with latest. My docker deployments org of ready-to-deploy repos can confirm.

Let's face it, (almost) nobody runs metal anymore, we all use either hypervisors or containers. All tho in the second case since Kube and the pods run on the host itself, there's the argument to be made that the host supports AVX hence not being a vm with kvm64 generic cpu it doesn't have this problem, hence moving the containers to another machine in case of a fault tolerance is much easier. True.

@timdonovanuk
Copy link

A thread talking about CPU instruction sets and having to compiling your own database. For a Kanban board. 😄

@bryanpedini
Copy link
Author

A thread talking about CPU instruction sets and having to compiling your own database. For a Kanban board.

Thanks Mongo, I guess 😅

@GermanAizek
Copy link

@timdonovanuk, have you tried to build mongodb without sandy bridge optimizations?
For example, as in this patch:
https://github.com/GermanAizek/mongodb-without-avx

@xet7
Copy link
Member
xet7 commented Mar 1, 2023

@GermanAizek

Cool, thanks a lot! I'll try to compile it.

@GermanAizek
Copy link

@xet7,
if you need a Dockerfile then here it is
https://github.com/GermanAizek/mongodb-without-avx/blob/main/Dockerfile

@xet7
Copy link
Member
xet7 commented Mar 1, 2023

Doh, I got stuck somewhere not getting lzma installed properly. Oh well.

@xet7
Copy link
Member
xet7 commented Jul 5, 2023
A93C

I try to add support for FerretDB where it will be possible to replace MongoDB with FerretDB proxy to SQLite or PostgreSQL #787 (comment)

@uusijani
Copy link

I can already guess the answer to this is "no, because of how snap works", but would it be possible for Wekan (installed as a snap) to use mongodb tools already installed on the host system? The reason I'm asking is that I'm running Unifi's network application on the same non-AVX-capable host, and the installation script for it has added a mongodb repository patched to work without AVX, so that's already covered.

@xet7
Copy link
Member
xet7 commented Nov 11, 2024

I did not know about that AVX patched repository, I will try that. Using that patched MongoDB in WeKan Snap would make it possible to run WeKan where is no AVX.

I try to fix that WeKan upgrade script, I think attachments are not visible in some cases.

There are Snap commands for stopping WeKan included MongoDB, setting custom MongoDB URL to use external MongoDB, but I don't know what would happen with automatic updates and such corner cases.

@uusijani
Copy link

Right, could be more trouble than it's worth.

I have been eyeing some slightly newer (used) hardware for my home server, but for now this AVX requirement from (the Wekan-integrated) MongoDB is the only real reason to upgrade; otherwise the old HP (from 2011!) is still chugging along just fine in what it's used for. :)

@xet7
Copy link
Member
xet7 commented Nov 11, 2024

There is no reason to upgrade hardware, and add electronic waste. You are not the only one with hardware that does not support AVX.

@xet7
Copy link
Member
xet7 commented Nov 12, 2024

With this mongo-qemu-avx repo, I did run newest WeKan Docker version on my Core 2 Duo laptop that has 8 GB RAM and CPU does not have AVX. I installed qemu with sudo apt install qemu-user-static, that included /usr/bin/qemu-x86_64-static , that I installed at newest Linux Mint, that is based on Ubuntu noble 24.04. I did not notice any difference in speed of MongoDB, but I'm only one user, using WeKan at this Core 2 Duo laptop.

https://github.com/stevekerrison/mongo-qemu-avx

It is possible to check CPU AVX support like this:

cpuavx=$(cat /proc/cpuinfo | grep avx)
if [ -z "${cpuavx}" ]; then
  echo "Your CPU does not support AVX. WeKan will add support for AVX soon, by running MongoDB 6 at Qemu."
  exit 1
fi

So, if CPU does not support AVX, it would be possible to automatically run MongoDB 6 at Qemu that supports AVX. That's possible for Docker, Snap, etc.

The other way would be to figure out precompiled repo binaries from Unifi, but those are custom compiled and could have modifications by Unifi. It's much easier to run official binaries from MongoDB directly with Qemu, that try to compile MongoDB, MongoDB is huge amount of code, and very many steps to build.

@uusijani
Copy link

Yes, the qemu solution seems simpler and more future-proof than the custom Unifi repository.

Also, my guess would be that few people running Wekan on hardware old enough not to have AVX will have a massively large user base on their installation; most are probably small-time hobbyists like myself, so any negligible slowdowns being exacerbated by scale won't be much of an issue.

@stevekerrison
Copy link
stevekerrison commented Nov 27, 2024

With this mongo-qemu-avx repo, I did run newest WeKan Docker version on my Core 2 Duo laptop that has 8 GB RAM and CPU does not have AVX. I installed qemu with sudo apt install qemu-user-static, that included /usr/bin/qemu-x86_64-static , that I installed at newest Linux Mint, that is based on Ubuntu noble 24.04. I did not notice any difference in speed of MongoDB, but I'm only one user, using WeKan at this Core 2 Duo laptop.

https://github.com/stevekerrison/mongo-qemu-avx

Hi! I noticed you mention my repo.

FYI I just updated the above repository to no longer require users to install qemu-user-static on their host system. I don't know why I did it that way to begin with. The distro from which qemu is sourced should be irrelevant as it's a static binary so has no external dependencies, but I chose Debian stable.

You can also now specify the mongo tag you want with a build argument.

@xet7
Copy link
Member
xet7 commented Nov 27, 2024

@stevekerrison

Thanks a lot ! Your qemu solution is a great way to get MongoDB running on hardware where CPU does not have AVX.

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

No branches or pull requests

9 participants
0