You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to get the image files built by bootimage to run in VirtualBox to no avail. I looked through the comments on Minimal Rust Kernel and found #7 which added an option that would make files that would be convertible to VDI format, but it seems that option has since been removed. Trying to create a VDI file at the moment results in:
$ VBoxManage convertfromraw ./target/x86_64-blog_os/debug/bootimage-blog_os.bin /tmp/blog_os.vdi --format VDI --variant Standard --uuid <some UUID>
Converting from raw image file="./target/x86_64-blog_os/debug/bootimage-blog_os.bin" to file="/tmp/blog_os.vdi"...
Creating dynamic image with size 802816 bytes (1MB)...
VBoxManage: error: Cannot create the disk image "/tmp/blog_os.vdi": VERR_VD_INVALID_SIZE
Somewhere someone suggested just padding the file with zeroes up to 4MB. I tried that and was able to convert to VDI successfully, but when I tried to load the VDI in VirtualBox I got:
After doing a little more research it seems like the right approach is to try to create a bootable ISO file from the bin file, but there seem to be many ways to do that and I'm not sure what I should try. Many of them seem to involve a separate bootloader, but as I understand it bootimage appends the bootloader already?
I was able to get the VM to start up by mounting that VDI under the IDE Hard Disk. But it crashes immediately. All I see on screen is Booting (first stage)... and the VirtualBox logs show this error:
ERROR [COM]: aRC=VBOX_E_INVALID_VM_STATE (0x80bb0002) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Invalid machine state GuruMeditation when checking if the guest entered the ACPI mode)}, preserve=false aResultDetail=0
Tried searching for that error but just got a bunch of generic problems.
It sounds like we do something in the bootloader that VirtualBox doesn't like. Maybe it's our use of unreal mode, but I'm not sure about that. Unfortunately, I don't have time to help debugging this at the moment. We're currently planning a rewrite of the bootloader which might solve these issues, but it still in an early stage so it won't be ready anytime soon.
No problem, this was mostly just an experiment for me to see if I could get my OS running in a different environment. I'll just try again later with the new bootloader.
I tried this again, manually padding the .bin to 4MiB and converting to VDI. Got the same result (see "Booting (first stage)..." then a crash), but potentially a different error in the logs. Here's part of the logs that might be relevant:
Is there any evidence that this approach of padding and converting to VDI is the right path to go down? Or could that be the real source of the issues? The fact that I see the Booting (first stage)... message on-screen made me think that the bootloader is actually running so it seemed like progress, does that seem correct?
With bootloader 0.9.6 I was able to boot on VirtualBox using both VBoxManage and qemu-img to convert the image:
qemu-img convert -f raw -O qcow2 target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.qcow2
or qemu-img convert -f raw -O vdi target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.vdi
or VBoxManage convertfromraw --format VDI target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.vdi
I didn't have to do any manual padding before converting the image, but I did change some of the default settings when configuring the VM. Using the unknown 64 bit OS template I disabled I/O APIC, USB, soundcard, network card and other stuff that is unused.
Activity
dbeckwith commentedon May 8, 2020
After doing a little more research it seems like the right approach is to try to create a bootable ISO file from the bin file, but there seem to be many ways to do that and I'm not sure what I should try. Many of them seem to involve a separate bootloader, but as I understand it
bootimageappends the bootloader already?dbeckwith commentedon May 8, 2020
Some progress on the VDI approach.
After manually padding the
.binfile to 4MiB and converting to VDI with this command:I was able to get the VM to start up by mounting that VDI under the IDE Hard Disk. But it crashes immediately. All I see on screen is
Booting (first stage)...and the VirtualBox logs show this error:Tried searching for that error but just got a bunch of generic problems.
dbeckwith commentedon May 8, 2020
Looking through the logs more I think it may be a triple fault that's the root error.
phil-opp commentedon May 24, 2020
Sorry for replying so late!
It sounds like we do something in the bootloader that VirtualBox doesn't like. Maybe it's our use of unreal mode, but I'm not sure about that. Unfortunately, I don't have time to help debugging this at the moment. We're currently planning a rewrite of the bootloader which might solve these issues, but it still in an early stage so it won't be ready anytime soon.
dbeckwith commentedon May 24, 2020
No problem, this was mostly just an experiment for me to see if I could get my OS running in a different environment. I'll just try again later with the new bootloader.
phil-opp commentedon Jul 16, 2020
This might be fixed by rust-osdev/bootloader#123. Could someone test this?
dbeckwith commentedon Jul 17, 2020
I tried this again, manually padding the
.binto 4MiB and converting to VDI. Got the same result (see "Booting (first stage)..." then a crash), but potentially a different error in the logs. Here's part of the logs that might be relevant:The rest after that seems to be lots of VM state dump info.
dbeckwith commentedon Jul 17, 2020
Is there any evidence that this approach of padding and converting to VDI is the right path to go down? Or could that be the real source of the issues? The fact that I see the
Booting (first stage)...message on-screen made me think that the bootloader is actually running so it seemed like progress, does that seem correct?rsribeiro commentedon Jul 17, 2020
With bootloader 0.9.6 I was able to boot on VirtualBox using both
VBoxManageandqemu-imgto convert the image:qemu-img convert -f raw -O qcow2 target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.qcow2or
qemu-img convert -f raw -O vdi target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.vdior
VBoxManage convertfromraw --format VDI target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.vdiI didn't have to do any manual padding before converting the image, but I did change some of the default settings when configuring the VM. Using the unknown 64 bit OS template I disabled I/O APIC, USB, soundcard, network card and other stuff that is unused.
vinc commentedon Jul 17, 2020
Thanks @rsribeiro I can confirm that it also works for me, I used the second command.
dbeckwith commentedon Jul 19, 2020
The second command works for me now as well, I realized I just hadn't updated to the latest version of
bootloader. Thanks everyone!