Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-init not loaded (i think) when we set the parameter: --device virtio-blk,path=$IMG_FOLDER/cloudinit.iso #243

Open
cmoulliard opened this issue Jan 15, 2025 · 2 comments

Comments

@cmoulliard
Copy link

Issue

When the VM is launched, then fedora asks questions to configure it instead of using the cloud-init config. Maybe I did something wrong

Steps to reproduce

  • Download the Fedora Server iso file: wget https://kojipkgs.fedoraproject.org/compose/41/latest-Fedora-41/compose/Server/aarch64/iso/Fedora-Server-netinst-aarch64-41-1.4.iso
  • Create the files meta-data and user-data
  • Package them using the command:
mkisofs -output cloudinit.iso -volid cidata -rock {user-data,meta-data}
  • Launch vfkit
vfkit \
--cpus 2 \
--memory 4096 \
--log-level debug \
--ignition $CFG_FOLDER/my-cfg.ign \
--bootloader efi,variable-store=$CFG_FOLDER/efi-variable-store,create \
--device virtio-blk,path=$IMG_FOLDER/$IMG \
--device virtio-blk,path=$IMG_FOLDER/cloudinit.iso \
--device virtio-input,keyboard \
--device virtio-input,pointing \
--device virtio-net,nat,mac=5a:94:ef:e4:0c:ee \
--device rosetta,mountTag=rosetta,install \
--restful-uri tcp://localhost:60195 \
--device virtio-rng \
--device virtio-vsock,port=1025,socketURL=$CFG_FOLDER/default.sock,listen \
--device virtio-serial,logFilePath=$CFG_FOLDER/default.log \
--device virtio-gpu,width=800,height=600 \
--device virtio-fs,sharedDir=/Users/cmoullia/code/,mountTag=user1 \
--gui
...
Image : fedora-41.iso
Config folder : /Users/cmoullia/code/_temp/vfkit/dev
INFO[0000] &{2 4096    {[efi variable-store=/Users/cmoullia/code/_temp/vfkit/dev/efi-variable-store create] true}  [virtio-blk,path=/Users/cmoullia/code/_temp/vfkit/fedora/fedora-41.iso virtio-blk,path=/Users/cmoullia/code/_temp/vfkit/fedora/cloudinit.iso virtio-input,keyboard virtio-input,pointing virtio-net,nat,mac=5a:94:ef:e4:0c:ee rosetta,mountTag=rosetta,install virtio-rng virtio-vsock,port=1025,socketURL=/Users/cmoullia/code/_temp/vfkit/dev/default.sock,listen virtio-serial,logFilePath=/Users/cmoullia/code/_temp/vfkit/dev/default.log virtio-gpu,width=800,height=600 virtio-fs,sharedDir=/Users/cmoullia/code/,mountTag=user1] tcp://localhost:60195 debug true /Users/cmoullia/code/_temp/vfkit/dev/my-cfg.ign} 
INFO[0000] boot parameters: &{EFIVariableStorePath:/Users/cmoullia/code/_temp/vfkit/dev/efi-variable-store CreateVariableStore:true} 
INFO[0000]                                              
INFO[0000] virtual machine parameters:                  
INFO[0000]      vCPUs: 2                                    
INFO[0000]      memory: 4096 MiB                            
INFO[0000]                                              
ERRO[0000] listen unix /var/folders/28/g86pgjxj0wl1nkd_85c2krjw0000gn/T/ignition.sock: bind: address already in use 
DEBU[0000] ignition vsock server exited                 
INFO[0000] Adding virtio-blk device (imagePath: /Users/cmoullia/code/_temp/vfkit/fedora/fedora-41.iso) 
INFO[0000] Adding virtio-blk device (imagePath: /Users/cmoullia/code/_temp/vfkit/fedora/cloudinit.iso) 
INFO[0000] Adding virtio-input keyboard device          
INFO[0000] Adding virtio-input pointing device          
INFO[0000] Adding virtio-net device (nat: true macAddress: [5a:94:ef:e4:0c:ee]) 
INFO[0000] Adding virtio-fs device                      
INFO[0000] Adding virtio-rng device                     
INFO[0000] Adding virtio-vsock device                   
INFO[0000] Adding virtio-serial device (logFile: /Users/cmoullia/code/_temp/vfkit/dev/default.log) 
DEBU[0000] Setting up graphics device with 800x600 resolution. 
INFO[0000] Adding virtio-gpu device                     
INFO[0000] Adding virtio-fs device                      
DEBU[0000] virtio-vsock device already present, not adding a second one 
INFO[0000] virtual machine is running                   
INFO[0000] Exposing vsock port 1025 on /Users/cmoullia/code/_temp/vfkit/dev/default.sock (listening) 
INFO[0000] Exposing vsock port 1024 on /var/folders/28/g86pgjxj0wl1nkd_85c2krjw0000gn/T/ignition.sock (listening) 
INFO[0000] waiting for VM to stop                       

but

Image
Image

@cmoulliard
Copy link
Author

Problem fixed after using a proper image like : Fedora-Cloud-Base-AmazonEC2-41-20250115.0.aarch64.raw

@cfergeau
Copy link
Collaborator

Depending on the image you pick, the automatic install/configuration method will be different.

Fedora CoreOS images are generic preinstalled images you can configure with ignition. These images need to be configured to use the "applehv" ignition platform or they won't work with vfkit

Fedora Cloud images are also generic preinstalled images, but they are configured using cloud-init rather than ignition. The image does not need any special setup to be used with vfkit.

Fedora Server images are installers, they need to be installed to a target disk before you get a usable OS. The installation can be automated using kickstart.

This is not really related to vfkit, except that it could make cloud-init use easier , and maybe we could have some documentation and/or flag around kickstart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants