Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Losetup sporadically fails not finding all devices #162

Open
cleanerx opened this issue Oct 6, 2023 · 0 comments
Open

Losetup sporadically fails not finding all devices #162

cleanerx opened this issue Oct 6, 2023 · 0 comments

Comments

@cleanerx
Copy link
Contributor

cleanerx commented Oct 6, 2023

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
thomasmerx added a commit to thomasmerx/packer-plugin-arm-image that referenced this issue Jun 11, 2024
This fixes issue solo-io#162 and solo-io#165. I refactored the timeout handling,
with solo-io#169 by increasing the existing timeout and removing the additional 2 sec
sleep, because the 2 sec sleep was not working in all cases.
Unfortunately, the increase alone is not sufficient, so I'm re-adding
the 2 sec sleep again.
yuval-k pushed a commit that referenced this issue Jul 25, 2024
This fixes issue #162 and #165. I refactored the timeout handling,
with #169 by increasing the existing timeout and removing the additional 2 sec
sleep, because the 2 sec sleep was not working in all cases.
Unfortunately, the increase alone is not sufficient, so I'm re-adding
the 2 sec sleep again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant