Introduction
Cardwire is GPU manager for linux that uses eBPF LSM hooks to block GPUs
It was made to be a successor to the deprecated supergfxctl
Caution
Cardwire is in an early development stage, expect breaking changes and unstability.
Getting Started
Before proceeding, take a look at the requirements to make sure your system is supported.
Requirements
Requirements to be able to run Cardwire:
Kernel
Version 5.7 or later
uname -r
Built with CONFIG_BPF_LSM enabled
zcat /proc/config.gz | grep CONFIG_BPF_LSM
returns
CONFIG_BPF_LSM=yif it’s enabled
Enabled in the boot cmdline
cat /proc/cmdline
Must contains
lsm=bpf
Installation
Arch
using AUR:
yay -S cardwire
then enable the service and reboot
sudo systemctl enable cardwired.service
reboot
Note
i also maintain the cardwire-git package in case someone tries to take it.
Note
both gets updated, in a near future, cardwire will provide a built package from github while cardwire-git will build from source.
Important
i’m also looking for an official maintainer for both AUR, since i do not use Arch.
Nix
Using the repo’s flake:
flake.nix:
cardwire = {
url = "github:luytan/cardwire";
inputs.nixpkgs.follows = "nixpkgs";
};
configuration.nix:
imports = [ inputs.cardwire.nixosModules.default ];
services.cardwire.enable = true;
Other distros
For now, other distros must clone the repo and use make to build and install Cardwire.
Build dependencies:
- cargo
- clang
- libbpf
git clone https://github.com/luytan/cardwire.git
make build
sudo make install
Caution
Makefile was AI-generated, use with caution.
Important
For mainstream distros, i will be making an official install methods, like a copr for Fedora and a .deb for Debian based.
Non-systemd distros
Warning
Cardwire only supports systemd-based distros. If you want to use it on a non-systemd distro, either open a PR with patches for non-systemd or get it working on your setup.
Troubleshooting
Name is not activable
Is the daemon running?
systemctl status cardwired.service
If it’s not running, enable the daemon with
systemctl enable cardwired.serviceand reboot your device.
dGPU is detected as the default gpu
On ROG laptop
is the asus MUX enabled?
asusctl armoury list
then find
gpu_mux_mode:
current: [(0),1]
0 means that the MUX is enabled, the dGPU IS the default GPU in this case
Non ROG Laptop
This shouldn’t happen, please create an issue with the output of
ls /sys/class/drm
and
cat /sys/class/drm/*/status
“game name” won’t launch
force