Packer Build Fails During Package Updates on EC2 (Successful on Local Machine)
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### I'm facing an issue where my Packer build process on an EC2 instance fails intermittently during specific dnf package update steps. This occurs even before all defined packages are updated. The issue does not occur when running Packer on my local machine.
#####
**Setup:**
**Packer Instance**: An EC2 instance is used to run the Packer build process. This instance can be replaced with my local machine, where the build works without issues.
**Build Instance**: A separate EC2 instance is spun up to run the actual Packer image creation process. The dnf updates occur on this instance.
_>
Important Note: The build process works successfully when executed on my local machine (Linux or Windows or MAC). The issue only arises when running packer Build command on an EC2 instance._
Problem:
The Packer build process on EC2 appears to skip ahead to the next step in my provisioner script without completing all the dnf package updates. This behavior is inconsistent and happens before all the specified packages in my script are installed or updated.
Error Messages:
> amazon-ebs.alma9: (228/535): low-memory-monitor-2.1-4.el9.x86_64. 3.4 MB/s | 35 kB 00:00
amazon-ebs.alma9: (229/535): lua-srpm-macros-1-6.el9.noarch.rpm 786 kB/s | 8.4 kB 00:00
amazon-ebs.alma9: (230/535): m17n-lib-1.8.0-13.el9.x86_64.rpm 14 MB/s | 194 kB 00:00
amazon-ebs.alma9: (231/535): m17n-db-1.8.0-16.el9.noarch.rpm 18 MB/s | 578 kB 00:00
amazon-ebs.alma9: (232/535): m4-1.4.19-1.el9.x86_64.rpm 18 MB/s | 294 kB 00:00
amazon-ebs.alma9: (233/535): mesa-filesystem-23.3.3-1.el9.alma.1. 1.0 MB/s | 9.9 kB 00:00
amazon-ebs.alma9: (234/535): mesa-libEGL-23.3.3-1.el9.alma.1.x86_ 9.6 MB/s | 126 kB 00:00
amazon-ebs.alma9: (235/535): mesa-libGL-23.3.3-1.el9.alma.1.x86_6 14 MB/s | 167 kB 00:00
amazon-ebs.alma9: (236/535): mesa-libgbm-23.3.3-1.el9.alma.1.x86_ 3.6 MB/s | 37 kB 00:00
amazon-ebs.alma9: (237/535): mesa-libglapi-23.3.3-1.el9.alma.1.x8 4.1 MB/s | 43 kB 00:00
amazon-ebs.alma9: (238/535): llvm-libs-17.0.6-5.el9.x86_64.rpm 105 MB/s | 25 MB 00:00
==> amazon-ebs.alma9: Provisioning with shell script: bench-packer-shared/scripts/worker/dependencies.sh
Expected Behavior:
I expect Packer to complete all dnf package updates specified in my provisioner script before moving on to subsequent steps. The build should not skip ahead prematurely.
Additional Information:
Packer Version: 1.9.0
OS/AMI: Alama Linuz 9 , Amazon Linux
Additional Notes:
This issue seems similar to a previously reported problem (
https://github.com/hashicorp/packer/issues/3920). However, the proposed solutions in that issue haven't fully resolved the problem in my case.
Contributor guide
Assessment
This issue has not been assessed yet.