-
Notifications
You must be signed in to change notification settings - Fork 132
I can't generate a .mof file with DSC using Rocky8.4 #814
Comments
Given that we were trying to build DSC on a newer platform (rocky8), we decided to try to build DSC from source. We followed the following guide, https://github.com/microsoft/PowerShell-DSC-for-Linux and performed the following steps:
/usr/bin/dnf config-manager --set-enabled powertools
sed -i s/SELINUX=enforcing/SELINUX=permissive/ /etc/sysconfig/selinux
wget https://github.com/PowerShell/PowerShell/releases/download/v7.1.4/powershell-7.1.4-1.centos.8.x86_64.rpm We then performed the following steps from the following online build steps: (https://github.com/microsoft/PowerShell-DSC-for-Linux#building-and-using-dsc-and-omi-from-source)
git clone https://github.com/Microsoft/PowerShell-DSC-for-Linux.git
After running the make, we get the following errors in our build: injector.cpp: In function ‘long unsigned int InjectorSetup()’: |
I am using Rocky 8 under WSL 2.0, and have I have installed the following Centos RPM's for OMI, Powershell & DSC:
https://github.com/PowerShell/PowerShell/releases/download/v7.1.4/powershell-7.1.4-1.centos.8.x86_64.rpm
https://github.com/microsoft/omi/releases/download/v1.6.8-1/omi-1.6.8-1.ssl_110.ulinux.x64.rpm
https://github.com/microsoft/PowerShell-DSC-for-Linux/releases/download/v1.2.1-0/dsc-1.2.1-0.ssl_110.x64.rpm
I have the following: LD_LIBRARY_PATH=/opt/omi/lib/:/opt/microsoft/dsc/lib
I have the following PATH=/opt/microsoft/dsc/Scripts/3.x/Scripts/:/opt/omi/Scripts/3.x/Scripts/:/opt/microsoft/powershell/7/Modules/:/opt/omi/lib/Scripts/python3/:/opt/omi/lib/Scripts/:/opt/microsoft/dsc/Scripts/python3/:/opt/omi/bin:/opt/microsoft/dsc/bin:/opt/microsoft/dsc/Scripts/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
When I try to create a DSC configuration within powershell, I run the following pwsh script:
#!/usr/bin/pwsh
Configuration Dsctestlinux
{
Import-DscResource -Module PSDesiredStateConfiguration,nx
Node "localhost"
{
nxFile ExampleFile
{
DestinationPath = "/tmp/example"
Contents = "hello world `n"
Ensure = "Present"
Type = "File"
}
}
}
Dsctestlinux
When I run this as the root user within a bash shell, I get the following output:
PSDesiredStateConfiguration\node: /root/Test_Dsc_Config.ps1:17
Line |
17 | Node "localhost"
| ~~~~
| The term 'PSDesiredStateConfiguration\nxFile' is not recognized as a name of a cmdlet, function,
| script file, or executable program. Check the spelling of the name, or if a path was included,
| verify that the path is correct and try again.
InvalidOperation: /opt/microsoft/powershell/7/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1:3745
Line |
3745 | throw $ErrorRecord
| ~~~~~~~~~~~~~~~~~~
| Errors occurred while processing configuration 'Dsctestlinux'.
In my bash install script, I am also installing the nx module via:
$(echo A | pwsh -c "Install-Module -Name nx -SkipPublisherCheck") > /dev/null
I am wanting to run DSC in a push configuration from one Rocky 8 Linux machine to a second Rocky 8 machine.
Please advise what other information you need to help resolve this issue.
Thanks!
The text was updated successfully, but these errors were encountered: