Fixing Unifi Controller Errors

Recently I was working on a device that for the life of me I could not get to attach to my Unifi Controller. Repeatedly I would get

used default key in INFORM_ERROR state, reject it!

error on my server. The other error that I kept getting on the device itself was

Decrypt Error

when running the Inform Command.

Quite frustrated I spent a lot of time removing and adding my SSL certificate thinking that had something to do with it. I was wrong.

The real issue resides when someone deletes a whole site without removing the devices that are inside the site first. What happens is that the devices stay in the database and have a site associated with them that no longer exists. This results in me not being able to adopt them into a new site.

So Let’s Fix It

To resolve this issue we need to delete the device out of the controller by accessing the MongoDB that stores all of our information. While most of you are probably more fluent in writing Mongo queries and thus could do it from the command line I prefer to find a GUI solution so that I could understand what I am doing.

Enter Robo 3T. This is a GUI connector for MongoDB.  Depending on your setup you will need to modify your connection type. I used SSH with my private key.

Once connected you should see a list of your databases in the left column.

The Unifi Database (unless you changed it) will be called ace. Go ahead and expand out Ace and then Collections to display all your sites information. You will see a tabled called “device”. This table stores all the specific information about our devices and how they are programmed.

We now need to find our specific device so using the built in shell in Robo 3T run the following query replacing the X’s with your MAC Address.

db.device.find({ 'mac' : 'XX:XX:XX:XX:XX:XX' })

The MAC address string must be all lower case.

NOTE: Please backup your database before you do any of the following!

Once you find your device, verify that the MAC address does, in fact, match your device.

Right click on the ObjectID block. Should look something like this:

In the right click menu you can choose to Delete the document. This will permanently remove the device from your controllers database.

Once you have deleted the Document run your Inform command again and it your device should populate into your controller like normal!

If you have any questions let me know!

Leave a comment

Your email address will not be published. Required fields are marked *