Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Profile Manager randomly pushing apps

OS X: 10.11.3

Server: 5


I have been having issues with Profile Manager on Server 5. Specifically with tasks being randomly generated with no user interaction. This wouldn't be a huge problem if it was just a few devices. But it is randomly placing tasks of entire groups, (some groups upwards of 700 devices) in the queue. I have searched high and low across the googlesphere, applesphere, and everywhere I could, with nothing specifically related to this. But after reading post after post about similar issues, I have learned a lot about profile manager over the past two days and came up with some ideas. I am posting this here in case others have the same issues.


I started by running a few commands to clear out the active tasks to see if that would fix my problem:


Clear Active Tasks:

sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_tasks WHERE completed_at IS NOT NULL"


Clear Active AND Completed Tasks:

sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "DELETE FROM library_item_tasks"


And that got the queue to clear for a bit. However, after a few minutes/hours/reboot, the queue started to fill up again.


This normally wouldn't be an issue however, it was also breaking apps on student iPads, causing them to crash upon launch. The only fix was to delete the app and re-push just the app(s) that had been broken. I get about 30 kids everyday with this issue. Mostly, one app in particular, but there has been about 10 different apps. Some are free apps, some are paid app apps.


I have tried everything including these commands:


Backup Profile Manager Database:

#!/bin/bash

sudo pg_dump -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr devicemgr_v2m0 -c -f ~/Desktop/profileManager.sql


Erase Profile Manager Database:

sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB .sh


Restore Profile Manager Database:

sudo -s

cat ~/Desktop/profileManager.sql | psql -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr devicemgr_v2m0


The same issues were happening.


So I tried to reindex the profile manager database, thinking maybe that would do something:


Reindex Profile Manager Database Index:

sudo reindexdb devicemgr_v2m0 -U _devicemgr -h /Library/Server/ProfileManager/Config/var/PostgreSQL -e


It didn't fix this problem, but it did seem to speed things up a lot on web portal load times.


Then after some more research, I decided to download the app pgAdmin3 (A postgreSQL GUI) and dig around the database to see if maybe there was a table or column or something to give me a clue.


In case you want to look around the profile manager postgresql database, you have to modify a file to allow you to access it via pgAdmin3:

You need to modify /Library/Server/ProfileManager/Config/PostgreSQL_config.plist to enable access over TCP/IP (by default, postgres only listens on a UNIX socket).


Find and edit the existing "listen_addresses=" entry, and then add the last two lines:


<string>listen_addresses=127.0.0.1</string>

<string>-c</string>

<string>port=5432</string>


You can do this in your favorite plist editor or in terminal with this command:

sudo nano /Library/Server/ProfileManager/Config/PostgreSQL_config.plist


Then reboot machine.


Launch pgAdmin3 and connect with the following credentials:

Name: devicemgr_v2m0

Host: 127.0.0.1

Port: 5432

Maintenance DB: devicemgr_v2m0

Username: _devicemgr




After digging around the db for a while, I noticed a function (_dm_mdm_target_needs_repush) that seems to be checking the "last_update_info_time", "last_auto_sync_profiles", and "first_push_time" and then push settings to the device if it fell below a threshold. Then I noticed that in the device table, a good majority of the devices didn't have a "first_push_time". It seemed odd they didn't have a first push time, considering they have all been pushed to. So my thinking was that somehow in the upgrade migration, those pieces of data never came through and it kept retrying to push every so often.


So I ran these commands:

Set device "first_push_time" to past date:

sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "UPDATE devices SET first_push_time = "2015-12-25 00:00:00'"


Set device "last_update_info_time" to past date:

sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "UPDATE devices SET last_update_info_time = "2015-12-25 00:00:00'"


I haven't had anything show up in the queue without me pushing manually since.

Mac Pro, OS X El Capitan (10.11.3), Server 5

Posted on Mar 11, 2016 12:19 PM

Reply

There are no replies.

Profile Manager randomly pushing apps

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