Hi, list members,

 

While investigating how I can install ubuntu on a qemu virtual machine, I
found
https://askubuntu.com/questions/884534/how-to-run-ubuntu-desktop-on-qemu .

So I found how to install the OS onto a hard disk using CDROM, and then boot
from the OS installed hard disk as in real computer. Very interesting.

And I tried ubuntu 18.04.5 on arm64/virt machine (I used the original virt
machine).

The script is below (modified for my case). (configured with -enable-gtk
option)

 

#!/usr/bin/env bash

 

set -eux

 

# Parameters.

id=ubuntu-20.04.2-live-server-arm64

disk_img="${id}.img.qcow2"

disk_img_snapshot="${id}.snapshot.qcow2"

iso="${id}.iso"

 

# Get image.

if [ ! -f "$iso" ]; then

  wget "http://releases.ubuntu.com/20.04/${iso}";

fi

 

# Go through installer manually.

if [ ! -f "$disk_img" ]; then

  qemu-img create -f qcow2 "$disk_img" 1T

  ../QEMU/qemu-5.1.0/build/aarch64-softmmu/qemu-system-aarch64 \

    -M virt -cpu cortex-a72 \

    -cdrom "$iso" \

    -drive "file=${disk_img},format=qcow2" \

    -m 2G \

    -smp 2 \

  ;

fi

 

# Create an image based on the original post-installation image

# so as to keep a pristine post-install image.

if [ ! -f "$disk_img_snapshot" ]; then

  qemu-img \

    create \

    -b "$disk_img" \

    -f qcow2 \

    "$disk_img_snapshot" \

  ;

fi

 

# Run the copy of the installed image.

../QEMU/qemu-5.1.0/build/aarch64-softmmu/qemu-system-aarch64 \

  -M virt -cpu cortex-a72 \

  -drive "file=${disk_img_snapshot},format=qcow2" \

  -m 2G \

  -smp 2 \

  -device intel-hda -device hda-duplex \

  -device virtio-gpu-pci \

  "$@" \

;

I separately downloaded ubuntu-20.04.2-live-server-arm64.iso from
https://ubuntu.com/download/server/arm so the first wget command is not
executed.

When I first run the script, I see a qemu monitor window. And I type 'quit',
and then another window comes up saying "Guest has not initialized the
display (yet)."

What is wrong with this script? Any advice will be very much appreciated.

Thanks!

 

Chan Kim

 

 

 

Reply via email to