Wednesday, September 25, 2013

IMA Service Fails with the Following Events: 3989, 3634, 3614

We have run into an issue where we have Provisioning Service 6.1 and XenApp 6.5 working together. After we update the vDisk (say, for Windows Update) we run through a script that does things like the "XenApp Prep" to allow the XenApp 6.5 ready for imaging. It appears that there is a bug in the XenApp Prep that sometimes causes it to not fully get XenApp 6.5 ready for rejoining the farm. The initial symptoms I found were:

Event ID 4003
"The Citrix Independent Management Architecture service is exiting. The XenApp Server Configuration tool has not been run on this server."

I found this CTX article about it, but nothing of it was applicable.

I did procmon traces and I found the following registry keys were missing on the bad system:


A broken system missing the Status Registry key



A working system with the Status key. Note Joined is "0"

After adding the Status Registry key:
===================================
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\IMA\Status]
"EnhancedDesktopExperienceConfigured"=dword:00000001
"Provisioned"=dword:00000001
"Ready"=dword:00000001
"Joined"=dword:00000000
===================================


I tried restarting the service and the progress bar got further but then still quit. Procmon showed me this:



That is ACCESS DENIED when trying to see that registry key. It turns out that the IMAService does not have appropriate permissions to read this key. The Magic Permissions on a working box and what you need to set here looks like this:



Notice that none of the permissions are inherited and "NETWORK SERVICE" is added with full control to this key. Now when we try and start the Citrix Independent Management Architecture service we get the following errors:

eventid 3989:
Citrix XenApp failed to connect to the Data Store. ODBC error while connecting to the database: S1000 -> General error: Invalid file dsn ''
eventid 3636:
The server running Citrix XenApp failed to connect to the data store. An unknown failure occurred while connecting to the database. Error: IMA_RESULT_FAILURE Indirect: 0 Server: DSN file:
eventid 3615
The server running Citrix XenApp failed to connect to the Data Store. Error - IMA_RESULT_FAILURE An unknown failure occurred while connecting to the database.
eventid 3609
Failed to load plugin C:\Program Files (x86)\Citrix\System32\Citrix\IMA\SubSystems\ImaWorkerGroupSs.dll with error IMA_RESULT_FAILURE
eventid 3601
Failed to load initial plugins with error IMA_RESULT_FAILURE

To correct these errors the local host cache needs to be rebuilt. To fix that we need to run:
Dsmaint recreatelhc
Dsmaint recreaterade

After doing that, we can start the IMA Service and MFCOM. If instead of IMA Service starting you get the following error message:
Eventid 4007
The Citrix Independent Management Architecture (IMA) service is exiting. The DSN File could not be updated with the information retrieved from Group Policy. Error: 80000001h DSN file: mf20.dsn DSN Entry: DATABASE Policy Setting: CTXDS Confirm that the Network Service has write permissions to the DSN File.

Ensure the following registry is populated:
reg add HKEY_LOCAL_MACHINE\PE_SOFTWARE\Wow6432Node\Citrix\IMA

/v DataSourceName /t REG_SZ /d "C:\Program Files (x86)\Citrix\Independent Management Architecture\mf20.dsn"

4 comments:

Anonymous said...

Thank you very much for sharing I got the Event ID 4007 and added the DataSourceName and it worked...Thank you.

AndrewR said...

Nice work. I do get some edition errors in the event logs after adding the last key and IMA starting. But so far so good.

Anonymous said...

Thank you! I had the 4007 from a provisioned server. The registry entry was missing, as you suggested. I added it, ran both dsmaint commands, and rebooted (just restarting the mfcom service wasn't enough). That did it. Saved me. Thanks again!

Anonymous said...

Thank you. I was trying to Remove a Server from a Farm and add it back as both a Session Host and a Data Collector. I received the Event Error 4007. All I did was add the Registry Key as follows:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\IMA

DataSorceName REG_SZ C:\Program Files (x86)\Citrix\Independent Management Architecture\mf20.dsn

Also Ran DSMAINT RECREATELHC
DSMAINT RECREATERADE

Restarted the IMA Service Successfully. This information really helped.