Occasional VM boot timeout on Apple Silicon Macs
After running:
sudo linsk run dev:/dev/disk4 vdb1
The output is:
time=2024-08-14T10:57:35.314+08:00 level=WARN msg="Using raw block device passthrough. Please note that it's YOUR responsibility to ensure that no device is mounted in your OS and the VM at the same time. Otherwise, you run serious risks. No further warnings will be issued." caller=vm
time=2024-08-14T10:57:35.320+08:00 level=INFO msg="Booting the VM" caller=vm
time=2024-08-14T10:58:05.321+08:00 level=WARN msg="A VM boot timeout detected, consider running with --vm-debug to investigate" caller=vm
time=2024-08-14T10:58:05.321+08:00 level=WARN msg="Canceling the VM context" caller=vm
time=2024-08-14T10:58:05.334+08:00 level=ERROR msg="Failed to start the VM" error="vm boot timeout (serial log: '[2012 chars trimmed]n X24 0x000000003FFFFFFF X25 0x0000000000000000 X26 0x00000000BCAA0000 X27 0x0000000000000002\\n X28 0x00000000BFD3D020 FP 0x00000000476BA8A0 LR 0x00000000BFD37E08 \\n\\n V0 0x0000000000000000 0000000000000000 V1 0x0000000000000000 0000000000000000'); run vm login handler: context canceled (qemu stderr log: 'qemu-system-aarch64: terminating on signal 15 from pid 45518 (<unknown process>)')"
It did run initially, but then I CTRL+C to terminate it, and when I ran again this happened. I already tried linsk clean and linsk build again.
I noticed that this is intermittent. I might need to run it five or six times to get one successful run.
Is there a way to increase the timeout duration, because the VM might just need more time to boot up?
Hello @majal. Apologies for the delayed response.
This is a known bug I encountered myself while using Linsk on Apple Silicon Macs. Unfortunately, this appears to be a QEMU bug. There is not much I can do about it.
There is a --vm-os-up-timeout flag; however, it won't change anything as it's an issue with boot process on QEMU's end. I speculate that it is a data race given its random nature.
I see. Thank you for the response. We'll probably have to wait for qemu to fix their problem with Silicon Macs.
In the meantime, this is my one-liner workaround for now:
c=0; while :; do echo; echo ">>> Run: $((++c))"; echo; sudo linsk run dev:/dev/disk4 vdb1 && break; done
On average, it takes about 20 seconds for the VM to boot, and it takes me between 4 to 8 failed runs before getting a successful one. This is on Apple M3 by the way.
Thanks for sharing, @majal!
Linsk looks fantastic but I'm running into the same problem, and haven't managed to launch the VM once. Do we know if there's an open bug report with QEMU ?
I ran into the same problem on mine with Apple M3.
I updated constants/image.go, to grab alpine 3.20 instead of 3.18 (as qemu is much older on 3.18), and it now works fine everytime.
@maxou2600 Thanks for letting us know! Would you be open to making a quick PR?
Fixed in https://github.com/AlexSSD7/linsk/pull/29 (thanks @maxou2600!).
@majal @renaudguerin If convenient, it would be great if you could try out the latest master and see if the issue persists.
Hi @AlexSSD7! I can confirm that this is no longer an issue. Will close this issue now.
Thank you @AlexSSD7 and @maxou2600 for the work you put in this.
Confirmed working here as well !