kraftkit icon indicating copy to clipboard operation
kraftkit copied to clipboard

[CLI] Qemu error on long unix socket path while using `kraft run`

Open Guikingone opened this issue 10 months ago โ€ข 4 comments

Describe the bug

Hi ๐Ÿ‘‹๐Ÿป

When using the kraft run command locally, it seems that when the Qemu path generated can trigger an error if the path is longer than 104 bytes:

โšกโžœ http-php8.2 (๎œฅ main) kraft run -p 8080:80 unikraft.org/nginx:latest
 W  using hardware emulation
[?] multiple runnable contexts discovered: how would you like to proceed? run the cwd's Kraftfile and use 'unikraft.org/nginx:latest' as arg(s)
 i  use --as=kraftfile-runtime to skip this prompt in the future
[+] building rootfs... done!                                                                                                                                                                                                 x86_64 [0.8s]
 E  could not start and wait for QEMU process: qemu-system-x86_64: -qmp unix:/Users/__USERNAME__/.local/share/kraftkit/runtime/37a7691a-d402-4760-b493-692bb8d0460a/qemu_control.sock,server,nowait: UNIX socket path '/Users/__USERNAME__/.local/share/kraftkit/runtime/37a7691a-d402-4760-b493-692bb8d0460a/qemu_control.sock' is too long
Path must be less than 104 bytes
exit status 1

The hardware emulation is found and the process seems to be ready to launch but Qemu seems to don't like too long path, is there any way to change the maximum bytes allowed in the path of maybe change the path where the socket is created?

Thanks again for the help and have a great day ๐Ÿ™‚

PS: For more informations, I'm on mac M1 chip.

Steps to reproduce

  • Install the Kraft CLI
  • Run kraft run -p 8080:80 unikraft.org/nginx:latest

Expected behavior

No response

Which architectures were you using or does this bug affect?

arm64

Which operating system were you using or does this bug affect?

macOS

Relevant log output

Didn't found any way to obtain more logs even with `--log-level`.

Guikingone avatar Apr 18 '24 17:04 Guikingone

Hey @Guikingone, thanks for the report. This is not a fun error, because the best we can do here is shorten one of the intermediate directories (the UUID) to the machine name.

For now, a temporary mitigation for you is to update the runtime_dir in the KraftKit config file (located at ~/.config/kraftkit/config.yaml) to something shorter, e.g. /Users/__USERNAME__/.kraftkit/).

I'll contact the QEMU folks to see if this issue has been solved in a newer version or whether it's still an issue that can be resolved. I know they're busy preparing v9 at the moment.

nderjung avatar Apr 18 '24 18:04 nderjung

I have opened up an issue on QEMU's issue tracker: https://gitlab.com/qemu-project/qemu/-/issues/2292

nderjung avatar Apr 18 '24 18:04 nderjung

Hi @nderjung ๐Ÿ‘‹๐Ÿป

Thanks for the fast feedback, updating the path seems to allow to launch the machines, I'm facing some issues regarding the platform but it resolve the main issue here, thanks ๐Ÿ™‚

Guikingone avatar Apr 19 '24 06:04 Guikingone

@Guikingone no problem. There are some replies with more information on the QEMU issue; looks like it's OS specific. Maximum is roughly 108 characters.

One of the things we're contemplating is changing the runtime_dir to something like /var/lib/unikraft/; but this would require updating install scripts, documentation, permission checks, etc.

nderjung avatar Apr 19 '24 08:04 nderjung