Installing mongodb 5.0 on a QEMU VM

Hi, I am currently using mongo 4.4 and would like to upgrade to mongo 6.0 in the future due to this upcoming feature: https://www.mongodb.com/docs/upcoming/release-notes/6.0/#change-streams-with-document-pre--and-post-images

In the meantime, I wanted to change the version to 5.0 just to see that I am comfortable with the process when 6.0 becomes official.
Unfortunately, after the installation and when trying to run mongo I got the following error:
Illegal instruction (core dumped)

Going through some other threads I found this, stating that the VM architecture is too old.

I wanted to know if my VM also has this issue and how can I resolve it to install 5.0 (and 6.0 in the future).

Mine is as such:

sudo dmidecode -s system-manufacturer
QEMU
cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
stepping        : 7
microcode       : 0x1
cpu MHz         : 1999.993
cache size      : 16384 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave hypervisor lahf_lm cpuid_fault pti tpr_shadow vnmi flexpriority ept vpid tsc_adjust xsaveopt arat
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf
bogomips        : 3999.98
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
stepping        : 7
microcode       : 0x1
cpu MHz         : 1999.993
cache size      : 16384 KB
physical id     : 1
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave hypervisor lahf_lm cpuid_fault pti tpr_shadow vnmi flexpriority ept vpid tsc_adjust xsaveopt arat
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf
bogomips        : 3999.98
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
stepping        : 7
microcode       : 0x1
cpu MHz         : 1999.993
cache size      : 16384 KB
physical id     : 2
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave hypervisor lahf_lm cpuid_fault pti tpr_shadow vnmi flexpriority ept vpid tsc_adjust xsaveopt arat
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf
bogomips        : 3999.98
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

This is on a system that is not yet in production, so installing from scratch is also an option for me.

Tell me if any other info can be of assistance.

Thanks!

Can you use VMware virtual machine?

Hi Steven, no I cannot use a different VM type

Hi @Oded_Raiches,

As far as I’m aware, QEMU does not have full AVX instruction support yet so will not be compatible with binaries compiled for newer microarchitectures (for example, MongoDB 5.0+). A relevant tracking issue for the feature request appears to be qemu x86 TCG doesn't support AVX insns (#164) · Issues · QEMU / QEMU · GitLab.

Since you are intending to use a feature in MongoDB 6.0, I expect your options at the moment are:

Although you have ruled out the option of changing VM type, it may still be worth considering this approach to avoid the overhead of building and testing your own binary packages.

Regards,
Stennie

Hi @Stennie_X, thanks for the reply!
Looking over all the old arch tags looks a bit much, is there any straight forward instructions on how to build from sources depending on my environment?

Cheers,
Oded

Hi @Oded_Raiches,

You’ll need to match the CPU flags supported in your QEMU environment, but it looks like -march= nehalem should work:

Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.

You could also use the generic x86-64 microarchitecture:

A generic CPU with 64-bit extensions

The Build MongoDB from source link above is to the build instructions in the server repo. You’ll want to choose the right branch to match the release you are trying to build. For MongoDB 6.0 that would be the v6.0 branch: mongo/docs/building.md at v6.0 · mongodb/mongo · GitHub.

Regards,
Stennie

Hi @Stennie_X,
Still not sure this is a problem with the VM type.
Can you look again at this stack trace?

#0  0x000055eb8895489a in tcmalloc::SizeMap::Init() ()
#1  0x000055eb8895d1b7 in tcmalloc::Static::InitStaticVars() ()
#2  0x000055eb8895ec07 in tcmalloc::ThreadCache::InitModule() ()
#3  0x000055eb8895ed9d in tcmalloc::ThreadCache::CreateCacheIfNecessary() ()
#4  0x000055eb88a076b5 in tcmalloc::allocate_full_malloc_oom(unsigned long) ()
#5  0x00007f39e4801ae9 in set_binding_values (codesetp=0x0, dirnamep=<synthetic pointer>, domainname=0x7f39e350ff97 "gnutls") at bindtextdom.c:202
#6  __bindtextdomain (domainname=0x7f39e350ff97 "gnutls", dirname=0x7f39e350e1da "/usr/share/locale") at bindtextdom.c:320
#7  0x00007f39e3441c5a in ?? () from /usr/lib/x86_64-linux-gnu/libgnutls.so.30
#8  0x00007f39e3420651 in ?? () from /usr/lib/x86_64-linux-gnu/libgnutls.so.30
#9  0x00007f39e65bd8d3 in call_init (env=0x7ffdbe977478, argv=0x7ffdbe977468, argc=1, l=<optimized out>) at dl-init.c:72
#10 _dl_init (main_map=0x7f39e67d8170, argc=1, argv=0x7ffdbe977468, env=0x7ffdbe977478) at dl-init.c:119
#11 0x00007f39e65ae0ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#12 0x0000000000000001 in ?? ()
#13 0x00007ffdbe977720 in ?? ()
#14 0x0000000000000000 in ?? ()
(gdb) f 11
#11 0x00007f39e65ae0ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
(gdb) info locals
library_path = 0x0
version_info = 0
any_debug = 0
_dl_rtld_libname = {name = 0x55eb8691f270 "/lib64/ld-linux-x86-64.so.2", next = 0x7f39e67d7fe0 <newname>, dont_free = 0}
relocate_time = 13887144
_dl_rtld_libname2 = {name = 0x0, next = 0x0, dont_free = 0}
start_time = 634402465805098
tls_init_tp_called = true
load_time = 4311564
audit_list = 0x0
preloadlist = 0x0
__GI__dl_argv = 0x7ffdbe977468
_dl_argc = 1
audit_list_string = 0x0
_rtld_global = {_dl_ns = {{_ns_loaded = 0x7f39e67d8170, _ns_nloaded = 39, _ns_main_searchlist = 0x7f39e67d8428, _ns_global_scope_alloc = 0, _ns_unique_sym_table = {lock = {mutex = pthread_mutex_t = {Type = Recursive, 
            Status = Not acquired, Robust = No, Shared = No, Protocol = None}}, entries = 0x0, size = 0, n_elements = 0, free = 0x0}, _ns_debug = {r_version = 0, r_map = 0x0, r_brk = 0, r_state = RT_CONSISTENT, 
        r_ldbase = 0}}, {_ns_loaded = 0x0, _ns_nloaded = 0, _ns_main_searchlist = 0x0, _ns_global_scope_alloc = 0, _ns_unique_sym_table = {lock = {mutex = pthread_mutex_t = {Type = Normal, Status = Not acquired, 
            Robust = No, Shared = No, Protocol = None}}, entries = 0x0, size = 0, n_elements = 0, free = 0x0}, _ns_debug = {r_version = 0, r_map = 0x0, r_brk = 0, r_state = RT_CONSISTENT, r_ldbase = 0}} <repeats 15 times>}, 
  _dl_nns = 1, _dl_load_lock = {mutex = pthread_mutex_t = {Type = Recursive, Status = Not acquired, Robust = No, Shared = No, Protocol = None}}, _dl_load_write_lock = {mutex = pthread_mutex_t = {Type = Recursive, 
      Status = Not acquired, Robust = No, Shared = No, Protocol = None}}, _dl_load_adds = 39, _dl_initfirst = 0x0, _dl_cpuclock_offset = 634402465829299, _dl_profile_map = 0x0, _dl_num_relocations = 5046, 
  _dl_num_cache_relocations = 868, _dl_all_dirs = 0x7f39e67d8e20, _dl_rtld_map = {l_addr = 139886654574592, l_name = 0x55eb8691f270 "/lib64/ld-linux-x86-64.so.2", l_ld = 0x7f39e67d6e68, l_next = 0x7f39e67c58c0, 
    l_prev = 0x7f39e67c53d0, l_real = 0x7f39e67d79f0 <_rtld_global+2448>, l_ns = 0, l_libname = 0x7f39e67d8030 <_dl_rtld_libname>, l_info = {0x0, 0x0, 0x7f39e67d6ee8, 0x7f39e67d6ed8, 0x7f39e67d6e78, 0x7f39e67d6e98, 
      0x7f39e67d6ea8, 0x7f39e67d6f18, 0x7f39e67d6f28, 0x7f39e67d6f38, 0x7f39e67d6eb8, 0x7f39e67d6ec8, 0x0, 0x0, 0x7f39e67d6e68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f39e67d6ef8, 0x0, 0x0, 0x7f39e67d6f08, 0x0 <repeats 12 times>, 
      0x7f39e67d6f58, 0x7f39e67d6f48, 0x0, 0x0, 0x7f39e67d6f78, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f39e67d6f68, 0x0 <repeats 25 times>, 0x7f39e67d6e88}, l_phdr = 0x7f39e65ad040, l_entry = 0, l_phnum = 7, 
    l_ldnum = 0, l_searchlist = {r_list = 0x0, r_nlist = 0}, l_symbolic_searchlist = {r_list = 0x0, r_nlist = 0}, l_loader = 0x0, l_versions = 0x7f39e67b8300, l_nversions = 6, l_nbuckets = 17, l_gnu_bitmask_idxbits = 3, 
    l_gnu_shift = 8, l_gnu_bitmask = 0x7f39e65ad2d8, {l_gnu_buckets = 0x7f39e65ad2f8, l_chain = 0x7f39e65ad2f8}, {l_gnu_chain_zero = 0x7f39e65ad338, l_buckets = 0x7f39e65ad338}, l_direct_opencount = 0, l_type = lt_library, 
    l_relocated = 1, l_init_called = 1, l_global = 1, l_reserved = 0, l_phdr_allocated = 0, l_soname_added = 0, l_faked = 0, l_need_tls_init = 0, l_auditing = 0, l_audit_any_plt = 0, l_removed = 0, l_contiguous = 0, 
    l_symbolic_in_local_scope = 0, l_free_initfini = 0, l_rpath_dirs = {dirs = 0x0, malloced = 0}, l_reloc_result = 0x0, l_versyms = 0x7f39e65ad914, l_origin = 0x0, l_map_start = 139886654574592, 
    l_map_end = 139886656848240, l_text_end = 139886654711120, l_scope_mem = {0x0, 0x0, 0x0, 0x0}, l_scope_max = 0, l_scope = 0x0, l_local_scope = {0x0, 0x0}, l_file_id = {dev = 0, ino = 0}, l_runpath_dirs = {dirs = 0x0, 
      malloced = 0}, l_initfini = 0x0, l_reldeps = 0x0, l_reldepsmax = 0, l_used = 1, l_feature_1 = 0, l_flags_1 = 0, l_flags = 0, l_idx = 0, l_mach = {plt = 0, gotplt = 0, tlsdesc_table = 0x0}, l_lookup_cache = {
      sym = 0x7f39e65ad480, type_class = 1, value = 0x7f39e67c53d0, ret = 0x7f39e47d6110}, l_tls_initimage = 0x0, l_tls_initimage_size = 0, l_tls_blocksize = 0, l_tls_align = 0, l_tls_firstbyte_offset = 0, l_tls_offset = 0, 
    l_tls_modid = 0, l_tls_dtor_count = 0, l_relro_addr = 2266752, l_relro_size = 2432, l_serial = 0, l_audit = 0x7f39e67d7e60 <_rtld_global+3584>}, audit_data = {{cookie = 0, bindflags = 0} <repeats 16 times>}, 
  _dl_rtld_lock_recursive = 0x7f39e4bcbfd0 <__GI___pthread_mutex_lock>, _dl_rtld_unlock_recursive = 0x7f39e4bcd810 <__GI___pthread_mutex_unlock>, _dl_make_stack_executable_hook = 0x7f39e4bc8740 <__make_stacks_executable>, 
  _dl_stack_flags = 6, _dl_tls_dtv_gaps = false, _dl_tls_max_dtv_idx = 3, _dl_tls_dtv_slotinfo_list = 0x7f39e67b6000, _dl_tls_static_nelem = 3, _dl_tls_static_size = 4992, _dl_tls_static_used = 976, 
  _dl_tls_static_align = 64, _dl_initial_dtv = 0x7f39e67b7810, _dl_tls_generation = 1, _dl_init_static_tls = 0x7f39e4bc9020 <__pthread_init_static_tls>, _dl_wait_lookup_done = 0x7f39e4bc9140 <__wait_lookup_done>, 
  _dl_scope_free_list = 0x0}
_rtld_global_ro = {_dl_debug_mask = 0, _dl_osversion = 265827, _dl_platform = 0x7ffdbe9776a9 "x86_64", _dl_platformlen = 6, _dl_pagesize = 4096, _dl_inhibit_cache = 0, _dl_initial_searchlist = {r_list = 0x7f39e67bab18, 
    r_nlist = 38}, _dl_clktck = 100, _dl_verbose = 0, _dl_debug_fd = 2, _dl_lazy = 1, _dl_bind_not = 0, _dl_dynamic_weak = 0, _dl_fpu_control = 895, _dl_correct_cache_id = 771, _dl_hwcap = 2, _dl_auxv = 0x7ffdbe977550, 
  _dl_x86_cpu_features = {kind = arch_kind_intel, max_cpuid = 13, cpuid = {{eax = 132823, ebx = 16779264, ecx = 2411340323, edx = 260832255}, {eax = 0, ebx = 2, ecx = 0, edx = 0}, {eax = 132823, ebx = 0, ecx = 1, 
        edx = 739248128}}, family = 6, model = 45, xsave_state_size = 640, xsave_state_full_size = 640, feature = {1097728}, data_cache_size = 0, shared_cache_size = 0, non_temporal_threshold = 0}, _dl_x86_hwcap_flags = {
    "sse2\000\000\000\000", "x86_64\000\000", "avx512_1"}, _dl_x86_platforms = {"i586\000\000\000\000", "i686\000\000\000\000", "haswell\000", "xeon_phi"}, _dl_inhibit_rpath = 0x0, _dl_origin_path = 0x0, 
  _dl_use_load_bias = 0, _dl_profile = 0x0, _dl_profile_output = 0x7f39e65ce5dc "/var/tmp", _dl_trace_prelink = 0x0, _dl_trace_prelink_map = 0x0, _dl_init_all_dirs = 0x7f39e67d8e20, _dl_sysinfo_dso = 0x7ffdbe99c000, 
  _dl_sysinfo_map = 0x7f39e67d8710, _dl_hwcap2 = 0, _dl_debug_printf = 0x7f39e65be6a0 <_dl_debug_printf>, _dl_mcount = 0x7f39e65bfa70 <__GI__dl_mcount>, _dl_lookup_symbol_x = 0x7f39e65b8260 <_dl_lookup_symbol_x>, 
  _dl_check_caller = 0x7f39e65c0f30 <_dl_check_caller>, _dl_open = 0x7f39e65c18b0 <_dl_open>, _dl_close = 0x7f39e65c3bc0 <_dl_close>, _dl_tls_get_addr_soft = 0x7f39e65c0a90 <_dl_tls_get_addr_soft>, 
  _dl_discover_osversion = 0x7f39e65c83f0 <_dl_discover_osversion>, _dl_audit = 0x0, _dl_naudit = 0}
_dl_skip_args = 0
__pointer_chk_guard_local = 2841440123743661675

Cheers,
Oded

@Stennie_X @steven_lam1
Hi, sending this as a reminder as I didn’t see any reply for my last comment

In addition, how should I use the new march parameter for compiling from source? this did not work:

python3 buildscripts/scons.py install-core MONGO_VERSION=5.3.0 --march=nehalem
...
...
SCons Error: no such option: --march

Regards,
Oded

Preferred enabling AVX on my VMs, you can close the thread

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.