Azure / Azure/nxtools

nxPackage - Failing for packages that have interactive setup scripts; doesn't appear to be configuring non-interactive mode

Open
#43 9 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PowerShell
Stars
20
Forks
22
PR merge metrics
No merged PRs in 30d

Description

#### Details of the scenario you tried and the problem that is occurring
On Ubuntu, when trying to install a package that has some install scripts, it fails to install due to being in interactive mode.
The example below is for the 'aide' package.
Installing this used to work on the old nxPackage solution from https://github.com/microsoft/PowerShell-DSC-for-Linux/blob/master/Providers/Scripts/2.4x-2.5x/Scripts/nxPackage.py

#### Verbose logs showing the problem
Output is from gc_worker.log.
First snippet is from during the actual attempt to Set desired state:

```
[2023-09-21 15:32:23.554] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Displaying messages from the engine:
WMI channel 1
ResourceID: [nxPackage]aide_installed
Message : [vm-azam-ubuntu20]: LCM: [ End Test ] [[nxPackage]aide_installed] in 0.5578 seconds.
[2023-09-21 15:32:23.554] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Displaying messages from the engine:
WMI channel 1
ResourceID: [nxPackage]aide_installed
Message : [vm-azam-ubuntu20]: LCM: [ Start Set ] [[nxPackage]aide_installed]
[2023-09-21 15:32:23.554] [PID 412120] [TID 412121] [PSPROVIDER] [INFO] [00000000-0000-0000-0000-000000000000] getPSModulePath(). psModulePath:/var/lib/GuestConfig/Configuration/Ubuntu20-CISv301-section1-0_0_>[2023-09-21 15:32:23.657] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Activity Loading default keywords
CurrentOperation [vm-azam-ubuntu20] Get-DscResource
StatusDescription Processing
PercentComplete 0
SecondsRemaining 0
[2023-09-21 15:32:23.754] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Activity Getting module list
CurrentOperation [vm-azam-ubuntu20] Get-DscResource
StatusDescription Processing
PercentComplete 0
SecondsRemaining 0
[2023-09-21 15:32:25.556] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Activity Creating resource list
CurrentOperation [vm-azam-ubuntu20] Get-DscResource
StatusDescription Processing
PercentComplete 0
SecondsRemaining 0
[2023-09-21 15:32:25.956] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Activity Loading default keywords
CurrentOperation [vm-azam-ubuntu20] Get-DscResource
StatusDescription Processing
PercentComplete 0
SecondsRemaining 0
[2023-09-21 15:32:26.057] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Activity Getting module list
CurrentOperation [vm-azam-ubuntu20] Get-DscResource
StatusDescription Processing
PercentComplete 0
SecondsRemaining 0
[2023-09-21 15:32:28.859] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Activity Creating resource list
CurrentOperation [vm-azam-ubuntu20] Get-DscResource
StatusDescription Processing
PercentComplete 0
SecondsRemaining 0
[2023-09-21 15:33:00.757] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: debconf: unable to initialize frontend: Dialog
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:33:00.759] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: debconf: (TERM is not set, so the dialog frontend is not usable.)
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:33:00.760] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: debconf: falling back to frontend: Readline
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:33:01.157] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: debconf: unable to initialize frontend: Readline
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:33:01.158] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: debconf: (This frontend requires a controlling tty.)
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:33:01.256] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: debconf: falling back to frontend: Teletype
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:33:01.555] [PID 412120] [TID 412121] [DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [/__w/1/s/src/dsc/gc_diagnostics/dsc_logger.cpp:157] [/__w/1/s/src/dsc/engine/ConfigurationManage>Error Message: dpkg-preconfigure: unable to re-open stdin:
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2023-09-21 15:48:52.654] [PID 412120] [TID 412121] [DSCEngine] [INFO] [00000000-0000-0000-0000-000000000000] Job 9b828e5d-a002-475d-9469-01e731b29418 : Displaying messages from the engine:
WMI channel 1
ResourceID: [nxPackage]aide_installed
Message : [vm-azam-ubuntu20]: LCM: [ End Set ] [[nxPackage]aide_installed] in 1.5373 seconds.
```

And then we see the following a bit later in the same log:
```
[2023-09-21 15:50:09.520] [PID 412120] [TID 412121] [WORKER] [ERROR] [747d92a2-d9ab-4448-b715-89d62ac63394] [/__w/1/s/src/dsc/gc_worker/dsc_worker.cpp:141] Failed to Run Consistency for 'Ubuntu20-CISv301-sect>debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
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
The SendConfigurationApply function did not succeed. LCM failed to start desired state configuration manually.
, Call Stack :
1. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libgc_infrastructure.so : dsc::dsc_base_exception::dsc_base_exception(std::string)+0x23
2. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libgc_infrastructure.so : dsc::dsc_exception::dsc_exception(std::string)+0x21
3. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libgclib.so : dsc::desired_state_configuration::start_dsc_configuration(dsc::dsc_library_context&, std::string, std::s>4. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libgclib.so : dsc::desired_state_configuration::start_dsc_configuration(std::string, std::string const&, std::string, >5. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libconsistency_operations.so : dsc::consistency_operations::apply_dsc_configuration(std::weak_ptr6. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libconsistency_operations.so : dsc::consistency_operations::run_consistency_impl(std::weak_ptr7. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libconsistency_operations.so : dsc::consistency_operations::run_consistency(std::string, dsc::assignment_settings, boo>8. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libgc_operations.so : dsc::gc_operations::run_consistency(std::string, dsc::assignment_settings, bool)+0x22a
9. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/../GC/gc_worker() [0x41e2e3]
10. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/../GC/gc_worker() [0x41ece5]
11. /lib/x86_64-linux-gnu/libstdc++.so.6 : +0xd71a2
12. /lib/x86_64-linux-gnu/libpthread.so.0 : +0x8609
13. /lib/x86_64-linux-gnu/libc.so.6 : clone+0x43
```

#### Suggested solution to the issue
In the old nxScript solution, the python code included some setup to set `DEBIAN_FRONTEND` to non-interactive mode.
From lines 308-311 in https://github.com/microsoft/PowerShell-DSC-for-Linux/blob/master/Providers/Scripts/2.4x-2.5x/Scripts/nxPackage.py :
```
self.cmds['apt'][
'present'] = 'DEBIAN_FRONTEND=noninteractive apt-get % install ^ --allow-unauthenticated --yes '
self.cmds['apt'][
'absent'] = 'DEBIAN_FRONTEND=noninteractive apt-get % remove ^ --allow-unauthenticated --yes '
```

I guess this setup must be missing in the new nxtools incarnation of nxPackage.

#### The DSC configuration that is used to reproduce the issue (as detailed as possible)
```powershell
nxPackage aide_installed
{
Name = "aide"
Ensure = "Present"
}
```

#### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.