4

I'm learning how to build a basic OS kernel with https://intermezzos.github.io

I've create my .iso file and I'm at the point where I am runnning qemu-system-x86_64 -cdrom os.iso When I press enter, QEMU runs a window with the following output:

Booting from Floppy...
Boot failed: could not read the boot disk

Booting from DVD/CD...
Boot failed: Could not read from CDROM (code 0004)
Booting from ROM...
iPXE (PCI 00:03.0) starting execution...ok
iPXE initializing devices...ok

iPXE 1.0.0+git-20131111.c3d1e78-2ubuntu1.1 -- Open Source Network Boot Firmware
-- http://ipxe.org
Features: HTTP HTTPS iSCSI DNS TFTP AoE bzImage ELF MBOOT PXE Menu

net0: 52:54:00:12:34:56 using 82549em on PCI00:03.0 (open)
  [Link:up, TX:0 TXE:0 RX:0 RXE:01]
Configuring (net0 52:54:00:12:34:56)...ok
net0: 10.0.2.15/255.255.255.0 gw 10.0.2.2
Nothing to boot: No such file for directory (http://ipxe.org/2d03e13b)
No more network devices

No bootable device.

I went to the website listed in the output (http://ipxe.org/2d03e13b) and one of the tips is that I might Use the iPXE command line to perform DHCP manually, however when I press CTRL + B to access cli, I'm not able to do so.

Where do I look next to troubleshoot this problem of not being able to boot my .iso?
How do I make QEMU have access to keyboard input?


UPDATE
I don't know how, but I'm am now able to use CTRL + B to access iPXE command line.

This seems like a good place to start diagnosing my problem of not being able to boot my .iso.

What am I looking for?


UPDATE 2
Thanks to Peter Maydell's suggestion below, I've tested a known-good iso image (https://alpinelinux.org/), running qemu-system-x86_64 -cdrom alpine-3.4.3-x86_64.iso and it booted perfectly just as I expected.

I've rewritten my files from https://intermezzos.github.io to create a new iso image, this time copy and pasting the code from the repository, just in case I was previously inputting typos.

Still not booting. On to the next clue...

Hunter Lester
  • 2,972
  • 3
  • 15
  • 19
  • 1
    Not positive how QEMU works, but if it makes use of any sort of Linux kernel drivers indirectly to mount CDRom iso files, it will not work. It is an interesting question though, and it might be worth posting it to the BashOnWindows Github site as an issue (although preferably you update to build 14915 before posting your logs, supposedly there is more support for the Mount namespace in the latest build, as well as better sockets support). – Harry Gindi Sep 01 '16 at 18:00
  • 1
    Adding a note here for others that might find this... the issue is the ISO which is not bootable, and since that fails it moves on to the next boot device and finally gets to iPXE (network boot) which also fails as expected - but this is in no way a fault of iPXE – NiKiZe Jul 28 '17 at 20:36
  • It seems that the filename of the ISO is also related. Under macOS 11 Big Sur, the default name of "ubuntu-20.04.2-live-server-amd64.iso" wouldn't be identified as a bootable device, but after changing the name to "ubuntu.iso", it worked. – Owen Zhao Jun 17 '21 at 02:26

2 Answers2

5

The first thing to do is to check whether this command line and ISO image work on a normal Linux host system. That will tell you whether the problem is (a) the Windows Subsystem for Linux not correctly implementing something QEMU relies on or (b) your ISO image actually not being a bootable CDROM.

You might also try booting a known-good ISO image such as one for a Linux distribution.

(The general principle here is to try to do diagnostic tests to split the space of "what might be the problem" into smaller sections and determine which side your problem is.)

Peter Maydell
  • 9,707
  • 1
  • 19
  • 25
  • Thank you so much for the advice. I successfully booted an Alpine Linux image, which I'm happy about because it appears to mean that my environment setup is alright. Now I just need to figure out what's wrong with my code, although I'm not sure where to look next because trying to learn by following a tutorial. – Hunter Lester Sep 07 '16 at 00:42
3

Simple solution to the problem. Has to do with systems that use EFI to boot.

source

I needed to apt-get install grub-pc-bin and then rebuild image.

Hunter Lester
  • 2,972
  • 3
  • 15
  • 19
  • I have no idea why or how, but this has solved this awfully mysterious issue, when trying to `grub-mkrescue` a tiny kernel, for me. Thank you very much! – natiiix May 22 '20 at 23:29
  • 1
    Updated link to the source of the solution: http://intermezzos.github.io/book/first-edition/appendix/troubleshooting.html#could-not-read-from-cdrom-code-0009 (apparently "the edit queue is full", so I can't edit the link in the answer directly) – natiiix May 22 '20 at 23:35
  • @natiiix thank you for letting me know about broken link :-) fixed – Hunter Lester May 26 '20 at 20:33