Fine tuning Ubuntu 20.04 on Asus UX305FA laptop
Unfortunately Ubuntu doesn’t come configured perfectly out of the box for every laptop under the sun. For my laptop in particular (an Asus UX305FA) there are a few changes I’ve had to make repeatedly across multiple Ubuntu versions, so I figure it’s worthwhile to document them.
Using PowerTop to improve idle power consumption.
Install PowerTop
sudo apt install powertop
PowerTop is a tool for analysing power consumption on Intel systems. You’ll need to run it as root to see all the information it provides. The application has a tab called ‘tunables’ which shows various system parameters either tuned to ‘Good’ or ‘Bad’ settings. You can toggle these settings interactively, but they will reset to the default (likely bad) values after a reboot.
Fortunately PowerTop has a command line flag --auto-tune
which will set all the tunables to ‘Good’, and that is most likely what you want. We can create a SystemD service to do this at boot (as described in the referenced Arch Linux wiki).
Create the file /etc/systemd/system/powertop.service
and populate it with these contents:
[Unit]
Description=Powertop tunings
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/powertop --auto-tune
[Install]
WantedBy=multi-user.target
If you wish to fine tune these settings (for example, leave some of them ‘Bad’) there are instructions for doing so on the referenced wiki.
References:
https://unix.stackexchange.com/questions/18279/powertop-tunables-what-does-it-do
https://wiki.archlinux.org/title/powertop
Fix issue where keyboard and trackpad cannot be used simultaneously.
When I first started up Minecraft on this laptop, I noticed that I couldn’t hold W to move forward, and also aim with the trackpad. That’s clearly a problem. Below are the instructions to fix this:
Make sure xinput is installed.
Type xinput
in terminal to find the name of the trackpad device. Mine was ETPS/2 Elantech Touchpad.
Run xinput --list-props "DEVICE"
to list the properties of the device, subsituting DEVICE with the appropriate name of the trackpad device listed, if it is not the same as mine.
Go through the list until you find something like Disable While Typing.
Use a command like
xinput --set-prop "DEVICE" ID_OF_PROPERTY 0
For me, this was
xinput --set-prop "ETPS/2 Elantech Touchpad" 333 0
Reference:
https://askubuntu.com/a/1286173
Increase swap file size (assuming you configured with LVM)
I setup my system with LVM and full disk encryption. The default swap size with these settings is for some reason only 1GB. Clearly this is not sufficient. What we will do is add a swap file to supplement the system with additional swap space.
First we’ll make the swap file on the root filesystem, since this is a safer order to do things in (you won’t have any time without swap enabled). Create an empty file on the root filesystem of the size you wish for your swap file. Mine will be 8GB
sudo dd if=/dev/zero of=/swapfile bs=1M count=8000
Format the file as swap
sudo mkswap /swapfile
You might get a message about setting propert file permissions, so do that
sudo chmod 0600 /swapfile
Now add the following line to your /etc/fstab file
/swapfile none swap sw 0 0
If you want to disable the LVM swap volume, delete (or comment it out by prefixing with # character) the line referencing the LVM based swap volume in the /etc/fstab file. It should be the only other swap volume configured in the file.
Now you can enable the additional swap
sudo swapon -a
You can remove the old LVM swap volume if you like, but I’m not going to cover that here since it only recovers 1GB of disk space. There’s no harm in leaving it enabled in any case.