Why can’t MongoDB create users when installing Ubuntu 11.10?… here is a solution to the problem.
Why can’t MongoDB create users when installing Ubuntu 11.10?
I’m installing MongoDB on my Ubuntu 11.10 machine. Add the appropriate line to /etc/apt/sources.list (using instructions from here), I enter the following to install:
sudo apt-get install mongodb-10gen
The results are as follows:
Adding system user `mongodb' (UID 117) ... Adding new user `mongodb' (UID 117) with group `nogroup' ... useradd: cannot lock /etc/passwd; try again later. adduser: `/usr/sbin/useradd -d /home/mongodb -g nogroup -s /bin/false -u 117 mongodb' returned error code 1. 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)
I only opened other terminal windows (none of them ran any programs) and Chromium. Why might the installation fail to add users?
Solution, thanks to ‘Thomas’, comes from this resource :
Find /etc/group.lock, /etc/
passwd.lock, and /etc/shadow.lock and delete them. Make sure you only delete these files if they exist.
Once this is done, I can simply rerun the install command and it will complete successfully.