Markdown Table of Contents Generator Basic Internet Security

MongoDB Update Nightmare

13 May 2014

So I was upgrading mongodb from 2.4 to 2.6, I possibly made a few errors by

  1. deciding to replace the apt-get version with a version from source
  2. deciding to do this in the first place

After trying to find a definitive version, which was odd as mongo is distributing over an https URL that wasn't actually serving a cert.. but changing the URL to http fixed that, I replaced mongod/mongo/mongodump/mongorestore and tried it out, as the docs say its a drop in replacement.

That didn't go well, and i got a lot of complaints about my init.d/mongodb, at which point it suggested i convert to an UpStart script, so i did that, which didn't go well. once that was done, the script just didn't start at all.

That config file, prevented me from uninstalling, purging, or reinstalling via apt-get, very frustrating.

Eventually I fired off this batch of commands

sudo apt-get purge mongo*
sudo apt-get autoremove
sudo rm /etc/init.d/mongodb
sudo touch /etc/init.d/mongodb
apt-get -o Dpkg::Options::="--force-confmiss" install mongodb-org
sudo apt-get install mongodb-org

So it was a combination or purge/removing, then faking out the init.d script, causing apt-get to overwrite it, then reinstalling.

I don't know why apt-get is so hung up on the init.d scripts, after uninstalling, it would still complain that it couldn't uninstall, because it couldn't start via that script...

After all that the startup would fail with

/etc/init.d/mongodb: 78: /etc/init.d/mongodb: grep: not found
* The user mongodb, required to run MongoDB does not exist.
invoke-rc.d: initscript mongodb, action "start" failed.

(this happend 1000 times)

Which had me foxed, thinking it was a user issue, but really it was a path issue, as the script couldn't find grep. !?

So a symlink later, that was solved, then the same thing happened with cat..

And then!

/etc/init.d/mongodb: 124: /etc/init.d/mongodb: start-stop-daemon: not found
   ...fail!

I was onto it's tricks by now though, and a symlink for start-stop-daemon fixed us up.

finally

$sudo /etc/init.d/mongodb start
 * Starting database MongoDB
   ...done.
$ ps -ef | grep mongo
mongodb   6759     1  0 21:22 ?        00:00:00 /usr/bin/mongod -f /etc/mongodb.conf run

$ mongo --version
MongoDB shell version: 2.6.1

This was exceptionally no fun.