Arch Linux Laptop Tweaks Guide
This guide helps improve laptop performance, battery life, and usability on Arch Linux.
1. Prevent Sleep When Lid is Closed
To keep your laptop running with the lid closed, modify systemd's configuration.
Open a terminal and run:
bashsudo tee -a /etc/systemd/logind.conf << EOF HandleSuspendKey=ignore HandleSuspendKeyLongPress=ignore HandleHibernateKey=ignore HandleHibernateKeyLongPress=ignore HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore EOFReload the systemd config:
bashsudo systemctl restart systemd-logind
2. Battery Optimization
WARNING
Using both tlp and auto-cpufreq together will cause compatibility issues. It is recommended to use one power management tool at a time to avoid conflicts in settings and performance optimization.
2.1. auto-cpufreq (CPU Power Scaling) (Recommended)
auto-cpufreq adjusts CPU frequency and power settings based on system load and battery status, optimizing performance and energy use.
Install
auto-cpufreq(requires an AUR helper likeyay):bashyay -S auto-cpufreqTest in live mode (observe real-time adjustments without installation):
bashsudo auto-cpufreq --liveEnable automatic startup (run at boot for automatic adjustments):
bashsudo auto-cpufreq --installMonitor system over time (observe system behavior without making changes):
bashsudo auto-cpufreq --monitorView CPU statistics:
bashsudo auto-cpufreq --statsUninstall the service:
bashsudo auto-cpufreq --remove
2.2. TLP (Advanced Power Management)
TLP optimizes battery life automatically.
Install TLP:
bashsudo pacman -S tlp tlp-rdwStart and enable the service:
bashsudo systemctl enable tlp --nowCheck TLP status:
bashsudo tlp-statOptional: For a GUI, install
tlpui(requires AUR helper likeyay):bashyay -S tlpuiRun
tlpuito configure TLP with a graphical interface.
2.3. CPU Scaling Governor
Optimize your CPU governor to balance performance and power usage, especially on battery-powered devices.
Install Dependencies:
bashsudo pacman -S cpupowerView Current CPU Governor:
bashcpupower frequency-infoOr use:
bashcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governorSet the CPU Governor:
To set the governor to
schedutil(recommended for modern kernels):bashsudo cpupower frequency-set -g schedutilFor maximum battery efficiency, use the
powersavegovernor:bashsudo cpupower frequency-set -g powersaveMake the Governor Setting Persistent:
Open the
cpupowerconfiguration file for editing:bashsudo nano /etc/default/cpupowerAdd or edit the following line:
bashGOVERNOR="schedutil" # or "powersave"Enable and Start the
cpupowerService:bashsudo systemctl enable cpupower --nowVerify the Governor Setting:
bashcpupower frequency-info
3. Adjust Swap Usage (Swappiness)
Reduce swap usage to improve performance.
Check current swappiness (Default = 60):
bashcat /proc/sys/vm/swappinessEdit the config file:
bashsudo nano /etc/sysctl.confSet swappiness to 10 for less aggressive swap usage:
bashvm.swappiness=10Apply changes:
bashsudo sysctl -p
4. File System Performance (noatime)
Disable file access time writes for better performance, especially on SSDs.
Edit
/etc/fstab:bashsudo nano /etc/fstabAdd
noatimeto your root (/) partition options:bashUUID=<your-disk-UUID> / ext4 defaults,noatime 0 1
Reboot to apply the change.
5. System Monitoring Tools
5.1. powertop (Power Consumption Monitor)
Monitor and optimize power usage.
Install
powertop:bashsudo pacman -S powertopRun in interactive mode:
bashsudo powertopOptimize settings automatically:
bashsudo powertop --auto-tune
5.2. btop or htop (Resource Monitoring)
Monitor CPU, memory, and system resources.
Install
btop:bashsudo pacman -S btopInstall
htop:bashsudo pacman -S htop
