-
Notifications
You must be signed in to change notification settings - Fork 805
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
MongoDB service failed to start (unrecognized service ) #1822
Comments
ah i just saw #796, sorry for the redundancy |
Hi @wcxaaa -- you're correct about #796 , but there's another issue here, a typo in your command: The mongodb package is confusing because you do |
@aseering Much appreciated! That works! I just copied and pasted command on official guide not knowing what was going on. |
There's one more thing I've found. |
I have the same issue after following this tutorial And when I type but when I run |
@lobosan -- that tutorial unfortunately is incorrect; it has a minor typo that gives you the wrong command. (It's incorrect both for WSL and for regular Ubuntu Linux.) My previous comment contains the correct command, with the typo fixed. |
@aseering I read the whole post and I did try to do that but it didn't work for me and when I run Any other ideas? |
After researching, I solved this problem by doing: Create folders: Run command And then run the server |
Hi @lobosan . Though this way can start mongo by its "executable file, mongod", but it may not be safe and easy enough, I think. Because you have to manually start the service by this command everytime we reboot of the PC. By the way, mongo-org has already given us a config file in |
Hullo. Same issue here. |
I had the same problem with unrecognized service. I did as zealseeker suggested and started with: mongod --fork --config /etc/mongod.conf |
Ok you shouldn't have to install the script any differently other than these few changes.... and you shouldn't have to make a directory... it's super odd to have to do it this way and where the break down is occurring I do not know but i will give instructions on how to install everything correctly at this time. IMHO this is a large pile of hoo-diddy from someone and changes should be made... /rant. Oh by the way, this is where i am altering the directions from.... first I purged my mongo so I know everything is from scratch w/ this command:
So what does this do in summary? It installs mongod DB on an ubuntu 16.0.4 linux Windows subsystem... Updates it... and runs it via the start command... hope this helps someone and everything in this thread was awesome but a little verbose and not to the point which is what this summary is for. CP from this thread |
As pointed by @xtianus79 and to my surprise, on Ubuntu Xenial doing |
Alternatively, you can create the service configuration file as pointed by @maticomp in the Digital Ocean article.
|
I tried @ojoaofernandes' config but that didn't work. I got the error So I kind of hacked around it by installing both versions: apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
apt update && apt install mongodb-org #installs mongo 3.6.5
apt install mongodb # uninstalls mongo 3.6.5, installs 2.6.10
# this also installs the /etc/init.d/mongodb properly so back it up if you want, though i didn't need to
apt install mongodb-org # uninstalls mongo 2.6.10, installs 3.6.5 again
sudo service mongodb start # now works properly Windows updated with everything from windows update |
Same here; one liner:
This is the less hacky solution, but I think something is wrong with the installation as you normally should start daemon as services (*d) not the app itself (mongodb) ( which doesn't even exist on debian form what I'm seeing). Also if you went for apt-get install mongodb that's an unofficial unsupported debian version. Alternatively you can mongod --fork it but ideally it should start as daemon in init.d I'm installing it on a docker debian 9 stretch container not sure if that causes any issues. |
That one is #3286 (not specific to MongoDB) |
@therealkenc okay. I'm new to this. so can you help me out with this as so what corrections/changes i need to do? Thanks! |
After 6 hours of trying and trying, I can not for my life get MongoDB to start or run properly on Ubuntu 18 inside a docker-container on Codenvy.io. I followed xtianus79 instructions, and MongoDB did re-install and it seem to run when forced to manually start it. But it won't start and function like it suppose to. I followed to official instructions to begin with, but nothing seem to work. Help would be appreciated! I'm using Codenvy.io (Eclipse/Che)
|
honestly..iv just about had it with this why cant things be easier XD !! |
Hi folks! I'm a Senior Technical Writer at MongoDB and work with the server documentation. We were linked over to this pull, so I'm leaving a comment here. Please note that the Windows Subsystem for Linux (WSL) is not an officially supported method for installing MongoDB. While Ubuntu 12, 14, and 18 are supported operating systems, we cannot guarantee that they will function as expected through the WSL. It's worth noting that Ubuntu 18 only supports MongoDB 4.0 and later. As noted on the WSL FAQ, WSL does not guarantee functionality of all Linux applications. Many of the issues here appear to be related to trying to start MongoDB as a service. Please see this comment by @therealkenc who has some workarounds for the missing User @Mikeysax posted a gist in #796 with instructions that may work for some users. We're always happy to see people trying out MongoDB, and would encourage users looking for MongoDB support in particular to check out the MongoDB Google Group for guidance. That said, running MongoDB within the WSL compatibility layer may produce unexpected behavior that we have limited insight or control over. If you want a sandbox to play in, you can always spin up a free MongoDB Atlas cluster as a sandbox to poke around with. Alternatively, spin up a Virtual Machine running a supported OS and install MongoDB using the available instructions. One last note: Some platforms provide a |
mongodb can not start using systemctl ,but it works with /usr/bin/mongod --config /etc/mongod.conf & |
As others have noted, it's useful to let apt/aptitude install the service, then overwrite it with the mongodb-org packages. Then you just need to unmask the original service. This is how I do it (on Stretch - change repo if necessary):
Aptitude will ask for confirmation to remove the Debian version of MongoDB; answer "yes". |
I removed mongo lock file first |
It works on Ubuntu 18 as well. This is the most straight foward way I guess. |
try this, it works on MongoDB version 4.20 wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - && https://github.com/mongodb/mongo/blob/master/debian/init.d then run if not working try make sure to create ~/mongodb/db folders |
For me: This is how I solved the issues |
@Raju's solution is discussed here as well : https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-database#install-mongodb, and fortunately this script worked for me! |
@sarvjot this solution did not work for me unfortunately . sudo service mongodb start fail |
I had this problem. The So I changed the ownership from these dirs: sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb
sudo chown mongodb:mongodb /etc/mongod.conf finally just launch the service with: This work in windows 11 with WSL2 ubuntu 20.04. You can find more information in mongodb community I hope this helps to someone. |
Above doesn't work for me. I finnaly made my WSL support |
Thank you. This worked like a charm |
breif intro:
MongoDB cannot be started as a service (with an error:
mongod: unrecognized service
) but can be started manually withsudo mongod
Expected results:
Mongodb starts as a service.
Actual results (with terminal output if applicable)
Your Windows build number
15058
Steps / All commands required to reproduce the error from a brand new installation
-- Install mongodb following the official ubuntu guide
-- run
sudo service mongod start
Strace of the failing command
sudo service mongod start
Required packages and commands to install
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
sudo echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
The text was updated successfully, but these errors were encountered: