Skip to content

Commit 76e41c9

Browse files
committed
qemu-img hang on arm64
1 parent 2d5401e commit 76e41c9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

builder/qemu/chroot/step_compress_image.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package chroot
33
import (
44
"context"
55
"fmt"
6+
"runtime"
67

78
"github.com/hashicorp/packer-plugin-sdk/multistep"
89
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
@@ -19,8 +20,15 @@ func (s *StepCompressImage) Run(_ context.Context, state multistep.StateBag) mul
1920

2021
ui.Say("Compressing image...")
2122

22-
if _, err := RunCommand(state, fmt.Sprintf("qemu-img convert -f raw -O qcow2 -c %s %s", rawImage, imagePath)); err != nil {
23-
return Halt(state, err)
23+
if runtime.GOARCH == "arm64" {
24+
// https://bugzilla.redhat.com/show_bug.cgi?id=1969848
25+
if _, err := RunCommand(state, fmt.Sprintf("qemu-img convert -m 1 -f raw -O qcow2 -c %s %s", rawImage, imagePath)); err != nil {
26+
return Halt(state, err)
27+
}
28+
} else {
29+
if _, err := RunCommand(state, fmt.Sprintf("qemu-img convert -f raw -O qcow2 -c %s %s", rawImage, imagePath)); err != nil {
30+
return Halt(state, err)
31+
}
2432
}
2533

2634
return multistep.ActionContinue

0 commit comments

Comments
 (0)