microsoft / containers-toolkit

Containers-Toolkit is a Windows PowerShell module for downloading, installing, and setting up default configs for Containerd, BuildKit, Windows CNI plugin, and nerdctl.
MIT License
14 stars 9 forks source link

[BUG] Buildkit Installation failed. Invalid JSON format in checksum file #35

Closed xrow closed 1 week ago

xrow commented 1 month ago

Describe the bug

ndows\system32> Install-Module -Name ThreadJob -Confirm:$False -Force  -AllowClobber                                                                                                                                        WARNUNG: Die Version 2.0.3 des Moduls "ThreadJob" wird gerade verwendet. Wiederholen Sie den Vorgang, nachdem Sie die Anwendungen geschlossen haben.
PS C:\Windows\system32> $env:PSModulePath = ('{0};C:\containers-toolkit' -f $env:PSModulePath)
PS C:\Windows\system32> Import-Module -Name containers-toolkit -Force
PS C:\Windows\system32> Install-ContainerTools -Confirm:$False -Force
The following tools will be installed: containerd v1.7.20, buildkit v0.15.1, nerdctl v1.7.6
Downloading and installing Containerd v1.7.20 at C:\Program Files\Containerd
Downloading Containerd version v1.7.20
Verifying checksum for C:\Users\bjoerndieding\Downloads\containerd-1.7.20-windows-amd64.tar.gz
Extracting containerd to C:\Program Files\Containerd
Cleanup to remove downloaded files
Containerd v1.7.20 successfully installed at C:\Program Files\Containerd

Other useful Containerd commands: Get-ContainerdLatestVersion, Register-ContainerdService, Start-ContainerdService, Stop-ContainerdService, Uninstall-Containerd.
To learn more about each command, run Get-Help <command-name>, e.g., 'Get-Help Register-ContainerdService'
For containerd usage: run 'containerd -h'

WARNUNG: Buildkit already exists at C:\Program Files\Buildkit or the directory is not empty
WARNUNG: Uninstalling preinstalled Buildkit at the path C:\Program Files\Buildkit
Removing buildkit in User Environment Path
Removing buildkit in System Environment Path
Downloading and installing Buildkit v0.15.1 at C:\Program Files\Buildkit
Downloading Buildkit version v0.15.1
Verifying checksum for C:\Users\bjoerndieding\Downloads\buildkit-v0.15.1.windows-amd64.tar.gz
Install-ContainerTools : Buildkit Installation failed. Invalid JSON format in checksum file. Die Benennung "Test-Json" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms
erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:1 Zeichen:1
+ Install-ContainerTools -Confirm:$False -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ContainerTools

WARNUNG: nerdctl already exists at C:\Program Files\nerdctl or the directory is not empty
WARNUNG: Uninstalling preinstalled nerdctl at the path C:\Program Files\nerdctl

https://gitlab.com/xrow-public/helm-azure-devops-agent/-/jobs/7569610009#L128

Please file a single issue per bug instead of enumerating multiple items.

To Reproduce

Detailed steps to reproduce the behavior:

  1. run the installation steps
  2. the error will occur

The more information you can provide, the more likely someone will be successful at triaging and reproducing the issue and finding a fix.

Expected behavior

no error

Actual behavior

error on buildkit install

Screenshots

image

System information

Hostname: SURFACE-BJOERN Betriebssystemname: Microsoft Windows 11 Pro Betriebssystemversion: 10.0.22631 Nicht zutreffend Build 22631 Betriebssystemhersteller: Microsoft Corporation Betriebssystemkonfiguration: Eigenständige Arbeitsstation Betriebssystem-Buildtyp: Multiprocessor Free Registrierter Benutzer: bjoern Registrierte Organisation: Nicht zutreffend Produkt-ID: 00330-66905-91196-AAOEM Ursprüngliches Installationsdatum: 12.12.2022, 07:09:00 Systemstartzeit: 19.07.2024, 10:14:55 Systemhersteller: Microsoft Corporation Systemmodell: Surface Pro 9 Systemtyp: x64-based PC Prozessor(en): 1 Prozessor(en) installiert. 01: Intel64 Family 6 Model 154 Stepping 4 GenuineIntel ~1826 MHz BIOS-Version: Microsoft Corporation 14.101.143, 29.02.2024 Windows-Verzeichnis: C:\Windows System-Verzeichnis: C:\Windows\system32 Startgerät: \Device\HarddiskVolume1 Systemgebietsschema: de;Deutsch (Deutschland) Eingabegebietsschema: de;Deutsch (Deutschland) Zeitzone: (UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien Gesamter physischer Speicher: 32.592 MB Verfügbarer physischer Speicher: 5.329 MB Virtueller Arbeitsspeicher: Maximale Größe: 48.051 MB Virtueller Arbeitsspeicher: Verfügbar: 10.333 MB Virtueller Arbeitsspeicher: Zurzeit verwendet: 37.718 MB Auslagerungsdateipfad(e): C:\pagefile.sys Domäne: WORKGROUP Anmeldeserver: \SURFACE-BJOERN Hotfix(es): 5 Hotfix(e) installiert.

                                           [02]: KB5012170
                                           [03]: KB5027397
                                           [04]: KB5040442
                                           [05]: KB5039338

Netzwerkkarte(n): 6 Netzwerkadapter installiert. 01: Intel(R) Wi-Fi 6E AX211 160MHz Verbindungsname: WLAN DHCP aktiviert: Ja DHCP-Server: 192.168.88.1 IP-Adresse(n)

                                                 [02]: fe80::86a8:667:1eb0:e744
                                           [02]: WireGuard Tunnel
                                                 Verbindungsname: Hetzner
                                                 DHCP aktiviert:  Nein
                                                 IP-Adresse(n)
                                                 [01]: 192.168.8.10
                                           [03]: Surface Ethernet Adapter
                                                 Verbindungsname: Ethernet 2
                                                 DHCP aktiviert:  Ja
                                                 DHCP-Server:     192.168.88.1
                                                 IP-Adresse(n)
                                                 [01]: 192.168.88.249
                                                 [02]: fe80::f21a:9d00:8c5:1903
                                           [04]: Bluetooth Device (Personal Area Network)
                                                 Verbindungsname: Bluetooth-Netzwerkverbindung
                                                 Status:          Medien getrennt
                                           [05]: Fortinet Virtual Ethernet Adapter (NDIS 6.30)
                                                 Verbindungsname: Ethernet
                                                 Status:          Medien getrennt
                                           [06]: WireGuard Tunnel
                                                 Verbindungsname: imos-prod
                                                 DHCP aktiviert:  Nein
                                                 IP-Adresse(n)
                                                 [01]: 10.111.2.5

Anforderungen für Hyper-V: Es wurde ein Hypervisor erkannt. Features, die für Hyper-V erforderlich sind, werden nicht angezeigt. PS C:\Windows\system32> ```

TinaMor commented 3 weeks ago

@xrow Thank you from filing the bug.

Please confirm the PowerShell version you are using. Die Benennung "Test-Json" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt...

profnandaa commented 3 weeks ago

Could repro.

@tinamor - please check if this could have been missed line during your code refactoring. I think Test-Json turned to Test-JSONChecksum?

https://github.com/microsoft/containers-toolkit/blob/aeaf32e5ff2586b458e9afeb28165ff9651c035b/containers-toolkit/Private/CommonToolUtilities.psm1#L247

Will need to fix the tests too - https://github.com/search?q=repo%3Amicrosoft%2Fcontainers-toolkit%20Test-Json&type=code

xrow commented 3 weeks ago

ok will do nothing for now...

TinaMor commented 2 weeks ago

@profnandaa The issue is caused by: https://github.com/microsoft/containers-toolkit/blob/aeaf32e5ff2586b458e9afeb28165ff9651c035b/containers-toolkit/Private/CommonToolUtilities.psm1#L366

The cmdlet Test-JSON is only available from PowerShell version 6.1

@xrow Please provide the PowerShell version you are using.

We will add in the documentation that this module requires PowerShell version 7 and above.

xrow commented 2 weeks ago

@profnandaa

Here is a test conatiner:

https://gitlab.com/xrow-public/helm-azure-devops-agent/-/blob/main/container/agent-windows-ltsc2022/Containerfile?ref_type=heads#L15 <- powershell version 7.2.18

https://gitlab.com/xrow-public/helm-azure-devops-agent/-/blob/main/container/agent-windows-ltsc2022/Containerfile?ref_type=heads#L67 <- your tool

The prove it is 7.2.18

https://gitlab.com/xrow-public/helm-azure-devops-agent/-/jobs/7694482617#L62

TinaMor commented 1 week ago

@xrow PR to resolve this issue has been merged. Closing the issue. Please feel free to reopen this issue or file a new one if the issue has not been resolved.