Skip to content

[docs]: Core Tutorial -- Running using QEMU hangs and does not progress #5910

@jsollom-hpe

Description

@jsollom-hpe

Documentation request

I attempted the Core tutorial with QEMU, and I was unsuccessful. After running the script, it hung and never dropped into a qemu prompt. Using this tutorial from a completely different website, https://theboreddev.com/run-ubuntu-on-mac-using-qemu/ I was successfully able to launch an Ubuntu virtual machine using QEMU, so I know that is possible on my machine.

Here is my set-up.
I am running on a Macbook Pro.
Chipset: M1
MacOS: Sonoma 14.4.1
QEMU version: 9.1.2
I created a cloud-init-demo directory rather than the temp directory specified in the tutorial instructions (as well as the script).

I have the three specified data files.
cloud-init-demo % ls -l *-data
-rw-r--r-- 1 staff 33 Dec 3 14:49 meta-data
-rw-r--r-- 1 staff 60 Dec 2 15:23 user-data
-rw-r--r-- 1 staff 0 Dec 2 15:25 vendor-data

cloud-init-demo % cat meta-data
instance-id: someid/somehostname

cloud-init-demo % cat user-data

#cloud-config
password: password
chpasswd:
  expire: False

cloud-init-demo % cat vendor-data

I downloaded the Ubuntu server image for ARM.
cloud-init-demo % ls -l jammy-server-cloudimg-arm64.img
-rw-r--r-- 1 staff 625955840 Oct 3 21:39 jammy-server-cloudimg-arm64.img

I started the HTTP server in the same directory, and I can curl from it and receive any of the three *-data files.

Then, I run the following command.

Variant 1:
#! /bin/bash
qemu-system-aarch64
-net nic
-net user
-machine virt
-accel hvf
-cpu host
-m 512
-nographic
-hda jammy-server-cloudimg-arm64.img
-smbios type=1,serial=ds='nocloud;s=http://10.0.2.2:8000/'

This command never returns. It never drops to the qemu prompt. It just hangs. Further, it never makes a request of the HTTP server.

I've tried other variants of this script with the same result. This variant tries outputting some debug information and a debug log file. The debug log file is always empty.

Variant 2:
#! /bin/bash

qemu-system-aarch64
-net nic
-net user
-M virt,highmem=off
-m 3000
-accel hvf
-cpu host
-m 512
-nographic
-hda jammy-server-cloudimg-arm64.img
-smbios type=1,serial=ds='nocloud;s=http://10.0.2.2:8000/'
-D qemu-debug.log
-d int,cpu

Variant 3:

This next script was comparable to what I used to launch the QEMU VM from the aforementioned tutorial at the top. However, that tutorial was using an installed disk image, which, of course, we're not using here because we're trying to demonstrate how cloud-init can set initialize passwords etc. for you. This script also hangs.

qemu-system-aarch64
-M virt,highmem=off
-accel hvf
-cpu host
-smp 4
-m 3000
-device virtio-gpu-pci
-display default,show-cursor=on
-device qemu-xhci
-device usb-kbd
-device usb-tablet
-device intel-hda
-device hda-duplex
-hda jammy-server-cloudimg-arm64.img
-smbios type=1,serial=ds='nocloud;s=http://10.0.2.2:8000/'
-net nic
-net user
-nographic

Please let me know what I can do to further debug this. I would like to successfully get through this tutorial.

Using the aforementioned other tutorial, here is how I successfully launched an Ubuntu VM on my macbook initially. Notice, it is using the QEMU_EFI.fd BIOS. I am mentioning this in case there are options here that I should have had present in my earlier variants.

qemu-system-aarch64
-monitor stdio
-M virt,highmem=off
-accel hvf
-cpu host
-smp 4
-m 3000
-bios QEMU_EFI.fd
-device virtio-gpu-pci
-display default,show-cursor=on
-device qemu-xhci
-device usb-kbd
-device usb-tablet
-device intel-hda
-device hda-duplex
-drive file=ubuntu-latest.raw,format=raw,if=virtio,cache=writethrough
-cdrom ubuntu-22.04.1-live-server-arm64.iso

Here is how I successfully launched an Ubuntu VM on my macbook once the disk image had been written.

qemu-system-aarch64
-monitor stdio
-M virt,highmem=off
-accel hvf
-cpu host
-smp 4
-m 3000
-bios /Users/jasonsollom/qemu/QEMU_EFI.fd
-device virtio-gpu-pci
-display default,show-cursor=on
-device qemu-xhci
-device usb-kbd
-device usb-tablet
-device intel-hda
-device hda-duplex
-drive file=/Users/jasonsollom/qemu/ubuntu-latest.raw,format=raw,if=virtio,cache=writethrough'


Reported from: https://cloudinit.readthedocs.io/en/stable/tutorial/qemu.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThis Pull Request changes documentationnewAn issue that still needs triage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions