SyntaxHighlighter JS

2021-07-02

Packer and package installs

Problem: 
When using Packer to generate an Ubuntu AWS AMI, I use a shell script provisioner to install and update packages via apt-get. When executing apt commands in the script, I was getting the errors such as: 
"Package has no installation candidate"
"Unable to locate package" 

 Solution: 
The error in the shell script was that I was executing apt-get commands before the AWS cloud-init completed.

To check that cloud-init finished before running apt-get, modify the script via

while [ ! -f  /var/lib/cloud/instance/boot-finished ];
do
    echo "Waiting for cloud-init to finish ..."
    sleep 2
done

apt-get update -y
apt-get install -y package

3 comments:


  1. Staying updated on worldwide developments is simple with ThankNews, where accurate reporting and smart insights provide reliable context. The platform’s global coverage and real-time updates make it an essential resource for informed readers.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Innovation in functional apparel is explored thoroughly on TechHunterMagazine, where articles analyze cultural impact and technological developments. The platform helps readers understand the evolving landscape of wearable technology and its practical applications.

    ReplyDelete