Desktop Central Agent Issue

mtucker_
New Contributor III

We are new users to the Jamf products and I am struggling to get this one package created. It is the Mac Agent from Desktop Central. I found an article that seemed to work for others, but I cannot make it work. I know I am missing something, and I hope someone can tell me what I am missing. Here is the link.

https://community.jamf.com/t5/jamf-pro/manage-engine-desktop-central/m-p/237301

 

Here is the error I am getting.

"Installation failed. The installer reported: installer: Package name is installer: Installing at base path / installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “DC_MacAgent.pkg”.)"

 

Here is a screenshot of my package in Composer.

mtucker__1-1638813324286.png

Any thoughts on what I am missing?

Thanks,

Matt

9 REPLIES 9

mainelysteve
Valued Contributor II

What is in the pre and post install scripts I see in that screenshot? Perhaps a deprecated command or one of them is trying to create a directory or add files to one in a SIP protected area i.e. /System?

mtucker_
New Contributor III

They were part of the original vendor provided .pkg file that I converted to source.

mm2270
Legendary Contributor III

Is there a reason you converted a vendor supplied installer pkg to a source? I generally consider that to be a no-no, unless you must deconstruct what's going on in a pkg install. But if it was just for that, there are better tools to pull apart a package, like Suspicious Package and others.

Anyway I agree with @mainelysteve above. I'd like to see what's going on in those scripts, since how your Composer source is built, it's dropping an installer pkg into /Users/Shared/ and, (presumably?) doing something with it in those scripts, like running the installer. But without seeing them, we don't have a way of knowing why it's failing.

mtucker_
New Contributor III

Preinstall/postinstall scripts appear to be the same.

 

#!/bin/bash

echo "num of args"$#
echo $*

pkgfullpath=$1

targetfolder=$2

if [[ $targetfolder == *"DesktopCentral_Agent"* ]]; then
productname="DC"
elif [[ $targetfolder == *"RemoteAccessPlus_Agent"* ]]; then
productname="RAP"
else
productname="PMP"
fi

if [[ $productname == "DC" ]]; then
echo "Product name : DC"
pkgpath=${pkgfullpath%Desk*pkg}
elif [[ $productname == "RAP" ]]; then
echo "Product name : RAP"
pkgpath=${pkgfullpath%Remote*pkg}
else
echo "Product name : PMP"
pkgpath=${pkgfullpath%Patch*pkg}
fi

echo "targetfolder: "$targetfolder
echo "pkgpath: "$pkgpath

confpath=$pkgpath"serverinfo.plist"
echo "confpath: "$confpath

depfile=$pkgpath"domainname.json"

serviceplistpath="/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentservice.plist"
upgraderplistpath="/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentupgrader.plist"
dcnotifyplistpath="/Library/LaunchDaemons/com.manageengine.desktopcentral.dcnotifyservice.plist"
peruserplistpath="/Library/LaunchAgents/com.manageengine.desktopcentral.peruseragent.plist"
preloginpath = "/Library/LaunchAgents/com.manageengine.desktopcentral.prelogin.plist"


FILE=$confpath

if [ -f "$FILE" ];
then
echo "File $confpath exists"
agentbinpath=$2"/data/serverinfo.plist"
echo "binpath: "$agentbinpath

rds_log=$(defaults read /Library/DesktopCentral_Agent/data/serverinfo.plist AGENTVERSION)

if [ "${rds_log:5:3}" -le 297 ]; then
rm -f "/Library/DesktopCentral_Agent/logs/dcrds.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds0.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds1.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds2.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds3.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds4.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds5.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds6.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds7.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds8.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds9.log"
rm -f "/Library/DesktopCentral_Agent/logs/dcrds10.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds0.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds1.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds2.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds3.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds4.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds5.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds6.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds7.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds8.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds9.log"
rm -f "/Library/DesktopCentral_Agent/logs/UserLogs/dcrds10.log"
fi


cp "$confpath" "$agentbinpath"

if [[ $productname == "DC" ]]; then
cp com.manageengine.desktopcentral.dcnotifyservice.plist /Library/LaunchDaemons/com.manageengine.desktopcentral.dcnotifyservice.plist
cp com.manageengine.desktopcentral.peruseragent.plist /Library/LaunchAgents/com.manageengine.desktopcentral.peruseragent.plist
cp com.manageengine.desktopcentral.prelogin.plist /Library/LaunchAgents/com.manageengine.desktopcentral.prelogin.plist
elif [[ $productname == "PMP" ]]; then
cp pmpscripts/com.manageengine.desktopcentral.dcnotifyservice.plist /Library/LaunchDaemons/com.manageengine.desktopcentral.dcnotifyservice.plist
cp pmpscripts/com.manageengine.desktopcentral.peruseragent.plist /Library/LaunchAgents/com.manageengine.desktopcentral.peruseragent.plist
cp pmpscripts/com.manageengine.desktopcentral.prelogin.plist /Library/LaunchAgents/com.manageengine.desktopcentral.prelogin.plist
else
cp rapscripts/com.manageengine.desktopcentral.dcnotifyservice.plist /Library/LaunchDaemons/com.manageengine.desktopcentral.dcnotifyservice.plist
cp rapscripts/com.manageengine.desktopcentral.peruseragent.plist /Library/LaunchAgents/com.manageengine.desktopcentral.peruseragent.plist
cp rapscripts/com.manageengine.desktopcentral.prelogin.plist /Library/LaunchAgents/com.manageengine.desktopcentral.prelogin.plist
fi

#Change permission settings
chown root:wheel $serviceplistpath
echo "Return code of chown serviceplist:$?"

chown root:wheel $dcnotifyplistpath
echo "Return code of chown dcnotifyplist:$?"

chown root:wheel $peruserplistpath
echo "Return code of chown peruserplist:$?"

chown root:wheel $preloginpath
echo "Return code of chown preloginplist:$?"

chown root:wheel $upgraderplistpath
echo "Return code of chown upgraderplist:$?"


chmod 644 $dcnotifyplistpath
chmod 644 $peruserplistpath
chmod 644 $preloginpath
chmod 644 $serviceplistpath
chmod 644 $upgraderplistpath

launchctl load -wF $dcnotifyplistpath
echo "Return code of launchctl dcnotifyplist:$?"
launchctl load -wF $preloginpath
echo "Return code of launchctl preloginplist:$?"


chmod -R 755 $targetfolder/
chmod 774 $targetfolder/bin/consoleuser.plist
chmod -R 644 $targetfolder/logs/
chmod 755 $targetfolder/logs/
chmod -R 777 $targetfolder/data/
chmod -R 777 $targetfolder/client-data/
chmod -R 777 $targetfolder/SystemData/
chmod -R 755 $targetfolder/scripts/
chmod -R 777 $targetfolder/scripts/user
chmod -R 777 $targetfolder/history/
chmod 754 $targetfolder/logs/collectlogs.sh
chmod -R 777 $targetfolder/logs/UserLogs
chmod -R 777 $targetfolder/Software_Catalog/
chmod -R 777 "$targetfolder/bin/static/"
chmod -R 777 $targetfolder/rds/

 

chown root:staff $targetfolder/logs/collectlogs.sh
chown -R root:staff $targetfolder/ManageEngine\ Desktop\ Central\ -\ Agent.app
chown root:staff $targetfolder/logs/UserLogs/
chown -R root:staff $targetfolder/data/
chown -R root:staff $targetfolder/client-data/
chown -R root:staff $targetfolder/bin/
chown -R root:staff $targetfolder/history/
chown root:staff $targetfolder/scripts/
chown root:staff $targetfolder/scripts/computer/
chown -R :staff $targetfolder/scripts/
chown -R root:staff $targetfolder/store/
chown -R root:staff $targetfolder/SystemData/
chown -R root:staff $targetfolder/uninstall/
chown -R root:staff $targetfolder/rds/
chown -R root:staff $targetfolder/updates/
chown root:staff $targetfolder
chown -R :staff $targetfolder/logs/
chown root $targetfolder/logs/
chown root $targetfolder/logs/UserLogs

echo "calling dcconfig process to send statusupdate"

cd $targetfolder/bin

if [ -f "$depfile" ]
then
./dcconfig "script" "statusupdate" "$depfile"
else
./dcconfig "script" "statusupdate"
fi

echo "starting dcagentservice Daemon"

launchctl load -wF $serviceplistpath

echo "Return code of launchctl serviceplist:$?"


launchctl unload -wF $upgraderplistpath

echo "Return code of unload launchctl upgraderplist :$?"

# /** The below lines will be removed in future. These files were previously used and now they renamed and moved to different path.
launchctl unload -wF "/System/Library/LaunchDaemons/com.desktopcentral.dcagentupgrader.plist"

echo "Return code of launchctl to disable previous dcagentupgrader:$?"

rm -f "/System/Library/LaunchDaemons/com.desktopcentral.dcagentupgrader.plist"

echo "return code of deletion of com.desktopcentral.dcagentupgrader.plist:$?"

rm -f "/System/Library/LaunchDaemons/com.desktopcentral.dcagentservice.plist"

echo "return code of deletion of com.desktopcentral.dcagentservice.plist:$?"


launchctl unload -wF "/System/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentupgrader.plist"

echo "Return code of launchctl to disable previous dcagentupgrader:$?"

rm -f "/System/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentupgrader.plist"

echo "return code of deletion of com.manageengine.desktopcentral.dcagentupgrader.plist:$?"

launchctl unload -wF "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcagentupgrader.plist"

echo "Return code of launchctl to disable previous dcagentupgrader:$?"

rm -f "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcagentupgrader.plist"

echo "return code of deletion of com.manageegine.desktopcentral.dcagentupgrader.plist:$?"

launchctl unload -wF "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcnotifyservice.plist"

echo "Return code of launchctl to disable previous dcnotifyservice:$?"

rm -f "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcnotifyservice.plist"

echo "return code of deletion of com.manageegine.desktopcentral.dcnotifyservice.plist:$?"

rm -f "/System/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentservice.plist"

echo "return code of deletion of com.manageengine.desktopcentral.dcagentservice.plist:$?"

#**/



#//
rm -rf "$targetfolder/updates/dupserverinfo.plist"

echo "return code of deletion of $targetfolder/updates/dupserverinfo.plist:$?"


launchctl load -wF $upgraderplistpath

echo "Return code of launchctl to dcagentupgraderplist:$?"

else
echo "File $confpath file does not exists!"
exit 1
fi

echo "finished dcagent postinstallation..."
exit 0

mainelysteve
Valued Contributor II

If your clients are on recent versions of MacOS(10.15 or newer) the chunk below is probably your issue:

# /** The below lines will be removed in future. These files were previously used and now they renamed and moved to different path.
launchctl unload -wF "/System/Library/LaunchDaemons/com.desktopcentral.dcagentupgrader.plist"

echo "Return code of launchctl to disable previous dcagentupgrader:$?"

rm -f "/System/Library/LaunchDaemons/com.desktopcentral.dcagentupgrader.plist"

echo "return code of deletion of com.desktopcentral.dcagentupgrader.plist:$?"

rm -f "/System/Library/LaunchDaemons/com.desktopcentral.dcagentservice.plist"

echo "return code of deletion of com.desktopcentral.dcagentservice.plist:$?"


launchctl unload -wF "/System/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentupgrader.plist"

echo "Return code of launchctl to disable previous dcagentupgrader:$?"

rm -f "/System/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentupgrader.plist"

echo "return code of deletion of com.manageengine.desktopcentral.dcagentupgrader.plist:$?"
launchctl unload -wF "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcagentupgrader.plist"
echo "Return code of launchctl to disable previous dcagentupgrader:$?"
rm -f "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcagentupgrader.plist"
echo "return code of deletion of com.manageegine.desktopcentral.dcagentupgrader.plist:$?"
launchctl unload -wF "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcnotifyservice.plist"
echo "Return code of launchctl to disable previous dcnotifyservice:$?"
rm -f "/Library/LaunchDaemons/com.manageegine.desktopcentral.dcnotifyservice.plist"
echo "return code of deletion of com.manageegine.desktopcentral.dcnotifyservice.plist:$?"

rm -f "/System/Library/LaunchDaemons/com.manageengine.desktopcentral.dcagentservice.plist"

echo "return code of deletion of com.manageengine.desktopcentral.dcagentservice.plist:$?"

#**/

I would see if you can regenerate the agent installer if that's possible. 

I will certainly try regenerating the agent installer. 

Thank you for looking at this and for this feedback!

mtucker_
New Contributor III

The reason I converted to source is that I am unfamiliar with Jamf and that was my understanding of how to get the settings into .pkg file.

According to the vendor, I need to original .pkg and the server.plist in the same folder in order for the install to work properly. I Found the Jamf Nation article I referenced above (re-posted below) and tried to follow it. In step 2 of the article listed above, the OP says to drag the .pkg into the composer window and the only way I saw to do that was on the left hand pane. The only option that gives is to Convert to source.

 

I know I am missing something fundamental, but I am not sure what. Running the package as supplied from the vendor fails, and following the article (as I understand it) also fails. I appreciate any thoughts or feedback you might have.

 

https://community.jamf.com/t5/jamf-pro/manage-engine-desktop-central/m-p/237301

mtucker_
New Contributor III

I will say we have built a few packages without any issues, it is just the particular package that is giving us trouble.

mainelysteve
Valued Contributor II

Original vendor provided? How original are we talking here? According to a cursory Google search the agent pkg is generated from the web portal so when was that last done?