lima-vm / lima-vm/lima

Linux distribution detection is unreliable

Open
#983 6 comments 0 reactions 0 assignees View on GitHub
enhancement guest/opensuse
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

### Description

It looks like the linux distribution detection is solely relying on the presence of a distro specific package manager like apt, dnf, or zypper. [Here is the package installation file.](https://github.com/lima-vm/lima/blob/master/pkg/cidata/cidata.TEMPLATE.d/boot/30-install-packages.sh)

This approach will and does fail due to the fact that package managers can be installed on every distribution.
Take for example this template.
```yaml
# This example requires Lima v0.7.0 or later
images:
- location: https://download.opensuse.org/ports/aarch64/tumbleweed/appliances/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.qcow2
arch: "aarch64"
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
```

This image has both apt and zypper installed. While both package managers work somewhat reliably, feature parity can't be expected between distributions. With the code above it leads to following command being executed on the openSUSE guest.
```bash
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-upgrade --no-install-reccomends -q uidmap iptables sshfs fuse3 dbus-user-session
```
Which fails with the following result
```bash
The flag --no-upgrade is not known.
```
Due to this, dependencies won't get installed and limas startup sequence times out.

I'd like to propose to implement the distribution detection based on the[ `/etc/os-release`](https://www.freedesktop.org/software/systemd/man/os-release.html) file.
If this is acceptable I'd try my hand at implementing this. If not, I'd be interested in other ways to make distribution detection
more reliable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.