Context
After running the the below bash script to auto-install an Ubuntu server 22.04 on Qemu using virt-install, I get the error:
Block probing did not discover any disks big enough to support guided storage configuration.
Additionally, it appears to me that the user-data
file in the seed.iso
is not recognised by virt-install, as the terminal prompts me which language I would like to use for the server:
even though (I believe) that is specified with the line locale: en_US
in the file user-data
.
Install Script
File: install.sh
contains:
#!/bin/bash
# USERNAME="$(echo $whoami)"
USERNAME="$(whoami)"
# read -p "USERNAME=$USERNAME"
CURRENT_DIR="$PWD"
echo "CURRENT_DIR=$CURRENT_DIR"
version=22
VM_NAME="ubu$version"
DISK_SIZE=30
# Install qemu.
sudo apt-get install qemu-kvm >>/dev/null 2>&1
# Install the virtual installer that installs Ubuntu on Qemu.
#sudo apt-get install virt-install
sudo apt-get install virt-manager >>/dev/null 2>&1
# Allow copy paste between qemu Ubuntu and your own device
sudo apt-get install spice-vdagent >>/dev/null 2>&1
# Allow a bridge between qemu and your own device to grant Ubuntu internet.
sudo apt-get install libvirt-daemon-system >>/dev/null 2>&1
sudo apt-get install libvirt-clients >>/dev/null 2>&1
sudo apt-get install genisoimage >>/dev/null 2>&1
#sudo apt-get install python-libvirt
# Create working directory
cd /home/$USERNAME/
mkdir -p /home/$USERNAME/qemus
cd /home/$USERNAME/qemus
# Create iso of autoinstall.yaml
SEED_PATH=/home/$USERNAME/qemus/seed.iso
sudo rm "$SEED_PATH"
sudo rm "$CURRENT_DIR/seed$version/meta-data"
touch "$CURRENT_DIR/seed$version/meta-data"
genisoimage -o "$SEED_PATH" -r -J "$CURRENT_DIR/seed$version/"
sudo rm "$CURRENT_DIR/seed$version/meta-data"
## Define variables
MEM_SIZE=3072 # Memory setting in MiB
VCPUS=1 # CPU Cores count
OS_VARIANT="ubuntu22.04" # Select from the output of "osinfo-query os"
# LOCATION="/home/$USERNAME/qemus/ubuntu-23.04-desktop-amd64.iso"
LOCATION="/home/$USERNAME/qemus/ubuntu-22.04.2-live-server-amd64.iso"
OS_TYPE="linux"
# Download the Ubuntu iso.
# wget -O "$LOCATION" https://releases.ubuntu.com/lunar/ubuntu-22.04-desktop-amd64.iso
wget -O "$LOCATION" https://releases.ubuntu.com/22.04.2/ubuntu-22.04.2-live-server-amd64.iso
# DISK_FILE="./${VM_NAME}.qcow2"
DISK_FILE="/home/$USERNAME/qemus/${VM_NAME}.qcow2"
sudo rm "$DISK_FILE"
touch "$DISK_FILE"
chmod 777 "$DISK_FILE"
virt-install \
--virt-type kvm \
--name ${VM_NAME} \
--memory=${MEM_SIZE} \
--vcpus=${VCPUS} \
--os-type ${OS_TYPE} \
--cpu host-passthrough \
--features smm.state=on \
--disk path="$DISK_FILE",size=${DISK_SIZE},format=qcow2,sparse=true,bus=scsi,discard=unmap \
--controller type=scsi,model=virtio-scsi \
--network bridge=virbr0 \
--metadata title='Ubuntu 22.04 (CIS)' \
--disk path="$SEED_PATH",size=${DISK_SIZE},device=cdrom,bus=sata \
--location ${LOCATION},kernel=casper/vmlinuz,initrd=casper/initrd \
--channel spicevmc,target_type=virtio,name=com.redhat.spice.0 \
--channel unix,target_type=virtio,name=org.qemu.guest_agent.0 \
--graphics spice,gl.enable=no,listen=none \
--video qxl \
--console pty,target_type=virtio \
--tpm type=emulator,version=2.0,model=tpm-tis \
--boot loader=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,loader.readonly=yes,loader.type=pflash,loader.secure=yes,nvram.template=/usr/share/OVMF/OVMF_VARS_4M.ms.fd \
--extra-args='autoinstall' \
--noreboot
virsh change-media jammy_cis sdc --eject --force
and it is located in the same directory as a folder seed22
which contains the autoinstall file named: user-data
.
auto-install file
This is the content of the user-data
file:
version: 1
reporting:
hook:
type: webhook
endpoint: http://example.com/endpoint/path
early-commands:
- ping -c1 198.162.1.1
locale: en_US
keyboard:
layout: gb
variant: dvorak
network:
network:
version: 2
ethernets:
enp0s25:
dhcp4: yes
enp3s0: {}
enp4s0: {}
bonds:
bond0:
dhcp4: yes
interfaces:
- enp3s0
- enp4s0
parameters:
mode: active-backup
primary: enp3s0
proxy: http://squid.internal:3128/
apt:
primary:
- arches: [default]
uri: http://repo.internal/
sources:
my-ppa.list:
source: "deb http://ppa.launchpad.net/curtin-dev/test-archive/ubuntu jammy main"
keyid: B59D 5F15 97A5 04B7 E230 6DCA 0620 BBCF 0368 3F77
storage:
layout:
name: lvm
identity:
hostname: hostname
username: username
password: $6$jIFnr1YHWk/TYCfD$6nnv2yn6AzQOpOslPTPE0dZlA75OFR4ZiVpEOeDByLFJ/AW0D45FC6.NaLHkrU1vtffFwDIshYgUnUx0hGN051
snaps:
- name: go
channel: 1.14/stable
classic: true
debconf-selections: |
bind9 bind9/run-resolvconf boolean false
packages:
- libreoffice
- dns-server^
user-data:
disable_root: false
late-commands:
- sed -ie 's/GRUB_TIMEOUT=.\*/GRUB_TIMEOUT=30/' /target/etc/default/grub
error-commands:
- tar c /var/log/installer | nc 192.168.0.1 1000
The md5sum for the password is that of password: ubuntu
.
Disk size 0
The Block probing..
error message is specified above, and I assume it occurs because the installation does not recognise any disks (with 30 gb, as specified with: DISK_SIZE=30
in: install.sh
):
Question
How can I ensure the Ubuntu server installation recognises the autoinstall yaml
and disk size of 30 gb?