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 |
---|---|---|---|
Local Confluent Kafka sink to Mongo Atlas add failing | 2 | 577 | May 2024 |
MongoDB 5.0 local read concern | 0 | 292 | Jun 2024 |
mongosh: disable creation of ~/.mongodb/mongosh | 0 | 352 | Aug 2024 |
An invalid enumeration value M0 was specified | 1 | 104 | Sep 2024 |
Defining custom write concern is at MongoDB 5 is not working as expected | 0 | 34 | Sep 2024 |