Skip to content

qemu runner: define static mount tag for mount_cache#2023

Merged
89luca89 merged 1 commit into
chainguard-dev:mainfrom
stevebeattie:qemu_mount_tag_melange_cache
Jun 3, 2025
Merged

qemu runner: define static mount tag for mount_cache#2023
89luca89 merged 1 commit into
chainguard-dev:mainfrom
stevebeattie:qemu_mount_tag_melange_cache

Conversation

@stevebeattie

Copy link
Copy Markdown
Member

In 2c1640e ("fix: handle CACHEDIR properly (#2021)"), the qemu runner was changed to mount the host's melange-cache into the vm as a disk based overlayfs. However, when it does this, it set the mount_tag that the 9p client in the guest uses to identify what to mount as the path in the host system, based on $TMPDIR. Unfortunately, the mount_tag has a limit of 31 characters, so if $TMPDIR is set to not /tmp, this can cause failures, like it did for me:

WARN qemu: qemu-system-x86_64: -device virtio-9p-pci,id=fs101,fsdev=fsdev101,mount_tag=/home/sbeattie/tmp/melange-cache: mount tag '/home/sbeattie/tmp/melange-cache' (32 bytes) is longer than maximum (31 bytes)
ERRO failed to build package: unable to start pod: qemu: VM exited unexpectedly: exit status 1

To fix this, convert the mount_tag for the melange cache in the qemu invocation to a static tag called "melange_cache", and pass that in the 9p mount invocation.

In 2c1640e ("fix: handle CACHEDIR properly (chainguard-dev#2021)"), the qemu runner
was changed to mount the host's melange-cache into the vm as a disk
based overlayfs. However, when it does this, it set the mount_tag
that the 9p client in the guest uses to identify what to mount as
the path in the host system, based on $TMPDIR. Unfortunately, the
mount_tag has a limit of 31 characters, so if $TMPDIR is set to not
/tmp, this can cause failures, like it did for me:

```
WARN qemu: qemu-system-x86_64: -device virtio-9p-pci,id=fs101,fsdev=fsdev101,mount_tag=/home/sbeattie/tmp/melange-cache: mount tag '/home/sbeattie/tmp/melange-cache' (32 bytes) is longer than maximum (31 bytes)
ERRO failed to build package: unable to start pod: qemu: VM exited unexpectedly: exit status 1

```

To fix this, convert the mount_tag for the melange cache in the qemu
invocation to a static tag called "melange_cache", and pass that in
the 9p mount invocation.

Signed-off-by: Steve Beattie <steve.beattie@chainguard.dev>
@stevebeattie
stevebeattie requested a review from 89luca89 June 3, 2025 02:33
@89luca89
89luca89 merged commit 2e0b525 into chainguard-dev:main Jun 3, 2025
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

Successfully merging this pull request may close these issues.

2 participants