You are not logged in.

#1 2022-02-21 15:18:39

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

[SOLVED] QEMU - win10_21H2

Hi,

I decided to try QEMU to install a simple basic win10.

As I wanted to keep it minimal I try first with 32bits install.
I follow the wiki page

qemu-img create -f raw qemu_win1032.raw 20G
qemu-system-x86_64 -cdrom Win10_21H2_French_x32.iso -boot menu=on -drive file=qemu_win1032.raw,format=raw  -m 4G

It works pretty well picking "Family/Home" version... until it reboots where I get an endless "Preparation...."
Before I saw "Starting service" and "Preparing devices".
Nothing special shows in the console.

It tried with 64 version

qemu-img create -f raw qemu_win1064.raw 20G
qemu-system-x86_64 -cdrom Win10_21H2_French_x64.iso -boot menu=on -drive file=qemu_win1064.raw,format=raw -m 4G

I go not even that far! I got a wonderful blue screen at first cdrom boot related to "System thread exception  not handled"

Any idea what qemu parameter I am missing here?

Thx

Last edited by kamelie1706 (2022-02-22 11:56:00)

Offline

#2 2022-02-21 17:24:35

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

Trying to insist a bit with win10 32 bits / professionnal .... disk a bit bigger 32G

after a long long time the 2nd reboot happened .... now it crashes systematically and ask to restart . Not sure if good new or not!

It refers to check my wifi/network looking for update ... maybe something to look after?

Last edited by kamelie1706 (2022-02-21 17:25:08)

Offline

#3 2022-02-21 18:11:49

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,503

Re: [SOLVED] QEMU - win10_21H2

I have never run Windows with Qemu, so I don't exactly know what is correct or what isn't.
What I seem to miss here is '-enable-kvm' you also didn't mention if you installed drivers ... virtio?
While I find our wiki very good may I suggest you have a look at Gentoo wiki, they have a separate page for Windows guests on Qemu https://wiki.gentoo.org/wiki/QEMU/Windows_guest

Last edited by qinohe (2022-02-21 18:15:25)

Offline

#4 2022-02-21 19:31:29

Maniaxx
Member
Registered: 2014-05-14
Posts: 758

Re: [SOLVED] QEMU - win10_21H2

I recommend 'virt-manager' as a GUI for QEMU or at least as a starting point. It has many templates for different OS. You can also extract the QEMU cmdline out of the logs if you need it. That's very handy.


sys2064

Offline

#5 2022-02-22 01:29:15

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

Thx interesting info in gentoo article. It seems to suggest LVM is a must for win10 guest.

I did not want first to go that road as I was aiming to create the most platform agnostic image to use both on Intel and ARM host.

I was under the impression that LVM & qcow2 are more efficient… at the cost of portability.

QEMU&raw for portability as priority.

Maybe I got it wrong!

Will check what virt-manager propose. Thx I missed it.

Offline

#6 2022-02-22 01:40:39

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723
Website

Re: [SOLVED] QEMU - win10_21H2

Hi,

You need a better hardware for Win10, haha, just some parameters will fix...

better hardware than the default (pc)

-machine type=q35

but the secret is this...

-cpu host,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-time

I suggest also add

-device qemu-xhci -device usb-tablet

Offline

#7 2022-02-22 01:45:21

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

Thx!

So LVM/Vtio is the only way …

Offline

#8 2022-02-22 08:42:34

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,503

Re: [SOLVED] QEMU - win10_21H2

LVM? Than short for LinuxVolumeManagement which is for Linux not Windows.
Anyway, djgera probably gave some excellent pointers you could add to that script you find on Gentoo wiki.
This would translate into something like:
Like I said before haven't used Windows on Qemu, test it yourself!

#!/bin/sh
exec qemu-system-x86_64 -enable-kvm \
        -machine type=q35 \
        -cpu host,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-time \
        -device qemu-xhci -device usb-tablet \
        -drive file=WindowsVM.img,if=virtio \
        -net nic -net user,hostname=windowsvm \
        -m 1G \
        -monitor stdio \
        -name "Windows" \
        "$@"

This may be a good read too; https://access.redhat.com/articles/2470791

Offline

#9 2022-02-22 09:10:09

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

Thx ... I mixed up ... meant KVM!

Need to find out how to mount 2 cdrom isos at the same time (os & driver/virtio isos) ... should be straight forward but we are in Newbie Corner ;-)

Or should it/can be done in 2 steps? install os then driver?

Last edited by kamelie1706 (2022-02-22 09:31:13)

Offline

#10 2022-02-22 10:53:26

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

Probably need to look into my bios first?

Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

LC_ALL=C lscpu | grep Virtualization

Virtualization:                  AMD-V

zgrep CONFIG_KVM /proc/config.gz

CONFIG_KVM_GUEST=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
CONFIG_KVM_AMD=m
CONFIG_KVM_AMD_SEV=y
CONFIG_KVM_XEN=y
CONFIG_KVM_MMU_AUDIT=y
CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y

lsmod | grep kvm

kvm                  1069056  0
irqbypass              16384  1 kvm

Last edited by kamelie1706 (2022-02-22 10:53:46)

Offline

#11 2022-02-22 11:33:25

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

bios fixed

CONFIG_KVM_GUEST=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
CONFIG_KVM_AMD=m
CONFIG_KVM_AMD_SEV=y
CONFIG_KVM_XEN=y
CONFIG_KVM_MMU_AUDIT=y
CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y
kvm_amd               167936  0
kvm                  1069056  1 kvm_amd
irqbypass              16384  1 kvm
ccp                   126976  1 kvm_amd

My version of the script

#!/bin/sh
exec qemu-system-x86_64 -enable-kvm \
        -machine type=q35 \
        -cpu host,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-time \
        -device qemu-xhci -device usb-tablet \
        -drive file=qemu_win1064.img,if=virtio \
        -boot menu=on \
        -net nic -net user,hostname=windows1064 \
        -m 4G \
        -monitor stdio \
        -name "Windows 10 64 bits" \
        "$@"

Which I launch as

./qemu_win1064.sh -cdrom Win10_21H2_French_x64.iso

but hdd not recognize (missing driver)

Probably need to remove the virtio parameter for the intial install
Going for

#!/bin/sh
exec qemu-system-x86_64 -enable-kvm \
        -machine type=q35 \
        -cpu host,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-time \
        -device qemu-xhci -device usb-tablet \
        -drive file=qemu_win1064.img,format=qcow2 \
        -boot menu=on \
        -net nic -net user,hostname=windows1064 \
        -m 4G \
        -monitor stdio \
        -name "Windows 10 64 bits" \
        "$@"

Last edited by kamelie1706 (2022-02-22 11:40:01)

Offline

#12 2022-02-22 11:45:31

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,862

Re: [SOLVED] QEMU - win10_21H2

Output of

# modprobe kvm_amd

(run as root) ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#13 2022-02-22 11:48:43

Maniaxx
Member
Registered: 2014-05-14
Posts: 758

Re: [SOLVED] QEMU - win10_21H2

What's the output of 'uname -a'?


sys2064

Offline

#14 2022-02-22 11:55:32

kamelie1706
Member
Registered: 2014-02-19
Posts: 176

Re: [SOLVED] QEMU - win10_21H2

In my case just needed to activate virtualization in the bios ... but
Victory!
Now the basic installation is done.
Thx again

Now wondering if I really need those "virtio" drivers ...

[EDIT]
I could have done it from the beginning (missed the line from Gentoo page)

./WindowsVM.sh -boot d -drive file=WINDOWS.iso,media=cdrom -drive file=DRIVER.iso,media=cdrom

So the correct file to install/boot is

#!/bin/sh
exec qemu-system-x86_64 -enable-kvm \
        -machine type=q35 \
        -cpu host,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-time \
        -device qemu-xhci -device usb-tablet \
        -drive file=qemu_win1064.img,format=qcow2,if=virtio \
        -boot menu=on \
        -net nic -net user,hostname=windows1064 \
        -m 4G \
        -monitor stdio \
        -name "Windows 10 64 bits" \
        -drive file=Win10_21H2_French_x64.iso,media=cdrom \
        -drive file=virtio-win-0.1.215.iso,media=cdrom \
        "$@"

Last edited by kamelie1706 (2022-02-22 17:28:00)

Offline

Board footer

Powered by FluxBB