[SERVER-7883] debian install fails if mongodb user already exists Created: 08/Dec/12  Updated: 11/Jul/16  Resolved: 13/Oct/13

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: None
Fix Version/s: 2.5.4

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Ernie Hershey
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-14028 mongodb-10gen debian packages do not ... Closed
Backwards Compatibility: Fully Compatible
Operating System: Linux
Participants:

 Description   

Reported in GG:
https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/k3aYsAU85ko

The Debian package is looking in /etc/passwd for user mongodb, which in my case, it doesn't find (nor do I). However, I'm peforming this installation in a rather more complex environment in which there are LDAP users defined which do not appear in /etc/passwd of course.

The solution would be to be more careful using adduser to insert the new mongodb user, something like:

id=`grep mongodb /etc/passwd`
 
if [ ! id mongodb ]; then
  adduser --system --no-create-home mongodb
  addgroup --system mongodb
  adduser mongodb mongodb
  ...

I'm sorry someone in our Ops team decided that a mongodb user would be a good idea to have, but I can't do anything about that and it shouldn't really hinder my MongoDB installation but for needing a little tighter coding in the post install/configure phase.

The solution is to hack the Debian package (DEBIAN/postinst). Ugh. I hope 10gen is listening and can offer a fix soon?

Hope this helps someone else scratching his or her head.

Russ Bateman



 Comments   
Comment by auto [ 12/Oct/13 ]

Author:

{u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}

Message: SERVER-7883 use getent to check user existence
Branch: master
https://github.com/mongodb/mongo/commit/732c43fd8786fed550b033f47372a9225f9d047c

Comment by Akshay Kumar [ 18/Mar/13 ]

Fixed for the next release. Stay tuned.

Comment by Vishal Katikineni [ 18/Mar/13 ]

I hit the same error. Any workaround for this bug ?

vkatikineni@sfdbamir-sh1-m1:/etc/init.d$ sudo apt-get install mongodb-10gen
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mongodb-10gen
0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.
Need to get 0 B/51.9 MB of archives.
After this operation, 127 MB of additional disk space will be used.
Selecting previously unselected package mongodb-10gen.
(Reading database ... 67426 files and directories currently installed.)
Unpacking mongodb-10gen (from .../mongodb-10gen_2.2.3_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up mongodb-10gen (2.2.3) ...
adduser: The user `mongodb' already exists. Exiting.
dpkg: error processing mongodb-10gen (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mongodb-10gen
E: Sub-process /usr/bin/dpkg returned an error code (1)

Comment by Vishal Katikineni [ 18/Mar/13 ]

Any update on this issue ?

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