this post was submitted on 19 Oct 2024
40 points (97.6% liked)

Linux

48375 readers
1730 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

So I've been looking into moving back entirely to Linux, but I play a lot of games so would likely need access to windows. I'm considering using KVM as dualbooting isn't really something I'd want. I've some questions I don't really get from how this setup would work:

  • I have 3 monitors. I have 1 Nvidia 2060. I imagine I might have to get a cheap-ish 2nd video card for Linux as the 2060 would have to be passed through to the guest (windows) VM.. right? (I have integrated graphics, but not enough connections for the 3 monitors on it)
  • how do you switch between playing on the host and playing on the guest? I.e. if a game runs fine native on Linux, I'd want to use that instead of the windows vm. Is it possible to use the Nvidia card I'd normally pass through on the host? The only thing I can think of here is to run a Linux VM on the Linux host so the card can be passed through to it..? Or is it just not worth it and better to stick to just playing on the windows VM?
  • how do multiple monitors behave in this? E.g. I connect the 2 monitors on the left/right to the weak card which I dont have yet. I connect the middle monitor to both cards. Once I launch the VM I change the input on the main monitor to the connection with the Nvidia card. How will my monitors behave (and will I have any control over it)? E.g. will I be able to move the cursor across from the left monitor through the middle monitor and to the right or would they act more like 2 different PCs?
  • how do other things work, like microphone? E.g. can I have discord running on Linux and talk in voice chat, while also using the microphone to talk in game chat in the windows VM?

Answering any of them is useful, thanks in advance. Also if I misunderstood how this setup is meant to work, feel free to correct me.

top 17 comments
sorted by: hot top controversial new old
[–] [email protected] 11 points 1 month ago (1 children)

About the second point, your pc shouldn't be putting any resources towards a VM if it isn't active. Just shut it down, close it, and play games on your host as normal.

One more thing, I'm assuming you're doing your gaming on Steam. Check ProtonDB for all of your games to see if they work on Linux (protondb only lists steam games, so if you have games as well, I've found a google search usually does the trick). You might find that you don't even need a VM

[–] [email protected] 2 points 1 month ago (2 children)

Unfortunately for some of them even if the game works there are often cases where either mods don't work or some overlay/other additional software.

On your answer though, I was under the impression that when you configure the KVM passthrough setup it makes the video card you use for the passthrough inaccessible for the host itself and that to make it accessible, it requires undoing some of the config and a restart. Is this incorrect?

[–] [email protected] 6 points 1 month ago (1 children)

It's incorrect. I have 2 AMD cards, I can detach it from linux before booting the guest. After I shut down the guest I have to log out in Gnome to make the card usable again, but no reboot required. It depends on how you set it up. I have a single 34" monitor with 2 inputs, connected to both cards.

I recommend to read about this topic, it would be quicker than waiting for people to answer, your questions were answered multiple times. I recommend the vfio wiki on the r*ddit a lot of good links are collected there: https://old.reddit.com/r/VFIO/wiki/index

[–] [email protected] 1 points 1 month ago

Thank you, that's useful!

[–] [email protected] 2 points 1 month ago

Which games/mods are you talking about? It's very rare for mods to not work if the game works, you might just need to find an alternate application somewhere in the chain

[–] [email protected] 11 points 1 month ago* (last edited 1 month ago) (1 children)

It's gonna be way less hassle to just use Linux. The gaming situation is so vastly improved from 6 or so years ago, and the vast majority of games just work, with a large amount of the rest only needing minor tweaks.

The big exceptions are in competitive gaming, and even there it's pretty much limited to proprietary & intrusive anti-cheats that I wouldn't have installed on my Windows computer anyway; Riot's Vanguard and FACEIT are probably the two big ones. Also Fortnite -- even though EasyAntiCheat does work fine with Linux, Epic has chosen to explicitly not support it. If you do play one of those few games -- or use other proprietary software like the Adobe suite that also won't work -- a dual boot should be fine, it only takes maybe two minutes to swap over and unless you have two beefy GPUs you'll be limited in a KVM setup.

[–] [email protected] 3 points 1 month ago

I know it's tangential to your comment, but I need to get this off my chest. I hate when things like Epic's stance is framed as "not supporting" linux, when in reality they barely need to do anything to let the game run there. What they're doing is actively detecting and blocking it.

[–] [email protected] 3 points 1 month ago

I did this for a while with a 3080 and a a770. It works well, but after a while (and new Nvidia drivers) I switched fully to Linux.

  • yes the GPU needs to be unused by Linux to allow for passthrough. There are some guides for making single GPU passthrough work but I never went down that road.

  • see first response, making the Nvidia card available to both Linux and the VM is a hassle I never did. I would just game on Linux with the a770

  • two separate PCs for the most part. I used udev rules to have Ctrl L + Ctrl R switch my input between devices

  • pipe wire and udev rules. However audio is painful I actually used a USB physical switch to pass through things from host or VM. I would just pass through a USB controller to the VM and those USB ports on the back would be exclusively for the vm

[–] [email protected] 3 points 1 month ago (1 children)

I’ve played a small amount with it— I didn’t go far because I only have one graphics card. But my understanding is that you can set up the virtual machine to “capture” the graphics card when it is booted up, and “release” it when it’s done. That’s how some people can use a single graphics card, they just can’t see the Linux desktop while the vm is in use.

For switching games, make sure the drive the game is on is supported by both Windows and Linux. I imagine you’d need to unmount it on the host while the vm is open. I do this for some games with dual booting. Also, install the Windows version and force proton, otherwise you’ll have to install it twice.

For microphone, I assume there’s a solution like network: a way of forwarding the data to the VM in addition to being available on the host. I haven’t tinkered with this though.

For monitors, I’d look into Looking Glass. My understanding is that it can make a window to display the vm output. If you don’t mind the monitor being “tethered” to the gpu, though, I’d imagine any monitors attached on the gpu you pass would display the vm’s contents, while any on the host card will remain the same.

Best of luck!

[–] [email protected] 3 points 1 month ago

But my understanding is that you can set up the virtual machine to “capture” the graphics card when it is booted up, and “release” it when it’s done.

The word you are looking for is GPU passthrough. You can find some guides on the web.

[–] icogniito 3 points 1 month ago

Unless you play games with intrusive anti cheat pretty much everything works flawlessly on Linux.

I moved to arch permanently (been using Linux for other stuff and on my laptop for ages) after nvidia finally sorted their wayland support back in spring and I haven’t had a single game not work for me

[–] [email protected] 2 points 1 month ago

It behaves like 2 computers. I have mine set up to change my input from 3 monitors to 2 monitors when the VM starts with qemuhooks by running a xrandr script. You can position the 2 monitors virtually wherever you want. qemuhooks executes another script when it shuts down to switch back to 3 monitors. (Arandr is a great gui to set up the monitors the way you like them and then save the setup as a script)

I have 2 mice and 2 keyboards. Gaming one is just the left half of a split keyboard. The gaming mouse and gaming keyboard get passed through automatically on VM startup.

You can use one kb and mouse on both the host and guest but need to manage switching back and forth with keybinds. There are probably other solutions that I am not aware of maybe ones that let you move the mouse in and out of the virtual machine.

I really like this setup though since I can have a web browser, discord, music etc open on the host and can just switch kb/mouse to control them and don't need to worry about switching the input back and forth or cycling focus (alt tab etc.) the way i would if I was not using a virtual machine.

If I want to use the mic in game and also on discord I pass the mic through to the guest and just run discord in there.

I liked the setup so much that I installed a Linux VM. Eventually everything I was playing worked on Linux and I didn't need windows anymore so I got rid of it but still use the passthrough.

[–] [email protected] 2 points 1 month ago

eh games work fine in linux now and the ones that dont, will usually not work on vms either

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago)

I have a w11 KVM + nvidia card, even bypassed EAC when it detected the VM and refused to start

I use my iGPU in the Linux host and it's fine. I only game in the VM for lots of reasons. You can swap them but I don't have experience with that

The mic if you add it in VM hardware as passthrough USB will work on your host until the guest boots then it only works on guest.

For multi monitor just try and ask if you have specific problems

One tip is setup sunshine on your VM so you can quickly jump in from any moonlight device. Looking glass Is better but only works from the host pc

Lmk if you have other questions

[–] [email protected] 2 points 1 month ago

I don't have a lot of input on this sadly but I would believe that the audio thing you mentioned could probably easily be fixed with pipewire.

As an example you can look at qpwgraph and see that you can pipe one input into several programs at once. I'm however unsure how KVM will handle it.

[–] [email protected] 1 points 1 month ago

I used to do something similar. Passing GPU between host and VM without rebooting is a major pain in the ass. What I did instead was had a Linux hypervisor and 3 VMs (Linux, Windows, and MacOS). I would swap between the 3 VMs, and they each had access to my GPU. It was fun to set up and somewhat convenient, but got really annoying as it was my only workstation at the time.

I would highly suggest to just accept dual-booting and if it takes too long, get a faster SSD and/or faster RAM.

I've since gone Linux full-time, and I have no complaints. None of the games I can no longer play would be worth having Windows to deal with. I thought I would miss them at first, but I'm happy playing what's available.

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago)

Maybe it's too fancy and difficult for you. Take a look for moonlight + sunshine, parsec and their competitors.