virt-manager Ubuntu cloudimage
Ubuntu aarch64 virt-manager
This is step-by-step to add Ubuntu aarch64 vm via virt-manager.
-
Download ubuntu arm64 image from cloud images
Assume the name of the downloaded image is </path/to/ubuntu-cloudimg-arm64.img>.
Change the root password of the image with this command
virt-customize -a <qcow2_img_file.img> --root-password password:<pass>NOTE: You might want to resize the image so we can grow the partition later.
Th example below is to add additional 10 GB to the selected qcow2 image. Change the image path to the one we've downloaded
qemu-img resize <qcow2_img_file.img> +10G -
Create varstore.img and varstore-copy.img
truncate -s 64m </path/to/varstore.img> cp </path/to/varstore.img> </path/to/varstore-copy.img> -
Create efi.img. You might need to install
qemu-system-armtruncate -s 64m </path/to/efi.img> dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd of=</path/to/efi.img> conv=notrunc -
Open virt-manager. Just forward until the end, BUT DON'T CLICK FINISH YET. Check Customize configuration before install, then click FINISH
-
On the configuration window, edit the XML, and copy-paste xml file ubuntu-arm64.xml attached below. Edit all
</path/to/.....>with ones from previous steps.You might want to change uuid too
-
Click Begin Installation
Once logged in to vm, you might want to do this
Grow Partition
-
If previously you resize the image with
qemu-img resize, you need to grow the Partition with parted. Assuming you logged in asrootparted /dev/vda -
Inside this parted execute
resizepart <partition_number> 100%, in my case the<partition_number>is1.(parted) resizepart 1 100% Warning: Partition /dev/vda<partition_number> is being used. Are you sure you want to continue? Yes/No? Yes (parted) quitIf you got response to fix the partition instead, Proceed with Fix until finish, the re-enter resizepart command again after that.
-
Then in bash/sh execute
resize2fs /dev/vda<partition_number>, in my case the<partition_number>is1.resize2fs /dev/vda1 -
After this, I think you need to reboot to make partition larger.
Connect to network and internet
Since I didn't use cloud-init to set preset data, I don't have dhcp client and my NIC is down.
For this steps, assume the NIC is eth0. Please check the actual NIC name with ip -br a.
Also I use virbr as the bridge with subnet is 192.168.122.0/24
-
Add temporary IP address and Link the NIC up
ip addr add 192.168.122.10/24 dev eth0 ip link set eth0 up -
Set the route to connect to internet
ip route add default via 192.168.122.1 dev eth0 -
At this stage, you should be able to connect to internet, but somehow there's no DNS resolver.
Edit
/etc/systemd/resolved.confsince ubuntu usessystemd-resolved.Add any available resolvers. Your
/etc/systemd/resolved.confmight look like this[Resolve] DNS=8.8.8.8 1.1.1.1 FallbackDNS=1.0.0.1 -
restart
systemd-resolvedsystemctl restart systemd-resolved -
Now, install
dhcpcdfor DHCP clientapt update apt install dhcpcd systemctl restart dhcpcd.service