Create ARM64 virtual machines with virt-install
Introduction
As we've seen in the last post, virt-install
helps speed up virtual machine (VM) installation. It can not only create VM for the CPU architecture it's currently running on, it can do other architectures as well.
We'll create an ARM64 virtual machine. Unless you're already on an ARM64 system, the installation process is much slower than on our CPU architecture because we have to emulate the ARM CPU.
Unattended VM creation
First, we install qemu for aarch64
:
apt install qemu-system-aarch64
We need to create two password files. One for root
and the other for the user. They are in plaintext and the password must be on the first line:
echo "toor" > root-pwd.txt
echo "user" > user-pwd.txt
Now let's do the installation:
sudo virt-install --install debian12 \
--graphics none \
--console pty,target_type=serial \
--noautoconsole \
--extra-args="console=ttyS0,115200n8" \
--unattended profile=jeos,admin-password-file=root-pwd.txt,user-login=user,user-password-file=user-pwd.txt \
--arch aarch64 --machine virt
The only new options (refer to the last blog post for information about the other options) are:
--arch aarch64
: Use an ARM64 architecture--machine virt
: Default QEMU (virtual) machine settings
The output will be very similar to the one for the same CPU architecture:
Using debian12 --location http://deb.debian.org/debian/dists/bookworm/main/installer-arm64
Using default --name debian12-aarch64
Using debian12 default --memory 2048
Using debian12 default --disk size=20
Starting install...
Retrieving 'linux' | 29 MB 00:03 ...
Retrieving 'initrd.gz' | 36 MB 00:03 ...
Allocating 'debian12-aarch64.qcow2' | 0 B 00:00 ...
Creating domain... | 0 B 00:00
Domain is still running. Installation may be in progress.
You can reconnect to the console to complete the installation process.
Monitoring the installation
It is done the exact same way as with a VM with the same CPU architecture. We can monitor it with either virsh
or with virt-manager
. Refer to the last blog post for details.
Using the VM with virt-manager
While virt-manager cannot create cross-architecture VM, it can manage them like any other.
Subscribe to my newsletter
Read articles from Thomas directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by