1

I have a raw qemu disk image of Debian 10 ("buster") with no desktop environment, and I'm trying to run it in the terminal of my host machine (also Debian 10) with the -curses flag. If I run qemu-system-x86_64 with just the -curses flag, I just get a blank screen, so following this question I added the -vga std option. Unfortunately, that gives me a kernel panic in the console, and I never reach the login screen of the guest. The output looks like this:

[    3.021788]  xwrite+0x29/0x5a
[    3.021845]  do_copy+0x9b/0xc8
[    3.021878]  write_buffer+0x27/0x37
[    3.021912]  flush_buffer+0x34/0x8b
[    3.021947]  __gunzip+0x26e/0x315
[    3.021982]  ? bunzip2+0x397/0x397
[    3.022016]  ? initrd_load+0x5e/0x5e
[    3.022048]  ? __gunzip+0x315/0x315
[    3.022080]  gunzip+0xe/0x11
[    3.022112]  ? initrd_load+0x5e/0x5e
[    3.022143]  unpack_to_rootfs+0x182/0x2c6
[    3.022177]  ? initrd_load+0x5e/0x5e
[    3.022210]  ? unpack_to_rootfs+0x2c6/0x2c6
[    3.022243]  ? do_early_param+0x8e/0x8e
[    3.022275]  populate_rootfs+0x59/0x106
[    3.022311]  do_one_initcall+0x46/0x1c3
[    3.022350]  ? do_early_param+0x8e/0x8e
[    3.022382]  kernel_init_freeable+0x189/0x218
[    3.022419]  ? rest_init+0xaa/0xaa
[    3.022453]  kernel_init+0xa/0x10d
[    3.022487]  ret_from_fork+0x35/0x40
[    3.023243] ---[ end Kernel panic - not syncing: System is deadlocked on memo
ry
[    3.023243]  ]---

I'm using QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-8+deb10u3). My terminal is st 0.8.2 and my desktop environment/window manager is dwm, if those details are relevant. I get the same kernel panic if I use xterm, though.

I'm booting the image with this qemu command:

qemu-system-x86_64 -curses -vga std -m 1024 -drive format=raw,file=disk.img

I've tried other various combinations of qemu flags from this question, but they either don't exist for my version of qemu (e.g. the -noframe option), throw other errors (e.g. -append requires a -kernel option), or just give me a blank screen (-curses by itself).

The whole point of this is to avoid launching a VNC viewer to access a guest that is command line only anyway.

  • 1
    If you run linux with qemu -curses, just give it the nomodeset (and systemd.unit=multi-user.target) options on the kernel command line (I don't think that using -append ... works if you're using any kind of boot manager in the guest). Otherwise sooner or later you'll be left with with a black screen with graphics mode written in the middle. I'm sorry I can't help you further, as I'm using a (heavily modified) current version of qemu, not that from the distro. I'm also using -vga virtio, but I don't know if that works with your older version. – mosvy Dec 10 '19 at 20:13
  • Thanks for the help. This may be a stupid question, but what do you mean by the "kernel command line"? Those aren't options that I pass directly to the qemu-system-x86_64 command? I can't even get into a boot menu in qemu so I can't (for example) edit boot commands in grub. – Michael A Dec 10 '19 at 20:30
  • 1
    A boot loader like grub can pass arguments to the linux kernel. qemu knows how to do that directly, if you're using -kernel ... -append .., but that doesn't work with disk images which use a bootloader. Eg. if your image is using grub, you can modify them by pressing e in the boot screen, adding them after the linux entry, and then pressing Ctrl-X to boot through. You can add permanent kernel command options inside the guest by modifying /etc/default/grub and running grub-update. All that is no different from a real machine. – mosvy Dec 10 '19 at 20:35
  • @mosvy Perfect! I added nomodeset systemd.unit=multi-user.target to the GRUB_CMDLINE_LINUX_DEFAULT="quiet nomodeset systemd.unit=multi-user.target" line in /etc/default/grub, ran update-grub, and now the qemu-system-x86_64 command in my question works perfectly! Plus I can get easily get that to work with my preseed file. I'm happy to summarize this and put it into a community wiki answer, unless you want to. Thank you again! – Michael A Dec 10 '19 at 20:44
0

Per mosvy's comments, I added the nomodeset systemd.unit=multi-user.target options to the kernel command line, and then qemu booted everything correctly. Since I'm setting up these bootable iso images with a preseed file, I added this line to preseed.cfg:

d-i debian-installer/add-kernel-opts string nomodeset systemd.unit=multi-user.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.