Arch Setup

Just a place to put notes about how I configure my Arch Linux setup, particularly preferences and optimizations.

Parallel package building

When building packages, particularly through the Arch User Repositories (AUR), the process may take a fair bit of time, depending on what is being packaged. Changing a few flags can allow for parallel compiling and compression. In the /etc/makepkg.conf file, these changes can be made:

MAKEFLAGS="-j4"

COMPRESSXZ=(xz -c -z - --threads=0)

The first change will set the number of compiling threads to the number of available CPU threads. The second will set the maximum available threads as default. Note that, while technologies such as Hypertheading will increase the number of threads per core, they may not pose an advantage when being used all together for the same task. It may be worth reducing the number of threads being used, though an investigation into this is need to confirm. EDIT: I’ve had my system completely freeze once from using all available system threads at the same time. I’ve changed what was $(nproc) to 4 to correct this. I have not experienced the issue with the compression, so I am leaving it at 0.

While other changes may also be made, I have yet to experiment with them, and several (from what I can tell) would more likely improve the runtime of the application, rather than building, and it is difficult to say that there would be a significant improvement.

bashrc

There are a few preferences, and aliases that I’ve added to this (~/.bashrc), for convenience and personal usage. The main of which is to add automatic colouring to applications like the following:

ls, grep (and variances), pacman

I’ve also set an alias to redirect vi to vim, since 3 characters are too exhausting to enter, whereas 2 is much more conservative on energy. I’ve also set my default editor by exporting VISUAL=’vim’.

Finally, to avoid overlapping issues when a line surpasses the width of the terminal, the following is also set:

shopt -s checkwinsize

pacman mirror list organization

One change I recently discovered was how to organize mirrors in the list by connection speed. This made a significant improvement to my package download times, and the change was fairly simple to do. The rankmirrors command will automatically test available mirrors, and can output them to a new file organized. More details about this are available on the Arch Wiki.

I’ve also set a bashrc alias to automatically perform this task, limiting the testing mirrors to United States and Canada, in order to reduce the testing duration:

alias updatemirrors=”su -c  $’cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup; sed -i \’/.*\(Canada\|United States\)/,/^$/ s/^#//p\’ /etc/pacman.d/mirrorlist.backup; rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist'”

TLP

TLP is an advanced linux power manager, which is particularly useful for those using laptop computers. Its default configuration is generally useful, however sometimes it’s worth tweaking settings found in /etc/default/tlp. The following are some of the changes I’ve made to my own, for a more particular use case.

I disabled the following settings, as I do not have an AMD GPU:

#RADEON_POWER_PROFILE_ON_AC=high
#RADEON_POWER_PROFILE_ON_BAT=low

#RADEON_DPM_STATE_ON_AC=performance
#RADEON_DPM_STATE_ON_BAT=battery

#RADEON_DPM_PERF_LEVEL_ON_AC=auto
#RADEON_DPM_PERF_LEVEL_ON_BAT=auto

I also disable bluetooth all together, since I never use it:

DEVICES_TO_DISABLE_ON_STARTUP=”bluetooth”

Swap

I’ve had instances where I end up maxing out my memory, or nearly, and by default the system moves pages to swap. The problem with this, is once memory is freed later, the swap isn’t cleared, and applications become slow. To avoid this, setting the swappiness as described on the wiki page does the trick. Creating the file /etc/sysctl.d/99-sysctl.conf and adding the following line:

vm.swappiness=10

Advertisements