Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eehret opened this issue Sep 21, 2023 · 9 comments
Labels
bug The issue is caused by product not functioning as intended by product group

Comments

@eehret
Copy link

eehret commented Sep 21, 2023

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_ptr<dsc::desired_state_c>6. /var/lib/waagent/Microsoft.GuestConfiguration.ConfigurationforLinux-1.26.50/GCAgent/GC/libconsistency_operations.so : dsc::consistency_operations::run_consistency_impl(std::weak_ptr<dsc::desired_state_conf>7. /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)

    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

@MutemwaRMasheke MutemwaRMasheke added the bug The issue is caused by product not functioning as intended by product group label Oct 17, 2023
@MutemwaRMasheke
Copy link

We are currently looking into this! Thank you for raising it with us.

@eehret
Copy link
Author

eehret commented Feb 1, 2024

@MutemwaRMasheke
Can I get an update on this please. Thanks.

@MutemwaRMasheke
Copy link

Just published a new nxtools release with fixes for this and other Github issues. https://www.powershellgallery.com/packages/nxtools/1.4.0

Thank you for your feedback!

@gurrajatwal
Copy link
Collaborator

@eehret Please reopen if you're still seeing this issue. I wasn't able to reproduce it with nxtools 1.4.0.

@eehret
Copy link
Author

eehret commented Feb 13, 2024

@gurrajatwal Hello . This appears to still be occurring:

[2024-02-13 17:40:16.330] [PID 250367] [TID 250377] [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>Error Message: debconf: unable to initialize frontend: Dialog
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2024-02-13 17:40:16.532] [PID 250367] [TID 250377] [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>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:
[2024-02-13 17:40:16.629] [PID 250367] [TID 250377] [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>Error Message: debconf: falling back to frontend: Readline
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2024-02-13 17:40:17.729] [PID 250367] [TID 250377] [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>Error Message: debconf: unable to initialize frontend: Readline
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2024-02-13 17:40:17.729] [PID 250367] [TID 250377] [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>Error Message: debconf: (This frontend requires a controlling tty.)
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2024-02-13 17:40:17.730] [PID 250367] [TID 250377] [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>Error Message: debconf: falling back to frontend: Teletype
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2024-02-13 17:40:18.033] [PID 250367] [TID 250377] [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>Error Message: dpkg-preconfigure: unable to re-open stdin:
Message ID: OMI:MI_Result:1
Error Category: 0
Error Code: 1
Error Type:
[2024-02-13 17:52:46.080] [PID 250367] [TID 250367] [WORKER] [INFO] [5f8b1ce9-5f7c-4ff4-ac4a-dae12dd4d3bf] Stop signal received.
[2024-02-13 17:52:46.080] [PID 250367] [TID 250367] [WORKER] [ERROR] [d826de63-f5d9-44a0-a58e-60ca86a924c3] [/__w/1/s/src/dsc/gc_worker/dsc_worker.cpp:170] STOP request received, exiting ...

I believe I already pinpointed a potential solution: i.e. setting debian front end to non-interactive like the old DSC solution used to do (See above where I included the code snippet from the old DSC 'nx' solution)

Can that be implemented please? Or perhaps an additional field could be put on nxPackage to opt into non-interactive mode and/or pass additional inputs to dpkg?

When this happens the process seems to hang until it finally times out.

How do we reopen this issue?

@eehret
Copy link
Author

eehret commented Feb 13, 2024

Note: I think you can reproduce the interactive behaviour using the same 'aide' package , and by installing aide, adding a modification to /etc/aide/aide.conf , then try altering removing and re-adding the package

This appears to be what triggers the interactive behaviour from the package. There will probably be other packages that occasionally contain an interactive mode as well though, not just aide so I think if this was made to behave the way the old 'nx' solution did that would help.

@eehret
Copy link
Author

eehret commented Feb 15, 2024

@eehret
Copy link
Author

eehret commented Feb 15, 2024

@MutemwaRMasheke Hi, can you please reopen this?
I would gladly fix it myself if you would allow pull requests. Sadly it appears that you do not.

Thanks :)

@MutemwaRMasheke
Copy link

Thanks Eric, we'll continue to look into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is caused by product not functioning as intended by product group
Projects
None yet
Development

No branches or pull requests

3 participants