0

I have a fairly archaic webapp setup that relies on MongoDB running on a server with Debian 8.5. Unfortunately MongoDB was recently upgraded on the server and the application broke. MongoDB was upgraded to version 2.4.10 which gives this error on startup

    need to upgrade database admin with pdfile version 4.22, new version: 4.5

When I try to run upgrade the admin database, I get

    error: exception cloning object in admin.system.users system.users entry must have either a 'pwd' or a 'userSource' field, but not both

Basically I can't upgrade the database. I've tried repairing the database and that doesn't work either. It seems like the problem may be caused by having duplicate users in the database. One potential solution is to remove the duplicates, but because mongod won't run, I'm not sure how to do that.

I tried downgrading mongodb via apt, but was unable to find a version that apt recognized. For example

 sudo apt-get install mongodb=2.2.7

yields

    E: version '2.2.7' for 'mongodb' was not found

After googling around, it seems that mongodb 2.6 might not have the same problem, unforunately I can't get apt to install anything newer than what it currently has, 2.4.10. I've run apt-get update, but apt-cache policy shows that the candidate is the same as the installed version.

Basically it seems like there are three ways that I could get this site up and running again.

  • Successfully upgrade the admin database so that it works with the version of MongoDB that was recently installed.
  • Downgrade MongoDB to 2.2.7
  • Upgrade MongoDB to 2.6.x

Anyone know how I can get any of those things to happen?

  • Use a snapshot. I'll flesh this out into a proper answer later... – Stephen Kitt Sep 11 '16 at 7:56
0

I would highly recommend using something more recent than either 2.2 or 2.4 - they are ancient in MongoDB terms and stopped receiving updates a long time ago at this point. The reason why you cannot find a newer version to install is that the official Debian packages lock in a major version for the entire release of the OS. Unfortunately, Debian OS releases lag MongoDB major versions a lot, and they don't always even take the latest version available even when a Debian release happens.

To get a more modern version of MongoDB you need to use the official MongoDB repos instead - here is the 2.6 version which is itself pretty old at this point. You can still pin a version though, so you can control what and how you upgrade, which is a nice option to have. You can also get an older 2.2 version in a similar way.

To fix the admin database error, you have 3 options (in brief):

  1. Downgrade to 2.2.X (see above) and remove the duplicate entries, then re-upgrade
  2. Upgrade to 2.6+ and see if that solves your problem
  3. Start MongoDB with authentication disabled (temporarily) and see if you can remove the duplicate entries in the admin database, restart normally

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.