Server 5.0.3 Profile Manager Migration failing

Hi,

I recently updated my server to OS X 10.10.5, so updated the Server.app to 5.0.3 (from 4.1.3) and the migration is failing at step 9, which is doing something with the knob_sets table.

I saw that 5.0.4 came out today but it has the same issue.

Any help would be greatly appreciated.

While searched for similar problems I saw that knob_sets was supposed to migrate from YAML to JSON at some point, so wondered whether my database has missed a migration somewhere along the way.


Here is the point of failure in the log:


0:: [77770] [2015/09/21 10:48:24.586] SQL Module failed at statement:

------------------------------------------------------------------------------- -------

ALTER TABLE knob_sets ALTER COLUMN dynamic_attributes SET DATA TYPE json USING (dynamic_attributes::json);

------------------------------------------------------------------------------- -------

-[PGConnection executeCSQL:] (/SourceCache/RemoteDeviceManagement/RemoteDeviceManagement-888.70/Compiled/Fra mework-Models/Postgres/PGConnection.m:365): "Postgres error 22P02 (ERROR: invalid input syntax for type json

DETAIL: Token "-" is invalid.

CONTEXT: JSON data, line 1: -...

)"

0:: [77770] [2015/09/21 10:48:24.587] Caught unhandled exception -[PGConnection executeCSQL:] (/SourceCache/RemoteDeviceManagement/RemoteDeviceManagement-888.70/Compiled/Fra mework-Models/Postgres/PGConnection.m:365): "Postgres error 22P02 (ERROR: invalid input syntax for type json

DETAIL: Token "-" is invalid.

CONTEXT: JSON data, line 1: -...

)"

0:: [77770] [2015/09/21 10:48:24.588] Migration failed at MIGRATE_00887.009 (final step is MIGRATE_00888.070)

0:: [77770] [2015/09/21 10:48:24.789] ShutdownMigrator: 2015-09-21 00:48:24 +0000

0:: [77770] [2015/09/21 10:48:24.790] BYE

Xserve, OS X Yosemite (10.10.5)

Posted on Sep 21, 2015 4:02 PM

Reply
5 replies

Sep 22, 2015 10:41 PM in response to wehimt

I was able to "correct" this.

Looking through the logs I found that the database had been renamed to "migration_failed__do_not_manually_rename__you_have_been_warned"

So I connected to that and dumped the "knob_sets" table.

One of the entries was still in YAML format, so I deleted it.

Moved Server.app to the Trash, waited for it to notice and turn everything off, and then undid the Trashing.

Launched Server.app and the migration was successful.

Had to reboot to get everything working again, but seems to be fine.

Nov 5, 2015 1:28 AM in response to wehimt

wehimt,


A more thorough approach (for those who don't know how to identify YAML in their database 😉) would be this:


sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM knob_sets WHERE library_item_id NOT IN (SELECT id FROM library_items)"


Then re-run migration with:


sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/config/migrateDB

Sep 29, 2015 11:53 AM in response to mscott_mdm

Probably best to combine this and the fix for the similar YAML-in-old-records on library_item_metadata and use these commands:


sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_metadata WHERE id NOT IN (SELECT id FROM library_items)"


sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM knob_sets WHERE library_item_id NOT IN (SELECT id FROM library_items)"


Then re-run migration with:


sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/config/migrateDB

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Server 5.0.3 Profile Manager Migration failing

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.