macOS Ventura VM with USB audio passthrough

…on Arch Linux.

  1. OneClick macOS Simple KVM
    (based on foxlet/macOS-Simple-KVM)

    1. git clone https://github.com/notAperson535/OneClick-macOS-Simple-KVM
    2. Follow their setup docs, recommended: Manual Method. Jist:
      1. ./fetch-macOS-v2.py # pick Ventura
      2. qemu-img convert BaseSystem.dmg -O raw BaseSystem.img
      3. qemu-img create -f qcow2 macOS.qcow2 64G
      4. copy/change basic.sh: look for $VMDIR and $OVMF and make sure they point to the correct paths/files.
      5. run your basic.sh
      6. run Disk Utility, Erase that ~64GB disk, name it something useful
      7. run Installer
      8. several reboots during install, pick the Install volume when that happens, until our volume pops up
  2. give us USB permissions: chown -R myuser /dev/bus/usb
    TODO: find a better permanent solution
  3. Connect QEMU Monitor
    1. telnet 127.0.0.1 5801 (see port in basic.sh)
    2. info usb, then info usbhost
  4. Add USB device. See QEMU docs and Arch QEMU wiki: Pass through host USB device
    1. get vendorid+productid from lsusb or info usbhost, e.g.:
      Bus 2, Addr 64, Port 3.4.2, Speed 480 Mb/s
      Class ef: USB device 1397:0509, UMC404HD 192k
    2. Add a line to basic.sh, before MOREARGS:
      -device usb-ehci,id=ehci -device usb-host,bus=ehci.0,vendorid=0x1397,productid=0x0509,id=behringer \
  5. Check
    1. in QEMU Monitor
    2. in macOS System Report › Hardware/USB + Hardware/Audio
    3. macOS System Settings › Sound › Output & Input

TODO

  • what happens if the device doesn’t exist
  • the Behringer sounds terribly datamoshed

invoke oomkiller via SysRq on Arch Linux on a Thinkpad T450s

Note: I have Ctrl/Fn swapped via bios.
Prerequisite: SysRq has to be enabled:

sysctl kernel.sysrq=1

Then

  1. Hold Fn+Ctrl+Alt+S
  2. Release all but Alt, keep holding Alt
  3. now we’re effectively in Alt+SysRq+…, and can hit the final key for magic function:
    b = reboot
    e = terminate all processes
    i = kill all processes
    h = dump help to kernel log, and finally:
    f = invoke OOM killer

Troubleshoot/test:

  • run a dmesg -w, watch what happens, especially with h
  • xev should report Sys_Req after Fn+Ctrl+Alt+S, among all the modifiers

Make persistent

# /etc/systemd/sysrq.service
[Unit]
Description=Enable SysRq key

[Service]
Type=oneshot
ExecStart=sysctl kernel.sysrq=1

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl enable sysrq.service