Building a machine image for Tanzu Kubernetes Grid fails to pass checksum and the error "CalledProcessError" is generated
search cancel

Building a machine image for Tanzu Kubernetes Grid fails to pass checksum and the error "CalledProcessError" is generated

book

Article ID: 317048

calendar_today

Updated On:

Products

Tanzu Kubernetes Grid

Issue/Introduction

Symptoms:
  • While attempting to build a machine image for use with Tanzu Kubernetes Grid (TKG), you see messages similar to the following when using the docker run command:

==> vsphere: Goss validate failed
==> vsphere: Inpect mode on : proceeding without failing Packer
==> vsphere:
==> vsphere:
==> vsphere:
==> vsphere: Downloading spec file and debug info
        vsphere: Downloading Goss specs from, /tmp/goss-spec.yaml and /tmp/debug-goss-spec.yaml to current dir
==> vsphere: Executing shutdown command... 

<output truncated>

=> vsphere (shell-local): Running local shell script: /tmp/packer-shell393847398
"kubernetes_semver": "V1.20.4+vmware.1", 

==> vsphere (shell-local): Opening OVF source: ubuntu-2004-kube-v1.20.4+vmware. 1.ovf
==> vsphere (shell-local): The manifest validates
==> vsphere (shell-local): Error: SHA digest of file ubuntu-2004kube-v1.20.4+vmware. 1.ovf does not match manifest
==> vsphere (shell-local): Completed with errors
==> vsphere (shell-local): image-build-ova: cd.
==> vsphere (shell-local): image-build-ova: loaded ubuntu-2004-kube-v1.20.4+vmware. 1.4+vmware.1
⇒ vsphere (shell-local): image-build-ova: create ovf ubuntu 2004-kube-v1.20.4+vmware. 1. ovf
⇒ vsphere (shell-local): image-build-ova: creating OVA from ubuntu-2004-kube-v1.20.4+vmware. 1.ovf using ovftool
==> vsphere (shell-local): Traceback (most recent call last):
==> vsphere (shell-local): File "../../hack/image-build-ova.py"line 285, in <module>
==> vsphere (shell-local): main()
==> vsphere (shell-local): File "../../hack/image-build-ova.py", line 199, in main ⇒ vsphere (shell-local): create ova (ova, ovf
==> vsphere (shell-local): File "../../hack/image-build-ova.py", line 229, in create_ova
==> vsphere (shell-local): subprocess.check_call(args)
==> vsphere (shell-local): File "/usr/lib/python3.8/subprocess.py", line 364, in check_call => vsphere (shell-local): raise Called ProcessError(retcode, cmd)
==> vsphere (shell-local): subprocess. CalledProcessError: Command lovftool', 'ubuntu-2004-kube-v1.20.4+vmware. 1.ovt', 'ubuntu-2004-kube-v1.20.4+vmware. 1. ova'l' returned non-zero exit status 1.
==> vsphere: Running post-processor: custom-post-processor (type shell-local)
==> vsphere (shell-local): Running local shell script: /tmp/packer-shel1963615762 

Build 'vsphere' errored after 19 minutes 41 seconds: 1 error(s) occurred:



Environment

VMware Tanzu Kubernetes Grid 1.x
VMware Tanzu Kubernetes Grid Plus 1.x

Cause

The procedure in TKG 1.3 for Building Machine Images utilizes the ovftool by default. 
In this build, the manifest file containing sha256sum checksum is exported and downloaded first.  Then the ovf file is modified.  As a result, the checksum contained within the manifest does not match the final sha256sum of the ovf file.

Resolution



Workaround:
When creating your DOCKERFILE remove the IB_OVFTOOL environment variable by removing the following line from your DOCKERFILE:

ENV IB_OVFTOOL=1


Then proceed with the documented steps.