zhaodice / qemu-anti-detection

A patch to hide qemu itself, bypass mhyprot,EAC,nProtect / VMProtect,VProtect, Themida, Enigma Protector,Safegine Shielden
746 stars 113 forks source link

I use qemu after the boot will enter tty and then black screen #11

Closed YinBuLiao closed 1 year ago

YinBuLiao commented 1 year ago

I use qemu after the boot will enter tty and then black screen.I've checked the logs and everything is fine Win10.logs: 2023-04-15 10:22:44.005+0000: starting up libvirt version: 8.0.0, package: 1ubuntu7.4 (Christian Ehrhardt <christian.ehrhardt@canonical.com> Tue, 22 Nov 2022 15:59:28 +0100), qemu version: 7.0.0v7.0.0-dirty, kernel: 5.19.0-38-generic, hostname: yinbuliao-Z390-AORUS-Ultra-Gaming LC_ALL=C \ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin \ HOME=/var/lib/libvirt/qemu/domain-1-win10 \ XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-1-win10/.local/share \ XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-1-win10/.cache \ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-1-win10/.config \ DISPLAY=:0.0 \ MESA_LOADER_DRIVER_OVERRIDE=i965 \ /usr/bin/qemu-system-x86_64 \ -name guest=win10,debug-threads=on \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-1-win10/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/OVMF/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/win10_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \ -machine pc-q35-6.2,usb=off,vmport=off,dump-guest-core=off,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,memory-backend=pc.ram \ -accel kvm \ -cpu host,migratable=on,topoext=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff \ -m 30000 \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":31457280000}' \ -overcommit mem-lock=off \ -smp 12,sockets=1,dies=1,cores=6,threads=2 \ -uuid 5066fca7-4f37-4fb3-9c86-d087269e9712 \ -display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=30,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=localtime,driftfix=slew \ -global kvm-pit.lost_tick_policy=delay \ -no-hpet \ -no-shutdown \ -global ICH9-LPC.disable_s3=1 \ -global ICH9-LPC.disable_s4=1 \ -boot strict=on \ -device pcie-root-port,port=16,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \ -device pcie-root-port,port=17,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \ -device pcie-root-port,port=18,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \ -device pcie-root-port,port=19,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \ -device pcie-root-port,port=20,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 \ -device pcie-root-port,port=21,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5 \ -device pcie-root-port,port=22,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x6 \ -device pcie-root-port,port=23,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x7 \ -device pcie-root-port,port=24,chassis=9,id=pci.9,bus=pcie.0,multifunction=on,addr=0x3 \ -device pcie-root-port,port=25,chassis=10,id=pci.10,bus=pcie.0,addr=0x3.0x1 \ -device pcie-root-port,port=26,chassis=11,id=pci.11,bus=pcie.0,addr=0x3.0x2 \ -device pcie-root-port,port=27,chassis=12,id=pci.12,bus=pcie.0,addr=0x3.0x3 \ -device pcie-root-port,port=28,chassis=13,id=pci.13,bus=pcie.0,addr=0x3.0x4 \ -device pcie-root-port,port=29,chassis=14,id=pci.14,bus=pcie.0,addr=0x3.0x5 \ -device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.2,addr=0x0 \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 \ -blockdev '{"driver":"file","filename":"/home/yinbuliao/KVM/win10.qcow2","node-name":"libvirt-1-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"discard":"unmap","cache":{"direct":false,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage","backing":null}' \ -device virtio-blk-pci,bus=pci.4,addr=0x0,drive=libvirt-1-format,id=virtio-disk0,bootindex=2,write-cache=on \ -netdev tap,fd=32,id=hostnet0 \ -device e1000e,netdev=hostnet0,id=net0,mac=52:54:00:f4:cf:bf,bus=pci.1,addr=0x0 \ -audiodev '{"id":"audio1","driver":"spice"}' \ -chardev spicevmc,id=charredir0,name=usbredir \ -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 \ -chardev spicevmc,id=charredir1,name=usbredir \ -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 \ -device vfio-pci,host=0000:08:00.0,id=hostdev0,bus=pci.6,addr=0x0 \ -device vfio-pci,host=0000:08:00.1,id=hostdev1,bus=pci.7,addr=0x0 \ -device usb-host,hostdevice=/dev/bus/usb/001/002,id=hostdev2,bus=usb.0,port=4 \ -device usb-host,hostdevice=/dev/bus/usb/003/002,id=hostdev3,bus=usb.0,port=5 \ -device usb-host,hostdevice=/dev/bus/usb/003/003,id=hostdev4,bus=usb.0,port=6 \ -device virtio-balloon-pci,id=balloon0,bus=pci.5,addr=0x0 \ -smbios type=0,version=UX305UA.201 \ -smbios type=1,manufacturer=ASUS,product=UX305UA,version=2021.1 \ -smbios 'type=2,manufacturer=Intel,version=2021.5,product=Intel i9-13900K' \ -smbios type=3,manufacturer=XBZJ \ -smbios type=17,manufacturer=KINGSTON,loc_pfx=DDR5,speed=4800,serial=000000,part=0000 \ -smbios type=4,manufacturer=Intel,max-speed=4800,current-speed=4800 \ -cpu 'host,family=6,model=158,stepping=2,model_id=Intel(R) Core(TM) i9-13900K CPU @ 2.60GHz,vmware-cpuid-freq=false,enforce=false,host-phys-bits=true,-hypervisor,+kvm_pv_unhalt,+kvm_pv_eoi,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_reset,hv_vpindex,hv_runtime,hv_relaxed,kvm=off,hv_vendor_id=intel' \ -smp 12,cores=12,threads=1,sockets=1 \ -machine q35,kernel_irqchip=on \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on audio: Could not initspice' audio driver audio: warning: Using timer based audio emulation`

YinBuLiao commented 1 year ago

This is my KVM Settings: `

win10 5066fca7-4f37-4fb3-9c86-d087269e9712 30720000 30720000 12 hvm /usr/share/OVMF/OVMF_CODE.fd /var/lib/libvirt/qemu/nvram/win10_VARS.fd destroy restart destroy /usr/bin/qemu-system-x86_64
YinBuLiao commented 1 year ago

libvirtd.log: https://pastebin.com/vMWYcAC9 custom_hooks.log: https://pastebin.com/Q9pbZ6Bb win10.log: https://pastebin.com/Rd5btjpZ

zhaodice commented 1 year ago

你把qemu的窗口,截屏让康康

YinBuLiao commented 1 year ago

你把qemu的窗口,截屏让康康

啥qemu窗口

zhaodice commented 1 year ago

你把qemu的窗口,截屏让康康

啥qemu窗口

你不是说黑屏吗,截屏现象

YinBuLiao commented 1 year ago

你把qemu的窗口,截屏让康康

啥qemu窗口

你不是说黑屏吗,截屏现象

进入虚拟机电脑就黑屏了,显示的无信号

zhaodice commented 1 year ago

哈,你是台式机还是笔记本电脑?,如果是台式机有没有核显

YinBuLiao commented 1 year ago

台式机,没有核显

zhaodice commented 1 year ago

那可不行!显卡直通相当于虚拟机独占了你的显卡,会导致主机没显卡用。

YinBuLiao commented 1 year ago

我之前都可以用,就这次出问题了

Samuil1337 commented 1 year ago

Make sure that your graphics card is added as a "PCI host device" to your VM.

zhaodice commented 1 year ago

能截屏一下你的qemu的设置界面吗,我看看你显卡选了什么

zhaodice commented 1 year ago

Make sure that your graphics card is added as a "PCI host device" to your VM.

he said that he encountered black screen (computer monitor) after he passthoughed the graphic card(only one )

YinBuLiao commented 1 year ago

image

Samuil1337 commented 1 year ago

Make sure that your graphics card is added as a "PCI host device" to your VM.

he said that he encountered black screen (computer monitor) after he passthoughed the graphic card(only one )

Thanks, I am using Google Translate. ^^

YinBuLiao commented 1 year ago

KVM Settings: https://pastebin.com/1TVNYhkh

Samuil1337 commented 1 year ago

For me it happened too, because I didn't add the graphics card in the XML, but he did. @YinBuLiao, do you have vendor_id set, because I have heared that NVIDIA is black screening people if not.

zhaodice commented 1 year ago

把virtio串口删了,因为virtio属于虚拟机设备,会被检测,所以这个patch把virtio操掉了。

YinBuLiao commented 1 year ago

把virtio串口删了,因为virtio属于虚拟机设备,会被检测,所以这个patch把virtio操掉了。

好的我试试

zhaodice commented 1 year ago

virtio硬盘换成SATA或者IDE

zhaodice commented 1 year ago

For me it happened too, because I didn't add the graphics card in the XML, but he did. @YinBuLiao, do you have vendor_id set, because I have heared that NVIDIA is black screening people if not.

I have removed virtio device because it belongs VIRTUAL MACHINE that can be detected, the problem is virtual machine starts failure , so no display on graphic card

Samuil1337 commented 1 year ago

Yes, but does his release script trigger and restart Xorg? If his monitor stays in the black screen state , this would mean that the VM is on, but there is no output.

YinBuLiao commented 1 year ago

virtio硬盘换成SATA或者IDE

我删了virtio串口并把硬盘改成了sata 开启虚拟机还是显示无信号

zhaodice commented 1 year ago

virtio硬盘换成SATA或者IDE

我骗了virtio串口并把硬盘改成了sata 开启虚拟机还是显示无信号

我的Proxmox也有这个问题,开机独显输出黑屏,后来我给主板的HDMI插了个HDMI欺骗器重启就正常了,很奇怪就是,但鉴于你没有核显这个方法应该对你没什么用?试试看吧,你关机,HDMI插主机主板上,开机后再把HDMI线转移到显卡上再试试看

YinBuLiao commented 1 year ago

好的 我有空试试 我要出门了

zhaodice commented 1 year ago

Yes, but does his release script trigger and restart Xorg? If his monitor stays in the black screen state , this would mean that the VM is on, but there is no output.

it is possible, qemu can hold graphic card and keep running but no signal output in monitor

Samuil1337 commented 1 year ago

Yeah, if the VM worked, but after the patch it doesn't it is obvious that something went wrong there. Maybe he could try to clone the VM and reinstall Windows with the SATA disk bus.

zhaodice commented 1 year ago

Yeah, if the VM worked, but after the patch it doesn't it is obvious that something went wrong there. Maybe he could try to clone the VM and reinstall Windows with the SATA disk bus.

I think it is not related to OS, because if your graphic work, at least, it should show UEFI Logo

zhaodice commented 1 year ago

你是UEFI 引导的还是BIOS? win10建议UEFI,试试看新建个WIN10 UEFI 虚拟机,直接用SATA硬盘而且移除所有virtio设备,然后CD选择系统iso,显卡直通后,看看能不能出现系统的安装界面

zhaodice commented 1 year ago

哦对了,改完硬盘你注意看一下引导选项~是不是没把SATA盘加进引导列表

YinBuLiao commented 1 year ago

我是UEFI引导 我等会看一下有没有把sata盘加引导

YinBuLiao commented 1 year ago

image新建里面没有OVMF_CODE了

YinBuLiao commented 1 year ago

进系统了 原因就是因为固件用错了

YinBuLiao commented 1 year ago

现在虚拟机性能有所下降只有一个核心在跑5`BS{K0TS AHM4Z`MK$MF06

zhaodice commented 1 year ago

现在虚拟机性能有所下降只有一个核心在跑5BS{K0TS AHM4ZMK$MF06

那你就把CPU信息改改 <qemu:arg value="-cpu"/> <qemu:arg value="host,family=6,model=158,stepping=2,model_id=Intel(R) Core(TM) i9-12900K CPU @ 2.60GHz,vmware-cpuid-freq=false,enforce=false,host-phys-bits=true,-hypervisor,+kvm_pv_unhalt,+kvm_pv_eoi,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_reset,hv_vpindex,hv_runtime,hv_relaxed,kvm=off,hv_vendor_id=intel"/> 可能是这里伪装了CPU导致虚拟机无法正确有效优化CPU调度 改成这个试试看 <qemu:arg value="-cpu"/> <qemu:arg value="host,vmware-cpuid-freq=false,enforce=false,host-phys-bits=true,-hypervisor,+kvm_pv_unhalt,+kvm_pv_eoi,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_reset,hv_vpindex,hv_runtime,hv_relaxed,kvm=off,hv_vendor_id=intel"/>

YinBuLiao commented 1 year ago

试了一下还是掉帧

zhaodice commented 1 year ago

试了一下还是掉帧

那你再调整一下那个参数呗