System lag and slow boot times in Linux Mint often originate from unnecessary services, bloated startup applications, and outdated swap settings. Addressing these issues with targeted performance tweaks can lead to a significantly faster system response and a more efficient computing experience.

Optimize System Memory Usage and Swap

Step 1: Activate zswap for Compressed Swap in RAM.
This kernel feature captures pages before they hit disk swap, compressing them in memory to reduce disk I/O. Open a terminal and edit the GRUB configuration:

1sudo xed /etc/default/grub

Locate the line starting with GRUB_CMDLINE_LINUX_DEFAULT=. For systems with 4GB of RAM or less, use:

1GRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1 zswap.max_pool_percent=40 zswap.zpool=zsmalloc zswap.compressor=lz4"

For systems with more than 4GB RAM, omit the zswap.max_pool_percent parameter to use the default 20%:

1GRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1 zswap.zpool=zsmalloc zswap.compressor=lz4"

Save and close the file, then update GRUB and add the required module to initramfs:

1sudo update-grub
2sudo xed /etc/initramfs-tools/modules

Append zsmalloc on a new line at the end, save, and close. Update initramfs:

1sudo update-initramfs -uk all

Reboot your system. After rebooting, check if zswap is active:

1sudo dmesg | grep zswap

Step 2: Lower Swappiness to Reduce Disk Swap Usage.
Setting a value of 30 is optimal for desktops. Set it with:

1echo "vm.swappiness=30" | sudo tee /etc/sysctl.d/7-swappiness.conf

Reboot and confirm the new setting:

1cat /proc/sys/vm/swappiness

Streamline Startup and Background Services

Step 1: Disable Unnecessary Startup Applications.
Access the Startup Applications tool from the menu (Menu > Preferences > Startup Applications for Cinnamon/MATE, or search for “Session and Startup” in Xfce). Uncheck services you do not need. Consider disabling:

  • System Reports
  • mintwelcome
  • Support for NVIDIA Prime (if you lack an NVIDIA GPU)
  • Warpinator (if you do not share files locally)
See also  Flathub: The Ultimate Linux App Store

Only disable items you are certain are unnecessary, as disabling the wrong service can lead to issues.

Step 2: Use systemd-analyze blame to Identify Slow-Booting Services.
Disable any non-essential services with:

1sudo systemctl disable servicename

Replace servicename with the actual service you wish to disable. Be careful; disabling critical services can prevent your system from booting properly.

Turn Off Visual Effects and Use Lightweight Desktop Environments

Step 1: Disable Visual Effects.
For Cinnamon, go to Menu > Preferences > Effects and disable all effects. In MATE, adjust settings in Desktop Settings > Windows, setting the Window Manager to Marco + Compton for a lightweight experience. For Xfce, switch to Xfwm4 + Compton through Settings > Window Manager.

Step 2: Switch to a Lightweight Desktop Environment.
If you have older hardware, consider installing LXDE or Xfce:

1sudo apt-get install lxde

Or for Xfce:

1sudo apt-get install xfce4

Log out and select your new environment at the login screen.

Clean Up Unneeded Software and Junk Files

Step 1: Remove Unused Packages and Applications.
Free up disk space and memory by uninstalling unnecessary applications via the Software Manager or through the terminal:

1dpkg --list

Remove a package with:

1sudo apt remove packagename

Step 2: Use System Cleaning Tools like Stacer.
Install Stacer:

1sudo apt install stacer

Launch Stacer and utilize the System Cleaner module to clear package caches, logs, and temporary files. Always review files before deletion to prevent losing important data.

Optimize SSD Performance

Step 1: Enable Periodic TRIM for SSDs.
Create an override for the systemd fstrim timer:

1sudo mkdir -pv /etc/systemd/system/fstrim.timer.d
2sudo nano /etc/systemd/system/fstrim.timer.d/override.conf

Add:

1[Timer]
2OnCalendar=daily

Save and close. This schedules TRIM to run daily.

See also  Linux Mint 22 is set to arrive this month, and they have already used the beta version to fix over 50 bugs

Step 2: Mount SSD Partitions with noatime and commit=600 Options.
Edit /etc/fstab:

1UUID=xxxx / ext4 errors=remount-ro,noatime,commit=600 0 1

Replace xxxx with your actual UUID. Save and reboot.

Manage Power and Wireless Settings

Step 1: Disable WiFi Power Management.
Improving wireless speed can be essential, especially for laptops. Check the current state:

1iwconfig

Turn it off if it’s on:

1sudo sed -i 's/3/2/' /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Reboot and confirm WiFi Power Management is off.

Step 2: Enable Tx AMPDU for Intel Wireless Chipsets.
If the iwlwifi module is loaded, enable AMPDU:

1echo "options iwlwifi 11n_disable=8" | sudo tee /etc/modprobe.d/iwlwifi-speed.conf

Reboot to apply the change.

Refine Web Browser and Application Settings

Step 1: Limit Browser Add-ons and Extensions.
Too many extensions can slow down browsers like Firefox and Chrome. Remove the ones you don’t actively use.

Step 2: Reduce Firefox Disk Writes and Memory Usage.
Open about:config in Firefox and adjust:

  • Set browser.sessionstore.interval to 150000000.
  • Set browser.cache.disk.enable to false and browser.cache.memory.capacity to 524288 (512 MB) or 1048576 (1 GB) if you have sufficient RAM.

Restart Firefox for the changes to take effect.

Remove Unused System Services and Features

Step 1: Remove mlocate Package.
If you don’t use system-wide file search, this background process can drain resources:

1sudo apt-get purge mlocate locate

Step 2: Turn Off the Firewall Log.
If you never check it, disable it to save disk space:

1sudo ufw logging off

To re-enable:

1sudo ufw logging low

Adjust System for Heavy RAM Systems

Step 1: Mount /tmp as a tmpfs (RAM Disk).
For systems with 16GB RAM or more, this increases access speed and reduces disk writes:

1sudo cp -v /usr/share/systemd/tmp.mount /etc/systemd/system/
2sudo systemctl enable tmp.mount

Reboot and check status with:

1systemctl status tmp.mount

Limit the maximum RAM usage for /tmp by editing /etc/systemd/system/tmp.mount to set size=2G or another value.

See also  How to Fix Western Digital NVMe SSD Issues on Windows 11

Set CPU to Performance Mode (When Needed)

Step 1: Install cpupower-gui.
For tasks needing maximum CPU speed, install it:

1sudo apt-get install cpupower-gui

Launch and set the scaling governor to performance. Note that this increases power consumption and heat output.

Clean Up and Maintain Your System

Step 1: Regular Cleaning and Maintenance.
Regularly remove unused packages, clean logs, and empty the trash using:

1sudo apt autoremove
2sudo apt clean

Step 2: Use Timeshift or Similar Backup Tools.
Create system snapshots before major changes to allow easy rollback if necessary.

Applying these targeted tweaks and maintenance steps will enhance Linux Mint’s performance, reduce system lag, and offer a more enjoyable desktop experience on both modern and older hardware. Regular optimization ensures your system runs at its best.

Did you enjoy this article? Feel free to share it on social media and subscribe to our newsletter so you never miss a post!And if you'd like to go a step further in supporting us, you can treat us to a virtual coffee ☕️. Thank you for your support ❤️!

Categorized in: