I've spent quite a bit of time tweaking and tuning my Linux setup to get the best possible gaming performance, and I thought I'd share my learnings with you all. Linux gaming has come a long way, and with the right optimizations, you can have a great gaming experience on your Ubuntu-based system.
1. Update Your System
First things first, ensure your system is up-to-date.
sudo apt update && sudo apt upgrade
2. Use a Performance-Oriented Kernel
Consider using a kernel optimized for performance. The Liquorix kernel or the XanMod kernel are popular among gamers. They are configured for lower latency and better responsiveness:
# For Liquorix sudo add-apt-repository ppa:damentz/liquorix && sudo apt-get update sudo apt-get install linux-image-liquorix-amd64 linux-headers-liquorix-amd64 # For XanMod echo 'deb http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list wget -O- https://dl.xanmod.org/gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/xanmod-kernel.gpg > /dev/null sudo apt update && sudo apt install linux-xanmod
3. Optimize CPU Governor
The CPU governor controls your CPU's frequency. For gaming, we want the CPU to run at higher frequencies for better performance. You can switch to the performance
governor:
sudo apt-get install cpufrequtils echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils sudo systemctl restart cpufrequtils
4. Manage Graphics Drivers
Ensure you're using the latest proprietary drivers if you're on NVIDIA or AMD for better performance. You can typically find these in your distribution's additional drivers section.
5. Enable Game Mode
GameMode is a daemon/lib combo for Linux that allows games to request a set of optimizations to be temporarily applied to the host OS and/or a game process. Install it and prepend your game's launch command with gamemode-run
.
sudo apt install gamemode
6. Tweak Swappiness
Swappiness controls how often your Linux kernel swaps data from RAM to the swap space. Lowering the swappiness value can lead to fewer disk writes and more RAM usage, which is beneficial for gaming:
sudo sysctl vm.swappiness=10 echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
7. Adjust I/O Scheduler
For SSDs, using an I/O scheduler like noop
or deadline
can improve performance. Check your current scheduler and change it if needed:
cat /sys/block/sda/queue/scheduler echo 'deadline' | sudo tee /sys/block/sda/queue/scheduler
8. Optimize Thermals
Ensure your system is properly cooled to prevent thermal throttling. tlp
is a great tool for laptop users:
sudo apt install tlp tlp-rdw sudo tlp start
9. Disable Screen Compositing
Disabling desktop effects can free up resources. Most desktop environments have an option to disable compositing or you can use a more lightweight window manager.
These are just a few ways to optimize your Linux system for gaming. Every system is unique, so results may vary. Share your experiences, tweaks, and questions below. Let's help each other push the limits of Linux gaming!