zsh: bad CPU type in executable: mongod
You’ve somehow installed the wrong executable, it seems.
501 43048 42112 0 11:12PM ttys000 0:00.00 grep mongo
That’s the grep
process itself searching for the string mongo
… it finds itself.
zsh: bad CPU type in executable: mongod
You’ve somehow installed the wrong executable, it seems.
501 43048 42112 0 11:12PM ttys000 0:00.00 grep mongo
That’s the grep
process itself searching for the string mongo
… it finds itself.
Do you have any suggestions on what I should do next? Thanks
@SM_A maybe you can try this:
brew
to uninstall.brew
… make entirely sure brew
itself is installed correctly for an M1.If it still doesn’t work, submit a bug report. The Forums here are more and more “community supporting community” and you’ll have better chances of getting serious attention with a well-formatted bug report if there really is a problem.
I feel for you I have a Mac, but not an M1, so I can’t try this myself.
Hmm, searching I find some stuff about using Rosetta during the install.
See this Stack Exchange question @SM_A … it’s long but it may be the answer.
Hi @SM_A,
You will need Rosetta2 emulation installed (a one-off procedure) to run MongoDB 5.0 on M1. NOTE: native M1 binaries are coming with MongoDB 6.0.
However, I expect macOS should automatically prompt you to install Rosetta rather than complaining about a bad CPU type.
Can you confirm the output of:
file $(which mongod)
sw_vers
On my M1 with a brew install of MongoDB 5.0 the file
command returns:
/opt/homebrew/bin/mongod: Mach-O 64-bit executable x86_64
You could try manually installing Rosetta 2:
softwareupdate --install-rosetta
Regards,
Stennie
Thanks @Stennie_X
I installed Rosetta. When checking mongo --version now, it looks correct. But when I check the status after running Mongo, it still shows an error:
Check your mongod.log
use brew --prefix to find your var/log location
Most likely it is failing due to permissions issues on /tmp .sock .lock files
@Ramachandra_Tummala
I see two logs in my /var/log/mongodb folder:
{“t”:{"$date":“2022-06-15T12:55:58.842Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T13:36:36.829Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T13:37:26.315Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T13:39:10.033Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T13:45:00.497Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T13:45:55.112Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T13:57:58.049Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T14:47:17.978Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
{“t”:{"$date":“2022-06-15T15:00:03.140Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open /opt/homebrew/var/log/mongodb/mongo.log”}}}
Not sure what to do with this
It is unable to create the logfile
Check the permissions on /opt/homebrew/var/log/mongodb
Your mongod should be able to write to this dir
Also the dbpath directory
@Ramachandra_Tummala
I changed the permissions to this:
But I am still getting the same mongo.log errors and installation errors
Does this directory exist?
Please show contents
Do you have any mongod.log already in that dir with different ownership/permissions
I meant mongo.log only.On other os it is named as mongod.log
So why you are not able to open/read this file?
Can you show file permissions from terminal prompt instead of explorer view
ls -lrt mongod.log
Only root user can access this file
chmod 755 mongo.log and start the service
or move the file
sudo mv mongo.log mongo.log.old
When you start your service a new file should be created owned by mongod
Thank you. I was able to see the mongo.log and see what the error was. I fixed the error and my mongodb is working now
hey , I am also facing same issue .can u plz say how u have corrected it. since I tried a lot but of no use.
Can you open your mongo.log and see the error?
Its seems like your permission issue.
Give permission or run the command using sudo. then your mongod.log
Topic | Replies | Views | Activity |
---|---|---|---|
How to host a publicly available server locally? | 0 | 614 | Apr 2024 |
I am facing issue while installing mongodb in ubuntu. Need help | 1 | 506 | Jul 2024 |
Error when trying to install mongodb-community@7.0 on macOS 11 via Homebrew | 0 | 141 | Oct 2024 |
Startup issues on Mongodb Community Edition 7.0 using TLS | 0 | 222 | Oct 2024 |
Illegal instruction (core dumped) error when running mongodb 6.0.19 amd64 in Ubuntu 22.04 x64 | 2 | 141 | Jan 6 |