abiosoft / abiosoft/colima

[Bug]: provision.system/00000005 fails on krunkit (macOS) due to unsupported fstrim

Abierto Apto para principiantes
#1,549 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
30.8k
Forks
613
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 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_

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

The issue points to the specific file and line: environment/vm/lima/yaml.go around line 368. Examine the provision.system script generation. The fix is to modify the bash command in the generated provisioning script to make 'fstrim -a' failure non-fatal by adding '|| true'. Test by building Colima, starting a krunkit VM, and verifying cloud-final.service no longer fails.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
bash, docker, go, linux, macos, shell
Área
cli, cloud, devops, infrastructure, tooling
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
65/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.