5

At How to run Ubuntu 16.04 Desktop on QEMU? I have described in detail how to boot and install the desktop Ubuntu image on QEMU.

Now I wanted to do a similar setup for the server image to try keep things more minimal:

wget http://releases.ubuntu.com/18.04/ubuntu-18.04.1.0-live-server-amd64.iso

I have installed the server image with the GUI previously, and the setup seems to be text based, so I thought it might work.

But then, if I just add the usual:

-nographic -serial mon:stdio

as in:

qemu-system-x86_64 -cdrom ubuntu-18.04.1.0-live-server-amd64.iso \
  -drive file=ubuntu-18.04.1.0-live-server-amd64.img.qcow2,format=qcow2 \
  -enable-kvm   -m 2G   -smp 2   -vga virtio -nographic -serial mon:stdio

I just never get anything on the terminal serial.

I also tried to mount the image to see what was inside:

mkdir mydir
sudo mount ubuntu-18.04.1.0-live-server-amd64.iso mydir

to see what was inside, and:

cat mydir/boot/grub/grub.cfg

indicates that there is no console=ttyS0 option on the command line, which might explain why the terminal is empty.

I can't edit the ISO file however without first going into a GUI session, as it is mounted readonly.

I have already used the Cloud image previously, and it is great: Is there any prebuilt QEMU Ubuntu image(32bit) online? but I can't use it this time because I need GRUB for something (edit: nevermind, the cloud image does have GRUB, just it is hidden by default, see: How to get to the GRUB menu at boot-time using serial console? )

Related: How to get to the GRUB menu at boot-time using serial console? I managed to get GRUB to show on the terminal after changing the GRUB configuration with the GUI as shown in that thread.

Tested on an Ubuntu 16.04 host.

2 Answers2

0

If you want to use the text-only install over serial in Qemu, you can do the following:

  1. Mount the ISO on the host machine
$ mkdir iso
$ sudo mount ubuntu-24.04.1-live-server-amd64.iso iso

Note: You can probably use FUSE here if you would like to avoid sudo

$ fuseiso ubuntu-24.04.1-live-server-amd64.iso iso
  1. Append the relevant options to the Qemu command line:
$ qemu-system-x86_86 -serial mon:stdio -nographic -display curses -append 'console=ttyS0,115200,8n1' -kernel iso/casper/vmlinuz -initrd iso/casper/initrd

Booting Ubuntu Server 24.04.1 via console

From https://kennystechtalk.blogspot.com/2025/01/installing-ubuntu-server-on-qemu.html

Ken Sharp
  • 1,086
-1

There is this option you can give qemu:

-display curses

Display video output via curses. For graphics device models which support a text mode, QEMU can display this output using a curses/ncurses interface.Nothing is displayed when the graphics device is in graphical mode or if the graphics device does not support a text mode. Generally only the VGA device models support text mode.

Source.

But I'm assuming this won't fix the problem, nor is it a solution for you or other's problems.

CodeAsm
  • 1
  • 2