[Bug]: provision.system/00000005 fails on krunkit (macOS) due to unsupported fstrim
- Lingua principale
- Go
- Stelle
- 30.8k
- Fork
- 613
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### Description
### Description
Thank you for developing and producing this technology!
**Describe the bug**
When running Lima via Colima using the `krunkit` VM type (Apple Virtualization.framework / libkrun), `cloud-final.service` cascade-fails on boot.
The root cause is `provision.system/00000005`. The guest block device falsely advertises discard capabilities (`DISC-GRAN` shows `512B`), but the underlying `krunkit` hypervisor does not support the `FITRIM` ioctl. `fstrim` returns "the discard operation is not supported" (exit 1), crashing the strict `set -e` provision wrapper.
**To Reproduce**
1. Start a VM using the `krunkit` backend on macOS.
2. Check systemd state: `systemctl status cloud-final.service`
**Logs**
```text
Mar 28 15:56:57 cloud-init[799]: LIMA Executing /mnt/lima-cidata/provision.system/00000005
Mar 28 15:56:57 cloud-init[799]: fstrim: /mnt/lima-colima: the discard operation is not supported
Mar 28 15:56:57 cloud-init[799]: LIMA Exiting with code 1
```
**The Offending Code (`/mnt/lima-cidata/provision.system/00000005`)**
```bash
readlink /usr/sbin/fstrim || fstrim -a
```
Because `fstrim` is not a symlink on Ubuntu 24.04, `fstrim -a` executes, fails due to the hypervisor, and passes exit code `1` back to the boot wrapper.
**Proposed Fix**
At https://github.com/abiosoft/colima/blob/c2934d438ca8854355a2b5fae8a792f269388287/environment/vm/lima/yaml.go#L368
Absorb the hardware-level failure gracefully so it doesn't crash the provisioning stage on hypervisors lacking discard passthrough:
```bash
readlink /usr/sbin/fstrim || fstrim -a || true
```
I co-authored and validated with Gemini support.
HTH!
### Version
```
colima version 0.10.1
git commit: ed905203afdbc6fd4eae6cc301918099ff31e86e
runtime: docker
arch: aarch64
client: v29.3.1
server: v29.2.1
limactl version 2.1.0
zsh: command not found: qemu-img
```
### Operating System
- [ ] macOS Intel <= 13 (Ventura)
- [ ] macOS Intel >= 14 (Sonoma)
- [ ] Apple Silicon <= 13 (Ventura)
- [x] Apple Silicon >= 14 (Sonoma)
- [ ] Linux
### Output of `colima status`
```
INFO[0000] colima is running using Krunkit
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] docker socket: unix:///Volumes/DevStorage/colima-home/default/docker.sock
INFO[0000] containerd socket: unix:///Volumes/DevStorage/colima-home/default/containerd.sock
```
### Reproduction Steps
1. Start a VM using the `krunkit` backend on macOS.
2. Check systemd state: `systemctl status cloud-final.service`
### Expected behaviour
systemd unit `cloud-final.service` completes without error and systemctl status or state is "running".
### Additional context
_No response_
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.