
Looking Glass: Run a Windows VM on Linux in a Window with Native Performance - cercatrova
https://looking-glass.hostfission.com/
======
jchw
This works well for the most part. However, there are some things worth
considering.

For one, the frame relay program will need to start in your guest before
Looking Glass can connect. Last I checked the best you can do is have it start
at login, so you need autologin to have a somewhat seamless setup.

Secondly, the cursor is sent through using the SPICE protocol, which is
convenient. Unfortunately Looking Glass has no support for also handling
audio, and no intent to merge such functionality in the future. So if you want
audio, you’ll have to set up Qemu to forward audio directly to the host.

Finally, GPU passthrough setups is the thing that sold me on NixOS. If you’re
a fairly experienced Linux user, setting up this complicated and multifaceted
setup in a mostly reproducible way using a single file of configuration is
pretty pleasing. Most of my configuration was this:

[https://gist.github.com/jchv/b0e4b39679e450536a17cc6a5d69169...](https://gist.github.com/jchv/b0e4b39679e450536a17cc6a5d69169a)

Really, all you need is to substitute the right IDs and it should practically
work anywhere, all you have to do is setup a VM with the requirements met
(UEFI, PCI-e device passthrough, Looking Glass device attached, and KVM FR
server running) and run Looking Glass.

Ultimately, I dropped Looking Glass and GPU passthrough. It was a little
cumbersome and performance wasn’t perfect. I ran GPU passthrough on a physical
monitor for a little while, and then dropped it entirely after finding out
that Steam Proton and Wine actually covered all of my bases anyways.

~~~
tbenst
Huh, cool! I’d love to run Illustrator/Photoshop on my NixOS box. I presume
you use looking-glass-client from nixpkgs. Any other parts of the config you
can share/recommend?

~~~
jchw
Not that I can recall! Yeah, I was using that one. In fact, when I wanted to
upgrade, I actually submitted PRs to Nixpkgs for it. In the meantime, though,
you can of course just use overlays or overrides to get a more up to date
looking-glass-client in your local setup.

Now, that does actually bring up at least one nice bit of configuration, which
is how to configure your overlays to be consistent system-wide. It's covered
on the wiki. I'll be honest, I still find overlays a little bit confusing, but
I eventually got this setup working. It has a lot of advantages over other
methods, my favorite of which is that all of my overlay stuff is consistent
across the machine and stored in my Git-versioned NixOS configuration. You
might already have this, but it's worth noting.

[https://nixos.wiki/wiki/Overlays#Using_nixpkgs.overlays_from...](https://nixos.wiki/wiki/Overlays#Using_nixpkgs.overlays_from_configuration.nix_as_.3Cnixpkgs-
overlays.3E_in_your_NIX_PATH)

Other than that and setting up the libvirt box, there wasn't really much else
to it. I had it done in an hour or two. Pretty sure the only other NixOS
configuration I had was setting my user to be in the `libvirtd` group.

------
cercatrova
I saw a recent thread about running an X server on Windows for Linux
applications, and this is sort of the opposite. You can run a Windows VM with
GPU passthrough on a Linux host and if you want to run them side by side
without switching windows, you can use a VNC window or other, but the problem
is you don't get hardware acceleration. Looking Glass solves this by copying
the Windows GPU frame buffer onto the Linux side so it can be read
transparently. It's also open source.

Source:
[https://github.com/gnif/LookingGlass](https://github.com/gnif/LookingGlass)
Quickstart: [https://looking-
glass.hostfission.com/wiki/Installation](https://looking-
glass.hostfission.com/wiki/Installation) Reddit discussion:
[https://old.reddit.com/r/vfio](https://old.reddit.com/r/vfio)

This only works on a Linux host with Windows. There have been rumors that
Apple might implement their own version for running perhaps a Windows VM or
other VM transparently on a macOS host but those are just based on some virtIO
development that seems to be going on in macOS. Or maybe it's to virtualize
iOS or iPadOS, who knows?

Personally I use Proxmox, which is a Linux hypervisor based on QEMU / KVM but
with other features and a web GUI for administration, to run Windows, macOS,
and Linux simultaneously, as well as host containers for side projects and
other self hosted services.

~~~
beagle3
What's your experience with running macOS under ProxMox? Do you have a guide
for that you can point to?

~~~
cercatrova
Nick Sherlock has great guides:
[https://www.nicksherlock.com/2019/10/installing-macos-
catali...](https://www.nicksherlock.com/2019/10/installing-macos-
catalina-10-15-on-proxmox-6/)

I'd recommend trying to use OpenCore instead of Clover though. It's more
stable even in a VM, and you don't need all the kexts as what the kexts are
emulating for a bare metal machine are, in fact, emulated already as a VM.

You can also check out /r/Hackintosh, they have some info on it.

------
DoofusOfDeath
Slightly off-topic:

I'm getting ready to build a new Linux gaming PC. I'm considering installing
Windows 10 in a guest VM so I can run a few modern games that do poorly under
Steam / Proton.

Anyone suggestions for good sources of info regarding which software stacks
(e.g., Ubuntu 19.10 + VMWare) are likely to provide a good experience?
Graphics performance matters.

I'm unwilling to run Windows 10 as the _host_ OS because of personal feelings
about telemetry.

~~~
pvik
My main desktop runs Linux, I do have a Windows VM (on qemu/libvirt) that I
use primarily for Fusion360 and some gaming.

I had to setup GPU passthrough with a second GPU for this.

It is not that hard, you will however need to make sure your motherboard
supports proper IOMMU grouping. This however, is the tricky part since most
motherboard manufacturers do not really provide this information.

[1] More info on ArchWiki:
[https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVM...](https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF)

~~~
DoofusOfDeath
So IIUC your approach, you're exposing the actual GPU to the guest OS via PCI-
passthrough. And in practice that means you'll want two GPUs: one for the host
and one for the guest.

But looking at the online docs for VMWare Workstation, it sounds like they
take a different approach: the guest VM has a _virtual_ device driver that
lets both host and guest OSs use the same GPU at the same time.

I would think the VMWare Workstation-like approach is preferred, because it
avoids the hassle of using two graphics cards. I know that Workstation is
expensive ($250) and not OSS. Besides those two reasons, are there still
reasons to prefer the PCI-passthrough approach?

~~~
comex
> Besides those two reasons, are there still reasons to prefer the PCI-
> passthrough approach?

The software approach generally has lousy performance due to the extra
overhead of forwarding rendering commands between the guest and host. In
addition, since this approach requires writing a completely new graphics
driver for the guest, there tend to be limitations with rendering API
compatibility, as well as bugs. With the hardware approach, the guest can use
the GPU vendor’s normal driver.

------
zelon88
On a side note, this is an excellent landing page. My first thought when
looking at the title was "I wonder if it does VGA pass-through." The second
line of the landing page answered my question. Good job on the details so far!
Can't wait to test it out.

------
devit
As far as I can tell you need two GPUs and all this does is efficiently copy
the second GPU (assigned to a VM) output to a window on the main GPU (assigned
to the host).

This seems mostly useful for laptops with both integrated and discrete GPUs
but no extra monitor output and for non-fullscreen 3D on desktops, since for
fullscreen 3D on desktop you can just run a second cable to the monitor, which
will be faster and allows the guest to drive monitor sync.

~~~
serf
>This seems mostly useful for laptops with both integrated and discrete GPUs
but no extra monitor output and for non-fullscreen 3D on desktops, since for
fullscreen 3D on desktop you can just run a second cable to the monitor, which
will be faster and allows the guest to drive monitor sync.

i've been doing it for years (albeit with qemu), even with additional monitors
available.

It's nice to keep your workflow where you want it. I use a unix-alike OS
nearly always, but work will inevitably pull me into a windows software
that'll bitch about GPU acceleration (say.. autodesk fusion) even if it
doesn't need it for the task.

It's nice to keep that window where I want it. Sure, I loses sync/cec stuff,
but I can drag that window across my entire workspace of monitors, and that's
pretty powerful when you're stuck in a VM for a single piece of software.

When I use a VM for gaming, that's when I run the GPU by itself to a separate
monitor. Gaming VMs are ran weirdly anyway -- it'd probably have access to an
entire block device rather than some VDI equivalent, PCI access, etc. That's
more like just running two computers off of one mainboard at that point; not
much to keep isolation sanitary.

~~~
NikolaeVarius
Can you play multiplayer games and not get banned?

~~~
lostlogin
I haven’t heard of this. Why is gaming from a VM blocked?

~~~
NikolaeVarius
[https://www.change.org/p/bungie-inc-allow-linux-users-to-
pla...](https://www.change.org/p/bungie-inc-allow-linux-users-to-play-
destiny-2)

~~~
derimagia
Looks like that's for running it on linux via proton, not running on a VM.

------
LambdaB
Funny coincidence to have this article on the front page while fixing the last
sentences in my blog post. This post might help some people in regard to audio
passthrough with PulseAudio in QEMU/KVM, which had a lot of problems until
recently. Check it out: [https://bitkeks.eu/blog/2020/04/compile-qemu-42-on-
debian-bu...](https://bitkeks.eu/blog/2020/04/compile-qemu-42-on-debian-
buster-fix-pulseaudio-kvm-libvirt.html) Related Tweet:
[https://twitter.com/bitkeks/status/1251892611343880194](https://twitter.com/bitkeks/status/1251892611343880194)

------
atum47
I'll give this a try. On my last job I needed windows to run spark ar,
Facebook's tool to create augmented reality for their Instagram filters. I was
using vm ware, but it was glitchy

------
bootloop
If you are just running full-screen applications (like games or software) and
you have multiple screens it is better to just use scripts to switch display
inputs (via dcc).

I wasn't really able to find a usecase for looking glass. (But it's an
interesting idea.)

~~~
cercatrova
You can also use evdev or Barrier.

