Nexus does not start with log message "Could not upgrade capabilities.xml to Kazuki"

Symptom

After upgrading to Nexus 2.8 or greater, you may notice a Nexus startup failure with the following message in the log files.

java.lang.IllegalStateException: Could not upgrade capabilities.xml to Kazuki as Kazuki already contains capabilities

Cause

Nexus 2.8 automatically migrates a configuration file at sonatype-work/nexus/conf/capabilities.xml used in earlier versions to a new capabilities storage called Kazuki. As part of this migration it moves the original file to capabilities.xml.old.

If for some reason another process creates a new capabilities.xml file in the same directory (like the default sonatype-work/nexus/conf/capabilities.xml file that Nexus 2.7 creates at startup) then Nexus 2.8 would refuse to re-do the migration, to avoid corrupting the previously migrated data, and stop.

Solution

Backing up and removing this capabilities.xml file should then allow Nexus 2.8 to start up. You can then check the capabilities panel to verify the migration.

If you want to repeat the capabilities migration then stop Nexus, remove sonatype-work/nexus/db/capabilities/capabilities.h2.db, copy the old capabilities.xml file back into the configuration directory, and restart Nexus.