lima-vm / alpine-lima

Create an alpine based image for lima
Apache License 2.0
40 stars 26 forks source link

The image should be a hard drive image, not ISO9660 #123

Open AkihiroSuda opened 6 months ago

AkihiroSuda commented 6 months ago

All the official Lima templates except Alpine uses hard drive images, and it is hard to maintain ISO booting specifically for Alpine

afbjorklund commented 6 months ago

Being able to use a "LiveCD" ISO with Lima is a great feature (since the docker-machine days), and I hope that it is never removed from Lima...

AkihiroSuda commented 6 months ago

The ISO build can continue to be supported, but probably not as a "Tier 1"

jandubois commented 6 months ago

The ISO build can continue to be supported, but probably not as a "Tier 1"

That just means you want to remove the ⭐ on the Alpine entry on https://lima-vm.io/docs/templates/, or anything else? I'm fine with removing the ⭐.

AkihiroSuda commented 6 months ago

The ISO build can continue to be supported, but probably not as a "Tier 1"

That just means you want to remove the ⭐ on the Alpine entry on https://lima-vm.io/docs/templates/, or anything else? I'm fine with removing the ⭐.

Yes, inclined to demote Alpine from Tier 1 ⭐ to Tier 2 ☆

jandubois commented 6 months ago

it is hard to maintain ISO booting specifically for Alpine

I assume you mean the cidata boot scripts and not the logic in Go here.

I think some of the logic (like 04-persistent-data-volume) should be moved to the distro instead of being hard-coded in Lima (e.g. I sometimes wanted an Alpine VM without the persistent disk).

This wasn't possible originally, but I think we have most of the pieces in place to implement something like

additionalDisks:
- name: data
  internal: true

provision:
- mode: boot
  script: lima-setup-peristent-disk /etc /home /root /tmp /usr/local /var/lib

The internal: true setting would create a non-shared additional disk that would be created and deleted automatically as the instance is created/deleted.

And we would need to implement mode: boot support for Alpine.

Then the script can be included in the ISO and you can have templates with and without persistent disks, and could even configure which directories you want to persist.

We would still have to keep the current boot scripts for backwards compatibility with older existing instances, so we would also need a mechanism to disable the builtin support.

jandubois commented 6 months ago

As for creating a hard drive image for Alpine, are there any tools that would convert an ISO into a disk image? If this is easy to do, then I'm happy to add it.

But if it is a completely separate process to build, then I'm personally not interested and would wait for somebody else to implement it.

afbjorklund commented 6 months ago

When I made my distributions, it was separate build targets. Same rootfs, but different imaging tools at the end... It was Buildroot rather than Alpine, but I assume that it is the same underlying mkisofs and mkfs.ext4 programs?

I used the LiveCD for containers (same as in docker-machine, and here), but then used resizable HDD for kubernetes. The main other difference there was changing to from openrc/musl to systemd/glibc, which made it much bigger.