From 59ab6c1cd8ca3d71616201b02de6536b15b2303d Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 26 Jun 2025 02:41:11 +0300 Subject: [PATCH] Snap Candidate: If CPU does not support AVX, use Qemu that supports AVX, so that MongoDB 6 works. Part 3. Thanks to xet7 ! Fixes #4321 --- snap-src/bin/mongodb-backup | 7 ++++++- snap-src/bin/mongodb-control | 6 +++++- snap-src/bin/mongodb-restore | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/snap-src/bin/mongodb-backup b/snap-src/bin/mongodb-backup index 210375e17..854000bb5 100755 --- a/snap-src/bin/mongodb-backup +++ b/snap-src/bin/mongodb-backup @@ -9,7 +9,12 @@ if [ -z "$LANG" ]; then fi export LC_ALL=C -export PATH=/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH + +# If CPU does not support AVX, use Qemu that supports AVX. +# Migratemongo is at https://github.com/wekan/migratemongo +# and at directory /snap/${SNAP_NAME}/current/migratemongo/avx +# is bash scripts like mongod, mongosh check avx support and use Qemu if needed. +export PATH=/snap/${SNAP_NAME}/current/migratemongo/avx:/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH export LD_LIBRARY_PATH=/snap/${SNAP_NAME}/current/lib:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH if [ -z $1 ]; then diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control index 88c8258ba..dd625a2c5 100755 --- a/snap-src/bin/mongodb-control +++ b/snap-src/bin/mongodb-control @@ -15,7 +15,11 @@ if [ -z "${LANG}" ]; then fi export LC_ALL=C -export PATH=/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:${PATH} +# If CPU does not support AVX, use Qemu that supports AVX. +# Migratemongo is at https://github.com/wekan/migratemongo +# and at directory /snap/${SNAP_NAME}/current/migratemongo/avx +# is bash scripts like mongod, mongosh check avx support and use Qemu if needed. +export PATH=/snap/${SNAP_NAME}/current/migratemongo/avx:/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:${PATH} export LD_LIBRARY_PATH=/snap/${SNAP_NAME}/current/lib:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH} # If temporary settings log exists, delete it diff --git a/snap-src/bin/mongodb-restore b/snap-src/bin/mongodb-restore index d03ee19e1..b58ed37d6 100755 --- a/snap-src/bin/mongodb-restore +++ b/snap-src/bin/mongodb-restore @@ -9,7 +9,11 @@ if [ -z "$LANG" ]; then fi export LC_ALL=C -export PATH=/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH +# If CPU does not support AVX, use Qemu that supports AVX. +# Migratemongo is at https://github.com/wekan/migratemongo +# and at directory /snap/${SNAP_NAME}/current/migratemongo/avx +# is bash scripts like mongod, mongosh check avx support and use Qemu if needed. +export PATH=/snap/${SNAP_NAME}/current/migratemongo/avx:/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH export LD_LIBRARY_PATH=/snap/${SNAP_NAME}/current/lib:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH # start mongodb backup