TKG Image Builder process failed due to "Timeout (12s) waiting for privilege escalation prompt: "
search cancel

TKG Image Builder process failed due to "Timeout (12s) waiting for privilege escalation prompt: "

book

Article ID: 383888

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid Management

Issue/Introduction

Image Builder process failed with the following error message.

vsphere-iso.vsphere: TASK [sysprep : Reset hosts file] **********************************************
vsphere-iso.vsphere: fatal: [default]: FAILED! => {"msg": "Timeout (12s) waiting for privilege escalation prompt: "}
vsphere-iso.vsphere:
vsphere-iso.vsphere: PLAY RECAP *********************************************************************
vsphere-iso.vsphere: default                    : ok=97   changed=76   unreachable=0    failed=1    skipped=242  rescued=0    ignored=0
vsphere-iso.vsphere:
==> vsphere-iso.vsphere: Provisioning step had errors: Running the cleanup provisioner, if present...
==> vsphere-iso.vsphere: Clear boot order...
==> vsphere-iso.vsphere: Power off VM...
==> vsphere-iso.vsphere: Deleting Floppy image ...
==> vsphere-iso.vsphere: Destroying VM...
Build 'vsphere-iso.vsphere' errored after 52 minutes 31 seconds: Error executing Ansible: Non-zero exit status: exit status 2

Environment

Tanzu Kubernetes Grid 2.5.x

Cause

This error occurs when the timeout value is too small, and the playbook task may be terminated before it is completed.

Resolution

Increase the timeout value by using ansible.cfg.

 

0. (Option) Get a latest template - ansible.cfg from Image Builder container after kicking "docker run"

docker exec -it ${IMAGEBUILDER_CONTAINER_ID} cat ansible.cfg

 

1. Create ansible.cfg

Added timeout value (Default is 12 seconds --> 30 seconds).

# ansible.cfg
cat > ansible.cfg <<EOF
[defaults]
remote_tmp = /tmp/.ansible
display_skipped_hosts = False
timeout = 30
[ssh_connection]
pipelining = False
[galaxy]
server = https://old-galaxy.ansible.com/
EOF
chmod 777 ansible.cfg

 

2. Overwrite ansible.cfg in the Image Builder container

export ANSIBLE_CONFIG="$(pwd)/ansible.cfg:/home/imagebuilder/ansible.cfg"

# Kick Image Builder 
docker run -it --rm \
 -v ${AUTHENTICATION} \
 -v ${SOURCES} \
 -v ${ROLES} \
 -v ${TESTS} \
 -v ${CUSTOMIZATIONS} \
 -v ${METADATA} \
 -v ${ANSIBLE_CONFIG} \
 --env PACKER_VAR_FILES="tkg.json vsphere.json customizations.json" \
 --env OVF_CUSTOM_PROPERTIES=/home/imagebuilder/metadata.json \
 --env IB_OVFTOOL=1 $IMAGE_BUILDER $COMMAND

 

Additional Information