Hi,
anyone tried to custom an image for Azure from Index of /vault/rocky/8.4/images/ (rockylinux.org)?
My purpose is to push custom Rocky image into Azure and create my VMs from generic qcow2 image.
I tried to use the cloud-init from az vm create cli as mentionned in the documentation: Tutorial - Customize a Linux VM with cloud-init in Azure - Azure Virtual Machines | Microsoft Docs but it did not create any user, launch any command (as a dummy echo commands) or push any ssh public key for a specific user.
In the generic qcow2 image, I don’t know what are the creds for the user root or what is installed within it. Someone has already tried to do it or has any idea?
Thanks in advance for your help.
Juilien
Thanks! worked on Proxmox
Has anyone tried this procedure on Rocky 9.0? My kvm is stuck at the boot screen saying “Booting from Hard Disk …”
edit: I was executing these commands, basically adamaze’s last 2 commands:
virt-customize \
--add /var/lib/libvirt/images/x13.qcow2 \
--hostname x13 \
--ssh-inject "root:file:/root/.ssh/id_rsa" \
--uninstall cloud-init \
--selinux-relabel
virt-install -n x13 \
--os-type=Linux \
--os-variant=centos8 \
--ram=4 \
--vcpus=2 \
--disk path=/var/lib/libvirt/images/x13.qcow2,bus=virtio,size=20 \
--network bridge:virbr0 \
--graphics vnc,listen=0.0.0.0 \
--import --noautoconsole
with version 8.6, the above definitely works.
The new rocky9 image uses UEFI, so you have to add “–boot uefi” to your command
Works like a charm, thanks!
Hello, one my side it is not working.
I’ve got a cpu at 100% and no VNC
Here are my setup:
Tried with images Rocky-9-GenericCloud-Base-9.1-20230215.0.x86_64.qcow2 and Rocky-9-GenericCloud-Base-9.1-20230215.0.x86_64.qcow2
<domain type='kvm'>
<name>Sandbox</name>
<memory unit='GB'>2</memory>
<vcpu>1</vcpu>
<os firmware="efi">
<type arch='x86_64' machine='pc-q35-rhel9.0.0'>hvm</type>
<bootmenu enable='no'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset='utc'/>
<on_poweroff>restart</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<on_lockfailure>poweroff</on_lockfailure>
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/sandbox.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/sandbox-boot-init.iso'/>
<target dev='hda' bus='sata'/>
<readonly/>
</disk>
<interface type='network'>
<mac address='52:54:00:6f:78:02'/>
<source network='labstackvms' bridge='labstackvms'/>
<model type='virtio'/>
<alias name='net0'/>
</interface>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'>
<alias name='input0'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input1'/>
</input>
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<alias name='video0'/>
</video>
<memballoon model='virtio'/>
</devices>
</domain>
I’ve defined my network this way
<network>
<name>labstackvms</name>
<uuid>44fefb58-c74c-4e02-9905-d3b1bae7ec01</uuid>
<forward mode="nat">
<nat>
<port start="1024" end="65535"/>
</nat>
</forward>
<bridge name="labstackbr" stp="on" delay="0"/>
<mac address="52:54:00:60:f8:6e"/>
<ip address="192.169.142.1" netmask="255.255.255.0">
<dhcp>
<range start="192.169.142.3" end="192.169.142.254"/>
<host mac="52:54:00:6f:78:02" ip="192.169.142.2"/>
</dhcp>
</ip>
</network>
my boot iso contains these files
meta-data
instance-id: Sandbox
local-hostname: sandbox.lab.stack.vms
user-data
#cloud-config
users:
- default
- name: sandbox
groups: wheel
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
lock_passwd: false
passwd: $6$XNcbDB/VEOdRYkoH$2pv7Q4RWSzJDzxQMJnR2HBgnjpZQpPlMiT.p6.SsvOYTld.vxmbYXnIZnraz9uPMl7NICl388HZkSHxNz7hMQ1
timezone: Europe/Paris
IP is not assigned too
Do I miss something ?
Many thanks.
Damien
I reply to myself to help everyone.
I use two stacks.
The first one is a Fedora Workstation 37 running under VirtualBox from Windows.
I’ve got VTX nested checked under my processor tab into VirtualBox.
In /etc/modprobe.d/kvm.conf I have got kvm_intel nested=1 uncommented
When running Rocky Linux 9 VM under kvm under Fedora I keep having Guest has not initialized the display (yet) and cpu keep being at 100%
=> So it is not working
The second stack is a real instance of Fedora Workstation 37
=> I get my Rocky Linux 9 VM under kvm working
Here are my configuration finally used (I do not need UEFI to make it works)
<network>
<name>labstackvms</name>
<forward mode='nat'>
<nat>
<port start='0' end='65535'/>
</nat>
</forward>
<bridge name='labstackbr' stp='on' delay='0' />
<mac address='52:54:00:60:f8:6e'/>
<ip address='192.169.142.1' netmask='255.255.255.0'>
<dhcp>
</dhcp>
</ip>
</network>
echo ‘allow all’ | sudo tee -a /etc/qemu/bridge.conf &&
sudo systemctl restart libvirtd
mkdir -p /var/lib/libvirt/images &&
cp $HOME/Documents/03_kvm/Rocky-9-GenericCloud-LVM-9.1-20230215.0.x86_64.qcow2 /var/lib/libvirt/images/sandbox.qcow2
instance-id: Sandbox
local-hostname: sandbox.lab.stack.vms
#cloud-config
user: sandbox
password: sandbox
chpasswd: {expire: False}
timezone: Europe/Paris
final_message: "The system is finally up, after seconds"
runcmd:
- /usr/bin/localectl set-keymap fr
- systemctl disable cloud-init.service
genisoimage -output /var/lib/libvirt/images/sandbox-boot-init.iso -volid cidata -joliet -r $HOME/Documents/03_kvm/sandbox/user-data $HOME/Documents/03_kvm/sandbox/meta-data
virsh net-update labstackvms add-last ip-dhcp-host
‘’
–live --config --parent-index 0
<domain type="kvm">
<name>Sandbox</name>
<memory unit='GB'>4</memory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
</features>
<!-- mandatory or virtual machine seems not to boot -->
<cpu mode="host-passthrough" check="none" migratable="on">
</cpu>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>restart</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled="yes"/>
<suspend-to-disk enabled="yes"/>
</pm>
<devices>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="writeback" discard="unmap"/>
<source file="/var/lib/libvirt/images/sandbox.qcow2" index="2"/>
<backingStore/>
<target dev="vda" bus="virtio"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file='/var/lib/libvirt/images/sandbox-boot-init.iso'/>
<target dev="hdc" bus="ide"/>
<readonly/>
</disk>
<interface type='network'>
<mac address='52:54:00:6f:78:02'/>
<source network='labstackvms' bridge='labstackvms'/>
<model type='virtio'/>
</interface>
<serial type="pty">
<source path="/dev/pts/2"/>
<target type="isa-serial" port="0">
<model name="isa-serial"/>
</target>
</serial>
<console type="pty" tty="/dev/pts/2">
<source path="/dev/pts/2"/>
<target type="serial" port="0"/>
</console>
<input type="mouse" bus="ps2">
</input>
<input type="keyboard" bus="ps2">
</input>
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>
<video>
<model type="virtio" heads="1" primary="yes">
<acceleration accel3d="no"/>
</model>
</video>
</devices>
</domain>