Skip to contentSkip to conversation

Booting from a Bootcamp partition

Qemu-devel Programmingkid 3 participants 5 messages Apr 14, 2019 – Apr 26, 2019

lore
Share & tools
lore
#0 lore raw

Hi I was wondering if anyone has been able to boot from a bootcamp partition inside of QEMU. I know this partition can be used in QEMU but my own attempts at booting Windows 7 on my bootcamp partition did not work. I always see "A disk read error occurred". Has anyone else been successful at this?

#1 lore raw
Quoted 1 line · Programmingkid

Hi I was wondering if anyone has been able to boot from a bootcamp partition inside of QEMU. I know this partition can be used in QEMU but my own attempts at booting Windows 7 on my bootcamp partition did not work. I always see "A disk read error occurred". Has anyone else been successful at this?

Hi,
It's difficult to help without more information:
1. What is your QEMU command-line?
2. What is the partition table on the disk?

General problems with booting Windows are usually caused by a guest configuration that doesn't match the hardware configuration that Windows was installed under. Can you check that the AHCI bus address of the disk and partition numbering matches what Windows expected?

It may also be useful to enable tracing (see docs/devel/tracing.txt) to see what the ahci_* trace event log says. I have CCed John Snow, one of the few people who can read this log :).

Stefan

#2 lore raw
Quoted 9 lines · Stefan Hajnoczi
Quoted 1 line · Programmingkid

Hi I was wondering if anyone has been able to boot from a bootcamp partition inside of QEMU. I know this partition can be used in QEMU but my own attempts at booting Windows 7 on my bootcamp partition did not work. I always see "A disk read error occurred". Has anyone else been successful at this?

Hi,
It's difficult to help without more information:
1. What is your QEMU command-line?

sudo qemu-system-x86_64 -name "Windows 7" -hda "/dev/disk0s4" -boot "c" -m 3000

Quoted 1 line

2. What is the partition table on the disk?

The bootcamp partition is this: /dev/disk0s4

Quoted 4 lines

General problems with booting Windows are usually caused by a guest configuration that doesn't match the hardware configuration that Windows was installed under. Can you check that the AHCI bus address of the disk and partition numbering matches what Windows expected?

How would someone do this?

Quoted 3 lines

It may also be useful to enable tracing (see docs/devel/tracing.txt) to see what the ahci_* trace event log says. I have CCed John Snow, one of the few people who can read this log :).

I'm guessing you believe the problem is the partition can't be read in QEMU. I know for sure it can. I attached this partition to another QEMU VM and was able to see it on the Desktop.

My guess is the computer is using an EFI firmware and QEMU uses the traditional BIOS firmware (SeaBIOS). So I think trying UEFI in QEMU might work.

#3 lore raw
Quoted 10 lines · Programmingkid
Quoted 9 lines · Stefan Hajnoczi
Quoted 1 line · Programmingkid

Hi I was wondering if anyone has been able to boot from a bootcamp partition inside of QEMU. I know this partition can be used in QEMU but my own attempts at booting Windows 7 on my bootcamp partition did not work. I always see "A disk read error occurred". Has anyone else been successful at this?

Hi,
It's difficult to help without more information:
1. What is your QEMU command-line?

Quoted 6 lines

sudo qemu-system-x86_64 -name "Windows 7" -hda "/dev/disk0s4" -boot "c" -m 3000

Quoted 1 line

2. What is the partition table on the disk?

The bootcamp partition is this: /dev/disk0s4

(Are you trying to boot a partition as an entire block device ...?)

Quoted 5 lines
Quoted 4 lines

General problems with booting Windows are usually caused by a guest configuration that doesn't match the hardware configuration that Windows was installed under. Can you check that the AHCI bus address of the disk and partition numbering matches what Windows expected?

Quoted 8 lines

How would someone do this?

Quoted 3 lines

It may also be useful to enable tracing (see docs/devel/tracing.txt) to see what the ahci_* trace event log says. I have CCed John Snow, one of the few people who can read this log :).

I'm guessing you believe the problem is the partition can't be read in QEMU. I know for sure it can. I attached this partition to another QEMU VM and was able to see it on the Desktop.

Well, we don't know what the problem is. From the command line above it looks like it'd be using the legacy IDE emulation instead of the newer SATA emulation, though. I'd wager that the Windows boot loader here is not expecting to use IDE.

"disk read error" could mean a lot of things from the POV of a guest, but having disk emulation tracing would show us what the guest is trying to do, at least.

Quoted 2 lines

My guess is the computer is using an EFI firmware and QEMU uses the traditional BIOS firmware (SeaBIOS). So I think trying UEFI in QEMU might work.

Try using -M q35 which will engage SATA and AHCI emulation, and try using UEFI, yes.

#4 lore raw
Quoted 16 lines · John Snow
Quoted 10 lines · Programmingkid
Quoted 9 lines · Stefan Hajnoczi
Quoted 1 line · Programmingkid

Hi I was wondering if anyone has been able to boot from a bootcamp partition inside of QEMU. I know this partition can be used in QEMU but my own attempts at booting Windows 7 on my bootcamp partition did not work. I always see "A disk read error occurred". Has anyone else been successful at this?

Hi,
It's difficult to help without more information:
1. What is your QEMU command-line?

Quoted 8 lines
Quoted 6 lines

sudo qemu-system-x86_64 -name "Windows 7" -hda "/dev/disk0s4" -boot "c" -m 3000

Quoted 1 line

2. What is the partition table on the disk?

The bootcamp partition is this: /dev/disk0s4

(Are you trying to boot a partition as an entire block device ...?)

I am trying to boot a partition.

Quoted 15 lines
Quoted 6 lines
Quoted 5 lines

General problems with booting Windows are usually caused by a guest configuration that doesn't match the hardware configuration that Windows was installed under. Can you check that the AHCI bus address of the disk and partition numbering matches what Windows expected?

Quoted 8 lines

How would someone do this?

Quoted 3 lines

It may also be useful to enable tracing (see docs/devel/tracing.txt) to see what the ahci_* trace event log says. I have CCed John Snow, one of the few people who can read this log :).

I'm guessing you believe the problem is the partition can't be read in QEMU. I know for sure it can. I attached this partition to another QEMU VM and was able to see it on the Desktop.

Quoted 8 lines

Well, we don't know what the problem is. From the command line above it looks like it'd be using the legacy IDE emulation instead of the newer SATA emulation, though. I'd wager that the Windows boot loader here is not expecting to use IDE.

"disk read error" could mean a lot of things from the POV of a guest, but having disk emulation tracing would show us what the guest is trying to do, at least.

How do I enable this tracing?

Quoted 6 lines
Quoted 3 lines

My guess is the computer is using an EFI firmware and QEMU uses the traditional BIOS firmware (SeaBIOS). So I think trying UEFI in QEMU might work.

Try using -M q35 which will engage SATA and AHCI emulation, and try using UEFI, yes.

I tried using a OVMF firmware file I found online. It will not work when I use "-M accel=hvf --cpu host". The screen just stays small and black instead of a screen with the firmware info. This test was done with git revision 3284aa128153750f14a61e8a96fd085e6f2999b6 of QEMU.

The only way to make the OVMF work is to not use the accelerator:
sudo qemu-system-x86_64 -name "Windows 7" -boot "c" -m 4000 -pflash OVMF.fd

I did have success with booting a Windows 7 HD image file and was able to view the bootcamp partition as another drive. I used seaBIOS instead of OVMF. Windows 7 did crash a lot. The error was always DRIVER_IRQL_NOT_LESS_OR_EQUAL. I also saw this error printed by QEMU: Unimplemented handler (fffff80002705050) for 0 (f c3)

This is the command-line I was using:
sudo qemu-system-x86_64 -name "Windows 7" -hda "Windows 7 HD.qcow2" -hdb "/dev/disk0s4" -boot "c" -netdev user,id=mynet0 -device rtl8139,netdev=mynet0 -m 4000 -usb -device usb-audio -M accel=hvf --cpu host

I just realized that the Bootcamp partition is formatted as NTFS. This is probably why it does not work with SeaBIOS. Thank you everyone who tried to help.