I saw from a post that you can basically host your own mini windows inside of linux to play games with, and you can choose what to share with that little windows so microsoft can’t track you in any way. Does anyone have a tutorual/guide for that? Also what Distro would be best for it?

  • Solar Bear
    link
    fedilink
    English
    2111 months ago

    What you’re probably referring to is running a virtual machine with VFIO passthrough. I hate to be that guy, but this is one of those “if you have to ask for help, you probably shouldn’t do it” kind of situations. It’s complicated and easy to mess up, requires a decent amount of knowledge of both Linux and Windows, and every situation is unique. There’s no cookie-cutter way to set it all up.

    But if you’re willing to buckle down and learn anyways, the best way would be to do it from scratch. This is the best documentation I’m aware of on the subject, but it’s tailored heavily for Arch Linux, a rather advanced distro to use.

    https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF

    • dinckel
      link
      fedilink
      English
      511 months ago

      This article is enough to teach you basically anything you could need. As long as you can follow instructions properly, that’s it

    • @[email protected]OP
      link
      fedilink
      311 months ago

      alright, thanks. After I’ve read other comments I’ll pass on it because it seems I need an extra GPU anyways.

      • @[email protected]
        link
        fedilink
        111 months ago

        Not necessarily, if your processor has an igpu which many do you can use that for Linux and the discrete GPU for the VM

        though like others have said if you don’t know about this technology already it’s not going to be an easy plug and play job

  • PorkrollPosadist [he/him, they/them]
    link
    fedilink
    English
    5
    edit-2
    11 months ago

    The Distro isn’t super important, since Valve started shipping their own runtime (for Linux ports) and Proton (for Windows games). Anything modern outside of the strictly free-software distros (things like Ututo, Guix, etc. which do not ship proprietary firmware or drivers of any kind) will suffice.

    There are a few different approaches to playing Windows games. Some have direct ports. Games like Doom, Quake, were open-sourced a long time ago and have dozens of ports with all sorts of features. Other games, like CS:GO, Kerbal Space Program, X-Com: Enemy Unknown, etc. are not open source, but have ports produced by either the developer or the publisher. A LOT of indy games have ports available, and most modern game engines like Unreal, Unity, Godot, etc support Linux targets (whether the publishers give a shit is another story.) These typically target the Steam Runtime (a collection of specific versions of graphics, audio, and auxiliary libraries that Steam will install). These libraries are also provided by distributors, but the distribution libraries will typically be newer. This is normally a good thing, but commercial ports don’t receive frequent updates and are likely only tested against the Steam Runtime.

    If there is no port available, the next option is Wine. Wine is a Windows compatibility layer which is capable of loading Windows PE format executables on Linux and dynamically linking them to a large collection of substitute DLLs which implement Windows functionality on top of Linux. Proton is the version of Wine shipped by Steam, with a bunch of tweaks specifically focusing on graphics performance. Most of the time, games will work in Proton, but there are a handful of cases where they work in Wine/Wine-Staging but not in Proton.

    If the game requires an anti-cheat component, it will almost certainly not work in WINE/Proton, because the whole basis of getting Windows games to work on Linux operates using the same mechanism as cheats: replacing “genuine” components of the Windows operating system with 3rd party code to intercept system calls and do something other than intended.

    A much more complicated route would be to set up a virtual machine. A virtual machine is a full blown PC-emulator, except since the host machine shares the same instruction set as the guest, it is a lot faster. This is not enough not yield good performance in games though, because games also require direct access to the video hardware. To do this, you need a SECOND graphics card for the guest operating system, then you can try to configure PCI-e passthrough (so the video driver in the guest OS talks directly to the video hardware). This is probably the most complicated approach, but you end up running genuine Windows virtualized on real hardware. In addition to the second GPU, you need to make sure you have the overhead in CPU / RAM / storage to run multiple operating systems concurrently such that gaming performance won’t be substantially impacted. Additionally, you probably need a second monitor if you want to interact with both the guest and host operating system simultaneously.

    Finally, if none of that works, it may be worth looking into whether ports for other platforms exist. If you struggle running a dated Windows game in WINE, you might have better luck emulating a release for PS2/3, GameCube/Wii/WiiU/Switch, etc. The state of Nintendo platform emulation in particular is phenomenal, and it is trivial to increase the video resolution beyond what the official hardware supports if your machine has the horsepower for it.

    • @[email protected]OP
      link
      fedilink
      111 months ago

      I see, It seems virtualization won’t be the way to go as I don’t have a second monitor nor a second GPU.

  • @[email protected]
    link
    fedilink
    211 months ago

    It’s pretty advanced. You’ll need 2 GPUs (so gaming laptop or gaming PC with at least 2 graphics adapters) and some more advanced Linux stuff like editing kernel/boot configs, messing with drivers, and BIOS settings.

    Look at BlandManStudios on Youtube, he has a bunch of tutorials on this. But make sure you back up your system because, like I said, it’s not a simple setup.

    • mechinn
      link
      fedilink
      311 months ago

      Just a thing to note, if you’re considering virtualizing windows to play games that have anti-cheat software like BattleEye if they notice you’re virtualizing windows it might ban you. You’re almost better off using the other advice here and using proton with those that support it. For things that don’t you probably will have to flip the setup around and have the base os be windows and virtualize Linux :(

  • @[email protected]
    link
    fedilink
    111 months ago

    I remember there being a script for fedora, that apperently workes since it made me realize my PC only has one GPU (no GPU)

  • @[email protected]
    link
    fedilink
    111 months ago

    Not sure what you mean. You can virtualize a whole windows machine but that will NOT be good for performance.

    What you really want is a compatibility layer than maps syscalls to your linux kernel and emulates a windows filesystem. I’m fairly sure that’s what Wine and Proton do, but am no expert.

    If you install steam (on most distros) it should also install Proton to play games with (check ProtonDB for which games work well). Again no expert but maybe this helps a little.

    • @wildbus8979
      link
      1011 months ago

      You can virtualize a whole windows machine but that will NOT be good for performance.

      Sorry but that is totally not true, if you have a second graphics card to passthrough to the virtual machine.

      • @[email protected]
        link
        fedilink
        2
        edit-2
        11 months ago

        GPU passthrough setup is certainly not for Linux beginner like OP. It’ll just frustrate them and they’ll go back to windows.

        • @wildbus8979
          link
          111 months ago

          It’s not overly hard to setup either though. Couple of kernel options to add to your boot string, enable vfios, blacklist the module, and you’re ready to configure the VM.

      • @cujo
        link
        English
        1
        edit-2
        11 months ago

        It will still be subpar performance, bottlenecked by the CPU resources you can allocate to the VM as well as your original hardware’s capabilities to power the VM among many other variables. Running a VM to game will always produce subpar results. Using GPU passthrough will increase performance, but it’s almost always preferable to play on real hardware.

        The real answer will always be: if you want to game on Linux, utilize Wine/Proton and Steam/Lutris/Bottles/Heroic/some other launcher that lets you fine tune Wine/Proton to cater to the specific game.

          • @cujo
            link
            English
            211 months ago

            Sure. I admit my experience running a VM is limited to “type 2 bullshit” like VirtualBox. But that also requires that OP have a spare GPU lying around they care enough to pop into their machine and set up passthrough for, which most people don’t. Especially with these GPU prices lately, yikes. Chances are they have a decent GPU already in their system, and buying an equivalent GPU just for passthrough is… 😬

            So while baremetal-like performance is certainly possible with a VM, it’s still not an ideal solution for most people.

            • @wildbus8979
              link
              4
              edit-2
              11 months ago

              Use the iGPU for your main OS, and discreet for gaming in a VM. Works wonders and you don’t need to deal with NVIDIA drivers in your main OS. And save some energy to boot.

              • @cujo
                link
                English
                211 months ago

                Hmm that’s a neat solution. What if you do video or photo editing in your main OS, though, or any other kind of work that would benefit from discreet graphics? Is your only option then essentially two GPUs, or can you switch between passthrough neatly, or…?

                • @wildbus8979
                  link
                  311 months ago

                  You can switch between the two, but it does require a reboot. So in that case two discreet would be more convenient. But for encoding and what not you probably can get away with a rather cheap discreet that works well on nouveau (or go Radeon) and keep the 4090 for gaming.

                • sudotstar
                  link
                  fedilink
                  211 months ago

                  I haven’t adopted this kind of setup, mainly because Proton just does such a good job I have almost zero need for Windows, but my plan for eventually doing something like this was to also maintain a passthrough Linux VM for any GPU-intensive work on that side.

                  When I realized that the practical end-state of my system would mean I’d just be running things from within the Linux VM 98% of the time (games that can run on Linux) I kind of dropped the idea.

        • dinckel
          link
          fedilink
          English
          311 months ago

          This is factually incorrect. Yes, you will have to allocate at least one thread and some RAM to your host system, but calling it subpar is just a completely uneducated statement. I have ran my system like this for multiple years, and compared to running booting Windows directly, the loss of fps in games is so negligible that it might not even be there

          • @cujo
            link
            English
            4
            edit-2
            11 months ago

            If you have to allocate resources to your host system, that’s resources your virtual machine cannot use. It is subpar. If you’re going to allocate your host the bare minimum resources, why not run the other operating system to begin with? You’re now missing out in performance in the complete opposite direction. The most straightforward solution still remains to run games on your host system. If you want to game on Linux, game on Linux. It’s easy enough nowadays, and what tinkering you may have to do will be a fantastic opportunity to get more comfortable with the DIY side of Linux.

            I will be the first to admit that I am no expert on the topic of virtualization, as I have said in other comments already. However, this is a community, not an expert consultation, and I have used virtualization to varying degrees of success for various different tasks over the years, all of which has culminated in my opinion that it’s best not to use virtualization to game unless you’re really intent on running a game that cannot under any circumstances run in Linux, such as Valorant. To follow, if that is your use case I encourage picking up an extra drive (storage is incredibly cheap) and running a dual boot. You’re free to disagree and provide reasoning why I’m wrong, but calling my statement “completely uneducated” is disingenuous at best.

            EDIT: I concede on my word choice, it’s not “subpar .” I’m certain you can achieve average or even above average performance in a VM with the right set up. The word I’m looking for is “suboptimal.” My apologies.

            • dinckel
              link
              fedilink
              English
              211 months ago

              I can definitely agree with suboptimal. While it’s certainly not an end-all/be-all solution, it did exactly what it was designed to do. People spin up machines through Virtmanager for many reasons outside of gaming, me included, but when it came to gaming specifically, rebooting your system to play one game, and then switching back, didn’t make any sense. Wine and Proton were not nearly as mature, as they are today.

              Needless to say though, this is not the kind of setup you would run on an underpowered machine. With 24 threads of CPU performance, 32-64gb of RAM, and a full GPU, I can’t really name a game that would exceed the limits of what is allocated

        • dragnet
          link
          fedilink
          19 months ago

          Super late reply here, but I was searching the Linux sub for vfio because I love this topic, lol. I’m happy to report that as others are saying, a vfio setup can be very performant! The GPU is near native, and with the proper CPU configuration, you won’t be dealing with much overhead there either. The biggest factor is the overall load on your machine from running a host OS with the guest layered on top. I use my PC host OS primarily as a QEMU/KVM hypervisor, so when I need maximum gaming performance I simply turn off or suspend operation on all other VMs to free the resources for Windows. The only game I’ve had trouble with recently at 3440x1440 is Starfield, and unfortunately I think that is more a sign that an upgrade is finally due. I’ve used this setup for all kinds of games with no problem, including demanding virtual reality titles.

          The biggest problem I’ve run into? Some anticheats truly despise any kind of virtualization. I’ve only run into issues with 2 games I like to play, but that is a real caveat. I consider it 100% an issue with the companies implementing these policies, who as I see it don’t deserve my money in the first place. But other than the initial configuration headache and extra hardware required (if you don’t have an iGPU anyway), this is the main drawback in my eyes.

  • @[email protected]OP
    link
    fedilink
    111 months ago

    Thank you everyone for all the lengthy and informative replies! I appreciate them all. I’ll probably go with gaming normally on linux and not do anything fancy

  • @cujo
    link
    English
    0
    edit-2
    11 months ago

    As the other comment says, what you’re referring to is running a Windows VM (virtual machine) inside of your Linux machine. It’s a great asset for a lot of things, but gaming is not it’s strong point. A VM shares resources with it’s host machine, meaning it can only access so many of your CPU cores, utilize only so much of your RAM, and take advantage of CPU powered graphics – unless, as was pointed out in another comment, you happen to have a spare graphics card laying around. The set up for GPU passthrough is more trouble than it’s worth, IMO, especially for gaming. And you still have the other bottlenecks to contend with.

    Gaming on Linux is best enjoyed by using a combination of Wine and Proton (Wine suped up for the express purpose of gaming by the fine folks behind Steam) paired with a launcher of some kind, usually Steam. For non-Steam games, Lutris is a fantastic second choice. These platforms make gaming on Linux easier than ever, and are actually the technologies powering the SteamDeck. If you decide to go this route and need any help setting up, please reach out! The community is here and (usually) quite helpful, lol.

    If you decide to try the VM anyway, you should look into a software called VirtualBox. You will need to install a few packages to make your system a suitable host, and you’ll need the Windows installation ISO image to get it up and running. You can usually acquire it directly from Microsoft by running a search for “Windows XX ISO” where the XX is the version number you’re looking for. If you need help getting any of that together, I’d be glad to assist as well. ☺️

    All this comes from years of running Linux and only Linux, on a PC I almost exclusively game on. I’ve had great success, especially with all the headway Valve has made into making the ecosystem viable and accessable.

    However you decide to proceed, best of luck to you!

    EDIT: As has been pointed out, if you want to virtualize a gaming setup, you should look into KVM, not VirtualBox! It sounds like it’s a much more performant option, I am just not very familiar with it myself.

    • @wildbus8979
      link
      911 months ago

      If you decide to try the VM anyway, you should look into a software called VirtualBox.

      God, please, no. Why do people insist on using subpar virtualization when KVM is far superior and built into the kernel? I will never understand.

      Please, I beg of you, stop this madness.

      • @cujo
        link
        English
        411 months ago

        Because it’s accessable, and is also the extent of my knowledge in running a VM. I won’t speak about KVM because I am not intimately familiar with KVM, nor will I ever be. I’m certain it’s a better solution than VirtualBox, just as running games in Linux with Wine/Proton is a better solution than setting up a VM to game in.

        I’d be happy to hear about the details of why KVM is so superior, if you’d care to enlighten me! I’m always looking to learn new things.

        The real question is why we’re down voting people who are adding to the discussion just because we disagree with them, instead of just having a conversation?

        • @wildbus8979
          link
          811 months ago

          Because it’s accessable

          Here, enjoy: https://virt-manager.org/

          I’d be happy to hear about the details of why KVM is so superior

          Essentially type 1 hypervisors, like KVM/Qemu, make direct use of the CPU’s virtualization technology (VT-d and VT-x) while type 2 hypervisors run all the calls through the kernel which is significantly slower. In a way type 2 hypervisors are closer to an emulator.

          • @cujo
            link
            English
            311 months ago

            Thanks for the link! And for the info. I’ll give KVM an honest try, and maybe I’ll get motivated enough to spin up a VM for CaptureOne. A 1080 should be decent enough for light photo editing, and I was recently given one as-is. It may or may not work, neither I or the person who gave it to me had time to test it.

    • @[email protected]OP
      link
      fedilink
      211 months ago

      thank you for the lengthy reply! I think I’ll go with alternative options and not to virtualize windows, because I don’t have a separate GPU that I can pass in, nor a second monitor.