Dear alpine devs,
Thanks a lot for the great work!
I tried to create a system so that an unmodified Alpine image would
self-install without user interaction, by passing a custom mini apkovl
archive.
I have tested this on libvirt+kvm in diskless mode, but it should work
pretty much on any platform where the apkovl can be passed in either
directly or via an extra block device.
My initial proof of concept is at:
https://gitlab.alpinelinux.org/ultrotter/alpine-autosetup
Let me know if you have thoughts, or ideas!
Thanks a lot,
Guido
On Thu, 5 Oct 2023 17:44:33 +0200
Guido Trotter <ultrotter@debian.org> wrote:
> Dear alpine devs,> > Thanks a lot for the great work!> > I tried to create a system so that an unmodified Alpine image would> self-install without user interaction, by passing a custom mini apkovl> archive.
Nice to see that somebody finally figured out how to do this with apkovl!
> I have tested this on libvirt+kvm in diskless mode, but it should work> pretty much on any platform where the apkovl can be passed in either> directly or via an extra block device.> > My initial proof of concept is at:> https://gitlab.alpinelinux.org/ultrotter/alpine-autosetup> > Let me know if you have thoughts, or ideas!
Since alpine 3.18 you can use tiny-cloud and attach a cidata volume
similar to cloud-init's nocloud. This was implemented because the
apkovl way appeared to be too hard for users in general.
Here is how you can provision an alpine vm image using this with qemu:
#!/bin/sh
echo "hostname: alpine-vm" > meta-data
cat >user-data<<EOF
#alpine-config
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOIiHcbg/7ytfLFHUNLRgEAubFz/13SwXBOM/05GNZe4 ncopa@ncopa-desktop
apk:
repositories:
- base_url: https://dl-cdn.alpinelinux.org/alpine/
repos: ["main", "community"]
runcmd:
- rm /etc/runlevels/*/tiny-cloud*
- cp -r /home/alpine/.ssh /root/ && chown root:root /root/.ssh
- lbu include /root/.ssh /home/alpine/.ssh
- rc-update add cgroups boot
- rc-update add machine-id boot
- rc-update add networking boot
- ERASE_DISKS=/dev/sda setup-disk -m sys /dev/sda
- poweroff
EOF
xorrisofs -output seed.iso -volid cidata -joliet -rock meta-data user-data
qemu-img create a.img 1G
qemu-system-x86_64 -enable-kvm -m 1024 -hda a.img -hdb seed.iso \
-cdrom https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.4-x86_64.iso
qemu-system-x86_64 -enable-kvm -m 1024 -hda a.img
-nc
On Fri, Oct 06, 2023 at 05:48:49PM +0200, Natanael Copa wrote:
Hi Natanael,
> Nice to see that somebody finally figured out how to do this with apkovl!>
Thanks!
> > I have tested this on libvirt+kvm in diskless mode, but it should work> > pretty much on any platform where the apkovl can be passed in either> > directly or via an extra block device.> > > > My initial proof of concept is at:> > https://gitlab.alpinelinux.org/ultrotter/alpine-autosetup> > > > Let me know if you have thoughts, or ideas!> > Since alpine 3.18 you can use tiny-cloud and attach a cidata volume> similar to cloud-init's nocloud. This was implemented because the> apkovl way appeared to be too hard for users in general.>
Thanks! I'll try also this and see if it works for me!
One little note is that this doesn't seem to be documented anywhere?
Or where can I find official info about it?
I would have expected to find a note here:
https://docs.alpinelinux.org/user-handbook/0.1a/Installing/medium.html
And/or a bit more on the wiki?
https://wiki.alpinelinux.org/wiki/Installation
I can try to prepare a patch for the handbook if I try it out and make
it work.
What do you think?
Thanks,
Guido
On Fri, Oct 06, 2023 at 05:48:49PM +0200, Natanael Copa wrote:
Hi Natanael,
> Since alpine 3.18 you can use tiny-cloud and attach a cidata volume> similar to cloud-init's nocloud. This was implemented because the> apkovl way appeared to be too hard for users in general.> > Here is how you can provision an alpine vm image using this with qemu:>
Thank you! I modified
https://gitlab.alpinelinux.org/ultrotter/alpine-autosetup to also
support the tiny-cloud mode of operation. It works very well and allows
also to go fully storage-less.
Guido