Azure / nxtools

Azure Automanage Machine Configuration Linux DSC resources
Other
13 stars 11 forks source link

nxPackage - On Ubuntu 20.04 LTS, seems to be unable to install package that should be present #42

Closed eehret closed 11 months ago

eehret commented 11 months ago

Details of the scenario you tried and the problem that is occurring

I have a system running Ubuntu 20.04 on which I expect the 'aide-common' package to be present. Rather than installing the package that is missing, I'm getting a low level error and the entire configuration (all resources in it) fail to evaluate to report individual compliance results on each resource.

Verbose logs showing the problem

At a high level, when I click on the report under Guest Assignments in Azure Portal, I see a high level reason for non-compliance as "GuestConfig agent failed to deploy assignment." There are no details about each resource.

I don't know how to force Guest Configuration agent to do verbose logging on the target system, but here's what I am seeing so far:

[2023-09-21 11:52:10.455] [PID 311321] [TID 311322] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:5991] Job d870ca6f-93d2-4682-8d72-441c60439b73 : MIResult: 1
Error Message: dpkg-query: package 'aide-common' is not installed and no information is available
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 11:52:10.457] [PID 311321] [TID 311322] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:5991] Job d870ca6f-93d2-4682-8d72-441c60439b73 : MIResult: 1
Error Message: Use dpkg --info (= dpkg-deb --info) to examine archive files.
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 11:52:11.154] [PID 311321] [TID 311322] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:5991] Job d870ca6f-93d2-4682-8d72-441c60439b73 : MIResult: 1
Error Message: InvokeDscResource() failed. errorMessage:The PowerShell DSC resource with className:nxPackage moduleName:nxtools moduleVersion:1.2.0 threw one or more non-terminating errors, while running the Get-DscResource functionality
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 11:52:11.156] [PID 311321] [TID 311322] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job d870ca6f-93d2-4682-8d72-441c60439b73 : Displaying messages from the engine:
         WMI channel 1
         ResourceID: [nxPackage]aide_common_installed
         Message : [vm-azam-ubuntu20]: LCM:  [ End    Test     ]  [[nxPackage]aide_common_installed]  in 0.4437 seconds.
[2023-09-21 11:52:11.156] [PID 311321] [TID 311322] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ca/CAInfrastructure/CAEngine.c:1437] Job d870ca6f-93d2-4682-8d72-441c60439b73 : This event indicates that failure happens when LCM is processing the configuration. Error Id is 1. Error Detail is The SendConfigurationApply function did not succeed.. Resource Id is [nxPackage]aide_common_installed and Source Info is /home/azops.eric.ehret/azam/Ubuntu20/Ubuntu20_04_LTS_CISv201_Section1.ps1::1789::5::nxPackage. Error Message is The PowerShell DSC resource with className:nxPackage moduleName:nxtools moduleVersion:1.2.0 threw one or more non-terminating errors, while running the Get-DscResource functionality.
[2023-09-21 11:52:11.156] [PID 311321] [TID 311322] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:5991] Job d870ca6f-93d2-4682-8d72-441c60439b73 : MIResult: 1
Error Message: The PowerShell DSC resource with className:nxPackage moduleName:nxtools moduleVersion:1.2.0 threw one or more non-terminating errors, while running the Get-DscResource functionality
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 11:52:11.255] [PID 311321] [TID 311322] [DSCEngine] [WARNING] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:4615] Job d870ca6f-93d2-4682-8d72-441c60439b73 : Displaying messages from built-in DSC resources:
         WMI channel 1
         ResourceID:
         Message : [vm-azam-ubuntu20]:                            [] Consistency check completed.
[2023-09-21 11:52:11.255] [PID 311321] [TID 311322] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job d870ca6f-93d2-4682-8d72-441c60439b73 : Method CallConsistencyEngineInternal ended successfully
[2023-09-21 11:52:11.255] [PID 311321] [TID 311322] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c:6044] Job d870ca6f-93d2-4682-8d72-441c60439b73 : MIResult: 1
Error Message: The SendConfigurationApply function did not succeed. LCM failed to start desired state configuration manually.
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:

Suggested solution to the issue

I'm not sure what the fix is but it would be great if it would simply report compliance on each resource, which it is currently not doing, it's just crashing and failing to report compliance of any of the resources, just showing the entire configuration as a whole as non-compliant. And of course it would be good if it would install the package that we need it to install :)

The DSC configuration that is used to reproduce the issue (as detailed as possible)

The first item below is the one I get the error on but I wanted to point out that I'm intentionally setting up a dependency chain here using DependsOn. I'm not sure if that's maybe the reason this is breaking.

    nxPackage aide_common_installed
    {
      Name = "aide-common"
      Ensure = "Present"
    }
    nxPackage aide_installed
    {
      Name = "aide"
      Ensure = "Present"
      DependsOn = "[nxPackage]aide_common_installed"
    }

The operating system the target node is running

Ubuntu 20.04 LTS

Version and build of PowerShell the target node is running

7.3.6

Version of the DSC module that was used

1.2.0

eehret commented 11 months ago

Additional information:

I found a process that has attempted to execute the command: apt-get install --quiet --yes aide-common It seems to have been hung for a long time and isn't finishing. Still investigating.

eehret commented 11 months ago

I suspect this may have been a mistake I made on my end. Made a change and am retesting. I'll close this if I confirm it was an issue on my end.