alpine-make-vm-image icon indicating copy to clipboard operation
alpine-make-vm-image copied to clipboard

Automate Alpine Linux installation

Open khaaliid opened this issue 2 years ago • 1 comments

I am trying to achieve unattended Alpine Linux installation. I went through the Alpine automatic installation guide but when I follow this guide there are many manual interventions are needed during the installation! one during writing the root user name, another time when creating the answer file (setup-alpine -c answerfileName), editing the answer file, calling the actual installation command (setup-alpine -f answerfileName) and reset the root password. Is there any way to include the answer file inside the ISO image and select the root user by default before starting the installation and set its password as well after the installation is done (something similar to the kickstart file in the Centos distro) ?

Like in CentOS we can provide kickstart file like below in isolinux.cfg

label MyMENU2
  menu label ^Deploy Manager Node
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=MYISO inst.ks=hd:LABEL=MYISO:/ks/ks1.cfg quiet

Similar way can we provide path to answer file in isolinux.cfg ?

khaaliid avatar Feb 08 '22 15:02 khaaliid

You don’t have to use the setup-alpine script to install and configure Alpine. It’s just a helper script to simplify common tasks during initial system configuration, it’s not necessary. Tbh, I can’t even remember the last time I used it myself. Why would you use it with alpine-make-vm-image?

This tool is designed for creating customized images for virtual machines – you provide a shell script to configure whatever you need during the build of the image and then just boot it on a hypervisor. Any instance-specific settings, such as hostname, admin user account, SSH key, networking etc. should be handled by some “contextualization tool” for the virtualization platform in hand (e.g. one-context for OpenNebula or tiny-cloud for public “clouds”). Setting the root password is a bad practice (for security reasons), better to use an SSH key, but these tools usually support even that.

jirutka avatar Jul 14 '22 19:07 jirutka

I wanted to use this library as a quick way to generate a VirtualBox .VDI (or whatever format is supports after whatever conversion process as per https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/vdidetails.html) Alpine Linux image I could boot.

Basically a makeshift https://www.osboxes.org/ for Alpine.

sudo ./alpine-make-vm-image alpine.qcow2 -s 32G --image-format qcow2
qemu-img convert -O vdi alpine.qcow2 alpine.vdi

I had to do this because something about passing qemu-img vdi on its own just hung forever. Probably not worth us researching.

It's able to boot in VirtualBox (as expected), but you're saying there's no default user or password set whatsoever?

Ah, I see, it's root with no password for a default user. Thanks.

Not quite sure the purpose of my comment other than to back up the original user saying "that's what I assumed this library did without much extra configuration/maybe you could consider expanding this library to do the behavior described more easily".

brandonros avatar Mar 05 '23 20:03 brandonros