Losetup sporadically fails not finding all devices #162
Open
Description
I'm trying to modify a ubuntu raspberry pi base image.
It rather frequently happens that not all devices appear causing packer to fail the build.
My assumption is that there is a race condition of losetup and reading the dev devices in code again causing only some partitions to be available at the time of reading.
By looking at https://github.com/solo-io/packer-plugin-arm-image/blob/master/pkg/builder/step_map_image.go
I think adding a short sleep could stabilize on that situation. Another option would be to really read the number of partitions and retry several times until a timeout value.
What do you think ?
2023/10/05 09:39:56 Waiting on builds to complete...
==> arm-image.raspios: Image type: ubuntu
==> arm-image.raspios: Retrieving Image
2023/10/05 09:39:56 Starting build run: arm-image.raspios
==> arm-image.raspios: Trying https://cdimage.ubuntu.com/releases/22.04.3/release/ubuntu-22.04.3-preinstalled-server-arm64+raspi.img.xz
2023/10/05 09:39:56 Running builder:
2023/10/05 09:39:56 [INFO] (telemetry) Starting builder arm-image.raspios
2023/10/05 09:39:56 packer-plugin-arm-image plugin: 2023/10/05 09:39:56 Acquiring lock for: https://cdimage.ubuntu.com/releases/22.04.3/release/ubuntu-22.04.3-preinstalled-server-arm64+raspi.img.xz?checksum=sha256%3Af3842efb3be1be4243c24203bd16e335f155fdbe104b1ed8c5efc548ea478ab0 (/root/.cache/packer/5bfca20aef17229ee68f5e999c4516030d6fa7c6.iso.lock)
==> arm-image.raspios: Trying https://cdimage.ubuntu.com/releases/22.04.3/release/ubuntu-22.04.3-preinstalled-server-arm64+raspi.img.xz?checksum=sha256%3Af3842efb3be1be4243c24203bd16e335f155fdbe104b1ed8c5efc548ea478ab0
2023/10/05 09:39:59 packer-plugin-arm-image plugin: 2023/10/05 09:39:59 Leaving retrieve loop for Image
==> arm-image.raspios: https://cdimage.ubuntu.com/releases/22.04.3/release/ubuntu-22.04.3-preinstalled-server-arm64+raspi.img.xz?checksum=sha256%3Af3842efb3be1be4243c24203bd16e335f155fdbe104b1ed8c5efc548ea478ab0 => /root/.cache/packer/5bfca20aef17229ee68f5e999c4516030d6fa7c6.iso
==> arm-image.raspios: Copying source image.
==> arm-image.raspios: Image is a xz file.
arm-image.raspios: Speed: 68.95 MB/s
arm-image.raspios: Speed: 42.85 MB/s
arm-image.raspios: Speed: 46.95 MB/s
arm-image.raspios: Speed: 34.67 MB/s
arm-image.raspios: Speed: 36.76 MB/s
arm-image.raspios: Speed: 62.71 MB/s
arm-image.raspios: Speed: 44.40 MB/s
arm-image.raspios: Speed: 56.35 MB/s
arm-image.raspios: Speed: 67.80 MB/s
arm-image.raspios: Speed: 83.64 MB/s
arm-image.raspios: mapping output-arm-image/out.sdimg
==> arm-image.raspios: losetup --show -f -P output-arm-image/out.sdimg
==> arm-image.raspios: partitions: [/dev/loop18p1]
==> arm-image.raspios: error different of partitions than expected 1
2023/10/05 09:40:52 [INFO] (telemetry) ending arm-image.raspios
Build 'arm-image.raspios' errored after 56 seconds 482 milliseconds: step canceled or halted
==> Wait completed after 56 seconds 482 milliseconds
2023/10/05 09:40:52 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
==> Wait completed after 56 seconds 482 milliseconds
2023/10/05 09:40:52 machine readable: arm-image.raspios,error []string{"step canceled or halted"}
==> Builds finished but no artifacts were created.
2023/10/05 09:40:52 [INFO] (telemetry) Finalizing.
==> Some builds didn't complete successfully and had errors:
--> arm-image.raspios: step canceled or halted
==> Builds finished but no artifacts were created.
2023/10/05 09:40:53 waiting for all plugin processes to complete...
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /root/.config/packer/plugins/packer-plugin-arm-image: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
2023/10/05 09:40:53 /usr/bin/packer: plugin process exited
Metadata
Assignees
Labels
No labels