CS2 crashing and not using GPU

so, whenever i open cs2 and join a match it lags then crashes after a few minutes, specially when i’m using default graphics which high. another problem is the frame rates are higher in linux compared to windows in this particular game with my gpu which intel arc a750 but i get half of the fps and unplayable game experience. these are the lines i added in my configuration.nix file to install steam and some drivers,

  hardware = {
    graphics = {
      enable = true;
      extraPackages = with pkgs; [
        vpl-gpu-rt
        # i had these 3 then figured out they have no effect.
        #libvdpau-va-gl 
        #intel-media-driver
        #intel-compute-runtime
      ];
    };
  };
  programs = {
    steam = {
      enable = true;
      remotePlay.openFirewall = true;
      dedicatedServer.openFirewall = true;
    };
  };

so steam downloads the shaderes everytime after a restart by default.
You can disable it by going into the steam settings ->Downloads-> at the bottom disable shader pre chace.
For the instability:
Have you problems in other games (can you post your performance with mangohud)?
Have you trieded other steam proton versions?
Which graphics settings do you have in CS

i disabled the settings for pre-caching but sadly i don’t know how to use mongohub. i also do not have any idea about what steam proton versions are. im playing the game in default graphics which is 1080p high. and i do not have any other game installed. what i did few minutes ago is that removing all the hardware.graphics.extrapackages and i am still getting the same fps with the same issue which is crashing after a few minutes and unplayable lag.

so mango hud is like msi Afterburner but for linux. To install it put mangohud in your packages and add following to your launch options:

mangohud %command%

next to change the proton version go into your game properties → compatibility → Force to use a specific tool-> there try out steam linux runtime 3.0 Sniper
If this does not work try Proton experimental/hotfix.
This is also not a problem with your config or nixos. Maybe try downloading other games and see if these are working correct

what is that? :0
i don’t have an igpu, how is this game running with 0% gpu usage?
my cpu is intel i5 13400f


and by the way, when i try to open this 3.0 sniper it gives me an error
Screenshot_20250120_183419

So a couple of things here.
First of all can you post your system specs and versions(kernel nixos kde wayland…).
Second pleas post the output of this command lspci -k | grep -EA3 'VGA|3D|Display'.
Third you should not run “Steam Linux Runtime 3.0(sniper)”, you should put it in the compatibility tool. For this do the following:
1.


2.

1 Like

this is my spec according to neofetch

OS: NixOS 24.11.713159.9c6b49aeac36 (Vicuna) x86_64 
Host: Gigabyte Technology Co., Ltd. B660M DS3H AX DDR4 
Kernel: 6.6.71 
Uptime: 1 hour, 1 min 
Packages: 1693 (nix-system), 381 (nix-user) 
Shell: bash 5.2.37 
Resolution: 1920x1080 
DE: Plasma 6.2.5 (Wayland) 
WM: kwin 
Icons: breeze-dark [GTK2/3] 
Terminal: .konsole-wrappe 
CPU: 13th Gen Intel i5-13400F (16) @ 4.600GHz 
GPU: Intel DG2 [Arc A750] 
Memory: 2346MiB / 15818MiB

this is the what I got there

[nix-shell:~]$ lspci -k | grep -EA3 'VGA|3D|Display'
03:00.0 VGA compatible controller: Intel Corporation DG2 [Arc A750] (rev 08)
        Subsystem: Intel Corporation Device 1021
        Kernel driver in use: i915
        Kernel modules: i915

and i changed it,

and does it work now?

no it’s the same 0% gpu usage

and on other compatibility settings? try proton experimental.
can you also post your config?

alright selected proton experimental and it is downloading something


this is my config

{ config, pkgs, ... }:

{
  imports = [
    ./hardware-configuration.nix
  ];

  # boot
  boot = {
    loader = {
      systemd-boot.enable = true;
      efi.canTouchEfiVariables = true;
    };
  };

  # networking
  networking = {
    hostName = "nixos";
    networkmanager.enable = true;
  };

  # timezone
  time.timeZone = "Asia/Dhaka";

  # i18n
  i18n = {
    defaultLocale = "en_US.UTF-8";
    extraLocaleSettings = {
      LC_ADDRESS = "en_US.UTF-8";
      LC_IDENTIFICATION = "en_US.UTF-8";
      LC_MEASUREMENT = "en_US.UTF-8";
      LC_MONETARY = "en_US.UTF-8";
      LC_NAME = "en_US.UTF-8";
      LC_NUMERIC = "en_US.UTF-8";
      LC_PAPER = "en_US.UTF-8";
      LC_TELEPHONE = "en_US.UTF-8";
      LC_TIME = "en_US.UTF-8";
    };
  };

  # services
  services = {
    printing.enable = true;
    displayManager.sddm.enable = true;
    desktopManager.plasma6.enable = true;
    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
    };
    xserver = {
      enable = true;
      xkb = {
        layout = "us";
        variant = "";
      };
    };
  };

  # hardware
  hardware = {
    pulseaudio.enable = false;
    graphics = {
      enable = true;
      extraPackages = with pkgs; [
        vpl-gpu-rt
        libvdpau-va-gl
        intel-media-driver
        intel-compute-runtime
      ];
      extraPackages32 = with pkgs.pkgsi686Linux; [
        intel-vaapi-driver
      ];
    };
  };
  environment = {
    sessionVariables = {
      LIBVA_DRIVER_NAME = "iHD";
    };
  };

  # security
  security.rtkit.enable = true;

  # users
  users.users.codayon = {
    isNormalUser = true;
    description = "Reshad Ahammed Ayon";
    extraGroups = [
      "networkmanager"
      "wheel"
    ];
    packages = with pkgs; [
      kdePackages.kate
    ];
  };

  # programs
  programs = {
    firefox.enable = true;
    steam = {
      enable = true;
      remotePlay.openFirewall = true;
      dedicatedServer.openFirewall = true;
    };
  };

  # packages
  nixpkgs.config.allowUnfree = true;
  environment.systemPackages = with pkgs; [
    gh
    git
    vim
    wget
    haruna
    neovim
    vscode
    yt-dlp
    mangohud
    chromium
    keepassxc
    obs-studio
    nixpkgs-fmt
    protonvpn-gui
    nixfmt-rfc-style
  ];

  # system
  system.stateVersion = "24.11";

}

i think it got worse but the sensitivity felt smoother, not sure about that. and still 0% gpu usage.

so could you put follwing in your config, rebuild and then restart?

boot.initrd.kernelModules = ["i915"];

also in your extrapackages for graphics you only need vpl-gpu-rt. the rest is not needed.
Also can you tell me why you have a this session Variable?

actually the session variable i got from here, Accelerated Video Playback - NixOS Wiki
and let me try putting the line you shared.

so, after putting boot.initrd.kernelModules = ["i915"]; then rebuilding and restarting mangohud still shows 0% gpu usage. one thing i noticed restart was faster than usual. by the way, not only i added the line but also removed the lines. could it be possible mangohud is broken and not showing gpu usage as the game cannot be opened without using a gpu and i dont have igpu?

extraPackages = [
libvdpau-va-gl
intel-media-driver
intel-compute-runtime
]
  environment = {
    sessionVariables = {
      LIBVA_DRIVER_NAME = "iHD";
    };
  };

Ok. I think at this point the only thing we can test is if you got the same problem in other games.
If you do not have problems in other games it is something with CS. If you have the same problem there could be something wrong with the drivers for the gpu, the compositor or something else.
Maybe try launching kde in Xorg rather than wayland and see if it is any better.
If not try running another game like marvel rivals, wareframe or any other game.

1 Like

alright, i will let you know!

what i found and experienced, there is no tool that has support for my gpu in linux to monitor vram usage. i could be wrong.

can you please try running your game in an X sessions and if this does not work try another game please

I tried only xorg but it was same. And I tried running mangohud on there small games like combat master but the menu only pops up on cs2. Then I installed arch and the experience was similar and a bit worse. Now installed Ubuntu and installing the game.