google / google/googet

Windows - Installation scripts not successfully executing

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
101
Forks
51
Avg merge
17h 1m
Merged PRs (30d)
4

Description

I am having an issue with googet on a single server where it is not executing the installation script defined in the pkgspec file. As far as I can tell, it's not successfully calling powershell. If the install script is executed manually, it runs successfully.

I can repeat the issue with the following command (installation package does not matter, experience is the same regardless of package):

`googet.exe -verbose -root c:\temp\jcl\Googet install -sources https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable google-osconfig-agent `

It will extract and copy all of the files and then log:

```
INFO : 2021/06/29 15:37:12.722922 system_windows.go:76: Running install command: "packaging/googet/install.ps1"
ERROR: 2021/06/29 15:37:12.729706 googet_install.go:165: Error installing google-osconfig-agent.x86_64.20210607.00.0+win@1: open NUL: The system cannot find the file specified.
```
Again, powershell works by hand, the installation script is in the cache folder where it was extracted.

I pulled down the latest googet sources and liberally sprinkled some logging statements around the install.go and goolib.go files to see if paths, filenames, etc were being passed successfully. Here's a truncated excerpt from logging statements output from a modified googet version:

```
INFO : 2021/06/30 12:26:32.621186 system_windows.go:76: Running install command: "packaging/googet/install.ps1"
INFO : 2021/06/30 12:26:32.640718 goolib.go:59: JCL - Cleaned File Path: "c:\\temp\\jcl\\Googet\\cache\\google-osconfig-agent.x86_64.20210607.00.0+win@1\\packaging\\googet\\install.ps1"
INFO : 2021/06/30 12:26:32.656348 goolib.go:61: JCL - scriptInterpreter: "powershell"
INFO : 2021/06/30 12:26:32.668047 goolib.go:70: JCL - Powershell args: ["-ExecutionPolicy" "Bypass" "-NonInteractive" "-NoProfile" "-Command" "c:\\temp\\jcl\\Googet\\cache\\google-osconfig-agent.x86_64.20210607.00.0+win@1\\packaging\\googet\\install.ps1"]
INFO : 2021/06/30 12:26:32.682688 goolib.go:91: JCL - run c: "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -NonInteractive -NoProfile -Command c:\\temp\\jcl\\Googet\\cache\\google-osconfig-agent.x86_64.20210607.00.0+win@1\\packaging\\googet\\install.ps1"
INFO : 2021/06/30 12:26:32.698977 goolib.go:94: JCL - run ok: false
INFO : 2021/06/30 12:26:32.702705 goolib.go:95: JCL - run err: "open NUL: The system cannot find the file specified."
INFO : 2021/06/30 12:26:33.529111 install.go:157: JCL - installPkg: dst: "c:\\temp\\jcl\\Googet\\cache\\google-osconfig-agent.x86_64.20210607.00.0+win@1.goo", rs.PackageSpec: "google-osconfig-agent.x86_64.20210607.00.0+win@1", dbOnly: false
ERROR: 2021/06/30 12:26:33.534309 googet_install.go:165: Error installing google-osconfig-agent.x86_64.20210607.00.0+win@1: open NUL: The system cannot find the file specified.

```

**I strongly suspect that the issue is within the OS and/or its configuration** but it only appears that googet and other google services installed on the OS are impacted by this (e.g., OSConfig Agent service is not able to run powershell to determine installed updates). It appears to successfully hand execution to [os/exec func Run](https://golang.org/pkg/os/exec/#Cmd.Run) which then generates the error. I am somewhat at a loss as to how to troubleshoot this further. Any direction you can give would be greatly appreciated.

```
Architecture: x86_64
KernelRelease: 10.0.17763.1999
KernelVersion: 10.0.17763.1999 (WinBuild.160101.0800)
LongName: Microsoft Windows Server 2019 Datacenter
ShortName: windows
Version: 10.0.17763

```
```
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.17763.1971
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1971
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

```

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.