[SERVER-18837] Window Service doesnot start Created: 05/Jun/15  Updated: 18/Jun/15  Resolved: 18/Jun/15

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 3.0.0, 3.0.1, 3.0.2, 3.0.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sharat M R Assignee: Mark Benvenuto
Resolution: Done Votes: 0
Labels: server, service, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Window 7 64bit


Operating System: Windows
Steps To Reproduce:

1. Install mongod as a service in window with any config.
2. Try to start the mongodb service using "net start mongodb"

Participants:

 Description   

After install mongod as a service in Window 7 64bit, when trying to start the service it fails to start.

This problem starting coming in the 3.x update.

Things already done for resolving the issue:-

  • Ran the server as normal executable. The server starts normally and is working fine. (Not as a service)
  • Added config directly to service as arguments
    eg. D:\servers\db\mongodb\bin\mongod.exe --dbpath=D:\servers\db\mongodb\data --logpath=D:\servers\db\mongodb\log\mongo.log --logappend --service
    The service still fails
  • The same config checked with mongo 2.x works both as a service as well as a standalone server
  • Tired server with fresh location for data. Still fails as a service.
  • No mongo logs are recorded when the server is run as a service and it fails
  • Window returns an error
    The service is not responding to the control function.
    More help is available by typing NET HELPMSG 2186.


 Comments   
Comment by Ramon Fernandez Marina [ 18/Jun/15 ]

A service run from the CLI will run as the logged in user, whereas when run as a service it will run under the LocalSystem account. While the latter has extensive privileges, if your user has admin access it is possible to configure permissions/ACLs such that the user has all the right permissions but the LocalSystem user doesn't.

We have not been able to reproduce this on our end. You can try using different, new directories for dbpath and logpath created from Explorer (as if you're using Cygwin permissions can get messed up), and examining carefully the permissions/ACLs of all the directories involved.

Since we're not able to find evidence of a bug in the SERVER I'm closing this ticket, as the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group.

Regards,
Ramón.

Comment by Sharat M R [ 05/Jun/15 ]

I still don't understand about the permission stuff? The server runs fine when run from the CLI. How does the permission effect the running of mongod Server when run as a service and though CLI?

Comment by Sharat M R [ 05/Jun/15 ]

The output of

sc qc MongoDB

is

[SC] QueryServiceConfig SUCCESS
 
SERVICE_NAME: Mongodb
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : D:\servers\db\mongodb\bin\mongod.exe --dbpath D:\servers\db\mongodb\data --logpath D:\servers\db\mongodb\log\mongo.log --logappend
--service
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : MongoDB
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem

I did the command you suggested, the result is the same the service does not start

here is the output of sc qc after the service installation.

[SC] QueryServiceConfig SUCCESS
 
SERVICE_NAME: MongoDB
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : D:\servers\db\mongodb\bin\mongod.exe --dbpath=D:\servers\db\mongodb\data --logpath=D:\servers\db\mongodb\log\mongo.log --logappend
--service
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : MongoDB
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem

Comment by Mark Benvenuto [ 05/Jun/15 ]

To help me understand the issue, please run the follow as administrator.

sc.exe qc MongoDB

If there are no logs, then MongoDB likely cannot open the log file due to a permission issue.

Also, try installing the service as

D:\servers\db\mongodb\bin\mongod.exe --dbpath=D:\servers\db\mongodb\data --logpath=D:\servers\db\mongodb\log\mongo.log --logappend --install

Comment by Sharat M R [ 05/Jun/15 ]

It fails on step number 5 net start Mongodb

Is there any drastic change from 2.x to 3.x in windows service?
2.x works fine with the same steps and same config file
3.x fails only as a service. If i try to run 3.x with the same config file from CLI it runs as expected.

What kind of permission would be required for windows service? For Note i am running all operation under a user with admin access

Comment by Ramon Fernandez Marina [ 05/Jun/15 ]

cosmosgenius, can you please check the instructions for installing MongoDB on Windows and pinpoint at which step things fail to work?

I'm guessing a permission issue, but it could also be using the wrong syntax; have you tried using "--dbpath ..." as opposed to "--dbpath=..."? That is, replacing the "=" above with " "?

Generated at Thu Feb 08 03:48:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.