Recently I had the pleasure of migrating an OSX Lion server to Mountain Lion. It’s primary function was an MDM server for Apple devices. Basically, the upgrade process involves upgrading to Mountain Lion followed by installing the updated Lion Server app.
Primarily, my interactions with the Apple Server have been for Profile Manager functionality. In Lion, the Profile Manager utilized a PostgreSQL backend with a datastore located in /usr/share/devicemgr/backend/. iOS applications and other push to device material were located in the ‘/backend/file_store/’ directory named as their MD5 checksum equivalent. Logs for the devicemgr service were located in the ‘/backend/logs/’ directory.
In Mountain Lion Server, what used to be located in /usr/share/ is now packed into the Server Application itself. For example, the same ‘/devicemgr/backend/’ is now located at ‘/Applications/Server.app/Contents/ServerRoot/backend/file_store/’. The iOS applications and other push material are now located at ‘/var/devicemgr/ServiceData/Data/FileStore/’.
This knowledge is critical if you encounter an issue with the Profile Manager; there is not much info to go on if you have a problem. In Lion, I had seen cases where the Profile Manager would for an unknown reason delete applications I was trying to push, causing managed devices to be unable to receive the application.
In the case of Mountain Lion Server, I encountered the following issue with devices post-upgrade when trying to upload an updated version of an application.
ProfileManager <Error>: Caught unhandled exception undefined method `get_all_devices’ for nil:NilClass at …’
To me, this sounded like a nonexistent remnant of Lion was being referenced to. To some people, this might sound like a good time to reset the Profile Manager with the wipeDB.sh script. However, this would require you to rejoin all devices to the MDM. In this case, there was only a single application which the MDM was being used to deploy, so I figured I would try clearing the Postgres tables containing the application information and see what happened. After running the following commands, I was able to upload my application and push without the ‘undefined method’ error as show above.
sudo psql –U _postgres –d device_management DELETE from public.ios_applications; SELECT setval('ios_applications_id_seq', 1); DELETE from ios_application_library_item_relations; SELECT setval('ios_application_library_item_relations_id_seq', 1); /q serveradmin stop devicemgr serveradmin start devicemgr