[SERVER-3097] mongod --install uses wrong image path depending on current working directory Created: 16/May/11  Updated: 12/Jul/16  Resolved: 26/Nov/11

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 1.6.5, 1.8.1
Fix Version/s: 2.0.7, 2.1.0

Type: Bug Priority: Minor - P4
Reporter: Steven Hirschorn Assignee: Tad Marshall
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2008 x64


Issue Links:
Duplicate
is duplicated by SERVER-6046 --install on Windows uses working dir... Closed
is duplicated by SERVER-3976 Creating the service on Windows gets ... Closed
Operating System: Windows
Participants:

 Description   

In our deployment I add the <mongodb install folder>\bin folder to the System PATH environment variable to save having to change to the MongoDB folder everytime I need to use commandline tools like mongo and mongodump. When I run "mongod --install..." from a working directory anywhere but the bin folder, the installer defaults to configuring the image path of the service in the registry to "C:\windows\system32\mongod.exe" and therefore the service won't start. It's easy to fix afterwards in the registry, or to run the installer from the bin directory but the documentation doesn't make this issue clear.

Shouldn't mongod be able to find the path it is installed to and use that for the service configuration.



 Comments   
Comment by Dima Salakhov [ 20/Dec/12 ]

Haven't recorded these details. Have tried several times and cannot reproduce issue again. My apologies.

Comment by Tad Marshall [ 14/Dec/12 ]

Hi Dima,

Can you provide details?

1) The command line that you used to install the service;

2) The command line that was produced in the registry.

The copy of mongod.exe that you run should be using its own full file path to point to itself in the registry, but relative file paths used for --dbpath, --logpath and other file paths are not rewritten, so they need to be fully qualified file paths to work correctly.

Tad

Comment by Dima Salakhov [ 14/Dec/12 ]

Have this issue in version 2.2.2 Windows x64 *2008R2+

Comment by Tad Marshall [ 22/Jun/12 ]

Backported for 2.0.7.

Comment by auto [ 22/Jun/12 ]

Author:

{u'date': u'2012-06-22T07:35:38-07:00', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}

Message: SERVER-3097 – "mongod --install" uses wrong image path depending on CWD

Use GetModuleFileName() to get path of running exe.
Branch: v2.0
https://github.com/mongodb/mongo/commit/034b064a043a1ebecb29381a89a9737561729095

Comment by Tad Marshall [ 22/Jun/12 ]

Marking for backport to 2.0.7.

Comment by Tad Marshall [ 09/Jun/12 ]

Adding Backport: Yes.

Comment by Tad Marshall [ 26/Nov/11 ]

Fixed by commit 4666f1d2a538cd17c9113f0cabbfde2c3c2df2c9 .

Comment by auto [ 26/Nov/11 ]

Author:

{u'login': u'', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}

Message: SERVER-3097 – "mongod --install" uses wrong image path depending on CWD

Use GetModuleFileName() to get path of running exe.
Branch: master
https://github.com/mongodb/mongo/commit/4666f1d2a538cd17c9113f0cabbfde2c3c2df2c9

Comment by Steven Hirschorn [ 16/May/11 ]

I'm also seeing a bug similar to SERVER-1712 for a --config file path with spaces.

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