initramfs-tools >= 0.142ubuntu5 (in mantic) has the qemu-net autopkgtest that covers this use case and it checks that the hostname is set correctly.
Does your initramfs comes without /etc/hostname?
initramfs-tools >= 0.142ubuntu5 (in mantic) has the qemu-net autopkgtest that covers this use case and it checks that the hostname is set correctly.
Does your initramfs comes without /etc/hostname?