Jump to content

Insanely fast virtual Mac (QEMU, OVMF, Clover and native graphics)


514 posts in this topic

Recommended Posts

 

Hi,

 

I have i even tried using 

sudo brctl ..
sudo brctl addif...

But this did not make to seem a difference.

 

I am executing the VM with sudo like so:

sudo ./hackintosh

According to that error, you are trying to do something that is not supported. Type following and post it back, so we can see what the appropriate way to do it:

man brctl

Edit: nevermind. google helped. So according to this:

The command brctl addif <brname> <ifname> will make the interface <ifname> a port of the bridge <brname>. This means that all frames received on <ifname> will be processed as if destined for the bridge. Also, when sending frames on <brname>, <ifname> will be considered as a potential output interface.

So maybe you could try to add the interface (wlp2s0 in your case) to the bridge (br0). Just switch the parameters.

Link to comment
Share on other sites

The command look fine to me, the work for a wired Ethernet adapter just fine as I revisited this last night but I didn't get time to try my USB wifi adapter.

 

@mac, are you working purely in terminal or do you have a desktop installed? I did a clean install of Ubuntu 16.04 and had a mare with the network-manager package and the standard network management scripts...I ended up removing network-manager as I've always used /etc/network/interfaces to specific my configs for networking. If you do have a desktop you could also use the virt-manager package to modify the network spec's although this will suffer also from any conflicts as you might be having with the network-manager package.

 

Have you tried setting this up as a boot time config so you don't have to do it by hand?

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

@KillerKelvUK

 

I have a desktop environment installed. I am using gnome 3, on arch linux. Kernel version 4.5.1

 

I am also using network manager. I have used netctl but netctl and networkManager dont work well together. I do have some problems with networkManager but thats mainly after reboot. Once it does work there are no problems with it. 

 

I have not tried setting this up so that it just does it after boot. This is personal preference. I would like a script to do this for me which  I execute manually.

 

@smolderas

Switching parameters didn't bring any change.

Link to comment
Share on other sites

@KillerKelvUK

 

I have a desktop environment installed. I am using gnome 3, on arch linux. Kernel version 4.5.1

 

I am also using network manager. I have used netctl but netctl and networkManager dont work well together. I do have some problems with networkManager but thats mainly after reboot. Once it does work there are no problems with it. 

 

I have not tried setting this up so that it just does it after boot. This is personal preference. I would like a script to do this for me which  I execute manually.

 

@smolderas

Switching parameters didn't bring any change.

 

Hi,

 

I am using Arch Linux also and for my host networking I completely disable NetworkManager and use systemd-networkd instead of netctl. First you must start and enable systemd-netword and systemd-resolved services. I used the steps described in https://wiki.archlinux.org/index.php/systemd-networkd

 

I have a single wired network, but it should be the same with wireless network. I created the bridge by supplying these 3 configuration files:

 

/etc/systemd/network/20-collect-br0.network:

[Match]
Name=en*

[Network]
Bridge=br0

/etc/systemd/network/21-create-br0.netdev:

[NetDev]
Name=br0
Kind=bridge

/etc/systemd/network/22-config-br0.network:

[Match]
Name=br0

[Network]
Address=192.168.0.10
Gateway=192.168.0.1
DNS=192.168.0.11
DNS=192.168.0.1
Metric=10

Here's my QEMU network snippet lines:

# Network
OPTS="$OPTS -netdev tap,vhost=on,id=brlan"
OPTS="$OPTS -device e1000-82545em,mac=$(/usr/local/bin/qemu-mac-hasher $VM_NAME),netdev=brlan"

The qemu-mac-hasher script borrowed from https://wiki.archlinux.org/index.php/QEMU

 

Hope it helps you, Maclarentosh.

 

Anyway, does somebody had any success passing through PulseAudio's sound to the guest Hackintosh? 

Link to comment
Share on other sites

  • 2 weeks later...

Hi for those who want to passthrough dynamically usb devices to VM from HOST and vice versa and are using qemu command, you can just use https://www.virtualhere.com/, which enables passing USB device over LAN. It's so seamless solution that I am really surprised how good it works. For example right now I am creatings usb installation media with osx from my OSX VM which runs on Arch through qemu and this is only reaction I am able to do :drool:

Link to comment
Share on other sites

Has anyone managed to get a libvirt xml configuration for any OSX?  I am able to run OSX just fine via qemu on the command line, but I'd like to manage my instances with libvirt, virt-manager, and virsh.  A nearly identical xml configuration to a working command-line just comes up with the ++++++++ clover boot and nothing else.

Link to comment
Share on other sites

@pashdown, yes all working via virt-manager. You say the qemu command line differs when run by virt-manager to your manual qemu lines...how do they differ?

 

Here is the ps output of the working command line (line breaks mine):

/usr/bin/qemu-system-x86_64 -rtc clock=vm,base=2016-01-01T16:01:21 -m 4096 -enable-kvm \
 -cpu core2duo,vendor=GenuineIntel -rtc base=localtime -smbios type=2 -machine q35,accel=kvm,usb=off,vmport=off \
 -bios /usr/share/OVMF/OVMF_CODE.fd -smp 4,sockets=1,cores=2,threads=2 \
 -device isa-applesmc,osk=supersekrettextthateveryoneknows -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 -device ahci,id=sata0,bus=pci.2,addr=0x5 \
 -drive file=/var/lib/libvirt/images/clover-usb-disk.dd,if=none,id=drive-sata0-0-2,format=raw \
 -device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
 -drive file=/dev/vm/elcapitan,if=none,media=disk,id=drive-sata0-0-0,format=raw \
 -device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 -usb \
 -device usb-mouse -device usb-kbd -serial stdio \
 -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16 -vnc :9

The ps output of the non-working libvirt command:

qemu-system-x86_64 -enable-kvm -name elcapitan -S -machine pc-q35-2.5,accel=kvm,usb=off \
 -cpu core2duo -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
 -drive file=/var/lib/libvirt/qemu/nvram/ElCapitan_VARS.fd,if=pflash,format=raw,unit=1 \
 -m 8192 -realtime mlock=off -smp 4,sockets=1,cores=2,threads=2 \
 -uuid 5b922d69-af86-450f-8480-d8277fda6970 -no-user-config -nodefaults \
 -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-elcapitan/monitor.sock,server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime -no-shutdown \
 -boot strict=on -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
 -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x4.0x7 \
 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x4 \
 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x4.0x1 \
 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x4.0x2 \
 -drive file=/var/lib/libvirt/images/clover-usb-disk.dd,format=raw,if=none,id=drive-sata0-0-2 \
 -device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
 -drive file=/dev/vm/elcapitan,format=raw,if=none,id=drive-sata0-0-3,cache=none,aio=native \
 -device ide-hd,bus=ide.3,drive=drive-sata0-0-3,id=sata0-0-3 \
 -netdev tap,fd=31,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:88:89:43,bus=pci.2,addr=0x1 \
 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 \
 -device usb-mouse,id=input0 -device usb-kbd,id=input1 
 -vnc :9 -k en-us -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16,bus=pcie.0,addr=0x2 \
 -device isa-applesmc,osk=supersekrettextthateveryoneknows -usb -smbios type=2 -msg timestamp=on

Thanks for any insight you can lend!  I have no hair left.

Link to comment
Share on other sites

What's the osx-bios.bin file from your working qemu cmd line, is that just a renamed OVMF or something else?

 

If I had to guess from the above your manual qemu does NOT efi boot but your libvirt cmd does. Suggests your clover image lacks the UEFI drivers to locate your boot disk.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

@passdown...just revisited your post and remembered something weird with the libvirt xml for OVMF.  Libvirt will attempt to wrap the OVMF image into a specific xml format associated to Q35 using the OVMF_VARS flash, if I recall correctly I couldn't get a working boot from this as it conflicted with Clover somehow (your ++++++ and no more problem).  Try changing the xml of your guest to replace both the <loader> and <nvram> parameters with this single line...

<loader type='rom'>/usr/share/OVMF/OVMF_CODE.fd</loader>
  • Like 1
Link to comment
Share on other sites

What's the osx-bios.bin file from your working qemu cmd line, is that just a renamed OVMF or something else?

 

If I had to guess from the above your manual qemu does NOT efi boot but your libvirt cmd does. Suggests your clover image lacks the UEFI drivers to locate your boot disk.

 

 

osx-bios.bin was just a manually compiled OVMF.  I get the same results using that and the Ubuntu 16.04 OVMF files.

 

You have it backwards.  The manual qemu line does boot and libvirt sticks on the ++++++++++ boot.  They're both using the same clover image.

Link to comment
Share on other sites

 

@passdown...just revisited your post and remembered something weird with the libvirt xml for OVMF.  Libvirt will attempt to wrap the OVMF image into a specific xml format associated to Q35 using the OVMF_VARS flash, if I recall correctly I couldn't get a working boot from this as it conflicted with Clover somehow (your ++++++ and no more problem).  Try changing the xml of your guest to replace both the <loader> and <nvram> parameters with this single line...

<loader type='rom'>/usr/share/OVMF/OVMF_CODE.fd</loader>

 

Hey that did the trick.  I'll post my libvirt xml for others to reference after I tune it up a bit.

Link to comment
Share on other sites

Now I can't get link to come up on the virtio ethernet.  The device is there, but the link isn't coming up.  According to https://github.com/pmj/virtio-net-osx/issues/3#issuecomment-213765444 , it just requires vectors=0, but my attempts to stick that in as an argument in the xml fail.

Not gone back to try the virtio net drivers, built my mac guest a good while ago now so used the e1000-82545em device which gives gig throughput so no performance impedance that I've noticed.

 

The vectors=0 parameter will likely need a custom qemu line for the network adapter within the XML like how your OSK is added i.e. the qemu:arg lines.

Link to comment
Share on other sites

Found that I needed "e1000-82545em" instead of just the plain "e1000".  Here's my xml for a working system.  I hope it helps others:

<domain type='kvm' id='109' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>elcapitan</name>
  <uuid>69696969-afaf-4545-6969-c0ffeebeef69</uuid>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.5'>hvm</type>
    <loader type='rom'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <topology sockets='1' cores='2' threads='2'/>
  </cpu>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/vm/elcapitan'/>
      <backingStore/>
      <target dev='sdb' bus='sata'/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <model name='i82801b11-bridge'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <model name='pci-bridge'/>
      <target chassisNr='2'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='ab:cd:ef:01:23:45'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet5'/>
      <model type='e1000-82545em'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x05' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='usb'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='usb'>
      <alias name='input2'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' port='5905' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='qxl' ram='131072' vram='65536' vgamem='65536' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='none'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=thequickbrownstringjumpedoverthelazydog'/>
  </qemu:commandline>
</domain>

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

So i decided to use virt-manager for the VM. Everything is working fine right now except for the network again. 

 

I am not running virt-manager as root, and i am user the user session.

 

Is there a way to access the default network bridge (started with root), using the user session. The network is started and working but it only shows up for the root connection and not the user session connection.

 

Thanks

Link to comment
Share on other sites

Hello,

 

I can´t make the audio work, I always get no audio codec detected. The board is a Asus Z87 Deluxe (ALC1150).

 

line to pass the audio   -device vfio-pci,host=00:1b.0,id=sound-device,bus=pcie.0,addr=0x1b

 

Thank

Can someone point me how to configure clover properly in order to get the codec id detected?

 

Thank you

Link to comment
Share on other sites

To those who got a working OS X vm with or without GPU passthrough:

how much CPU is used on the host side when the OSX vm is idling?

 

My host uses 15-20% CPU when the OSX vm is idling (1-2% CPU usage in the guest), and I wonder if it's normal...

Link to comment
Share on other sites

To those who got a working OS X vm with or without GPU passthrough:

how much CPU is used on the host side when the OSX vm is idling?

 

My host uses 15-20% CPU when the OSX vm is idling (1-2% CPU usage in the guest), and I wonder if it's normal...

Not in my case, using ubuntu16 1-3% cpu load in guest and host. What I also see is that the "memory usage" graphic in virt-manager is incorrect, showing always as full.

Apart from this, I got the same results in cinebench in the vm and  as a "native hackintosh" (i5 4590 and ATI 5750)

post-151018-0-02481100-1464283248_thumb.png

  • Like 1
Link to comment
Share on other sites

Hi,

 

So i decided to use virt-manager for the VM. Everything is working fine right now except for the network again. 

 

I am not running virt-manager as root, and i am user the user session.

 

Is there a way to access the default network bridge (started with root), using the user session. The network is started and working but it only shows up for the root connection and not the user session connection.

 

Thanks

So my bridge is created using the /etc/network/interface script on boot, not sure if this is your method or not?

 

Working xml using my bridge as below, virt-man running as the session user i.e. non-root...

<interface type='bridge'>
      <mac address='xx:xx:xx:xx:xx:xx'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
</interface>

Can someone point me how to configure clover properly in order to get the codec id detected?

 

Thank you

You've not said what the audio device is i.e. is it a dedicated sound card and have you confirm there is an OS X driver for it?  I passthrough my GTX970's audio device (HDMI) and then inject via clover the HDMIAudio-1.0.dmg to enable it in OS X.

Link to comment
Share on other sites

My host uses 15-20% CPU when the OSX vm is idling (1-2% CPU usage in the guest), and I wonder if it's normal...

 

Does this only happen when you pass something through? Then it might be connected with the KVM halt_poll_ns parameter. In newer kernels this value has been above 400.000 which creates CPU load with different guests. In most recent kernels this is fixed (at least for windows guest) by setting it to 400.000, but my linux guest needs a value of 100.000.

Look at /sys/module/kvm/parameters/halt_poll_ns on your host and try to lower it to 400.000 or 100.000 and then set it permanently via an modprobe.d entry:

options kvm halt_poll_ns=100000

I've got another problem:

I've managed to boot and install El Capitan 10.11.5 with libvirtd/virt-manager and minimal xml edits, partially following this guide: https://gist.github.com/gordonturner/2a2e5ecde5e7860b52e2. But as soon as I try to pass through my GPU, after Clover tries to boot OSX, I can either see the pluses '++++++' on the GPU-connected display or the frozen white Apple Logo (when booting without the '-v'-Paramter), but nothing else. In case of the pluses (verbose mode) with most tests the display turns off / shows no signal after several seconds.

BUT I can connect via VNC to the guest.

 

What I tested:

  • GT 630 with DVI, HDMI(-DVI-Adapter), VGA-out / 750Ti with DVI-out
  • nv_disabled=1 / nv_disabled=1 & nvda_drv=1 / nvda_drv=1 (nvidia Web drivers installed without passed GPU from spice/vnc-connection)
  • with / without nvidia injection
  • my libvirtd xml / qemu commands that others have successfully used
  • different resolutions set in clover. After increasing it above 1280x1024, clover still grew up to 1920x1200, but within the VNC-connection I only have 1280x1024.
  • single <loader> line (necessary to boot at all)

interesting log entries: nvda::rmstart failed followed by multiple NVDA,Display-A: Not usable

 

I have no idea if this is a virtualization problem or clover/nvidia related.

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...