Category: Linux Desktop Specific

Recompiling for Performance on Arch Linux and Derivatives
article #1196, updated 154 days ago

Most of the advice I have been given and found, for recompiling certain packages for Arch Linux and derivatives, has made things very very complicated, and often includes statements that it’s not worth it. Well, I am a witness that it is well worth it, one can increase performance quite a lot, and it’s not too complicated as of this writing.

My Arch derivative of choice is Manjaro, it does a lot of things for us right off the ISO. But all of these methods are pure Arch, all you have to do is get the prerequisites.

Prepare the environment, part I

Before we do anything, we update the system and reboot. This is partly because operations further down will get new packages.

Then we install yaourt. Manjaro has it in its standard repos and can be installed just with pacman -S yaourt; you’ll have to add another repo for pure Arch. Once yaourt is in, you’ll need to create folder “yaourt-tmp” in your home folder (for our purposes, /home/username/yaourt-tmp), edit /etc/makepkg.conf, and find this line:


Add a line just below it, thus:


Without the above change, package production may well run out of room, because by default /tmp is stored in RAM.

Secondly for this file, find two lines beginning thus:


Both lines will be quite long, with close-quotes, containing several items. One of the items in both is -march=; this needs to be changed from whatever it is to -march=native. We also need an item added or changed if it exists: we need -mtune=native. This will make everything we compile, run by far the best on the very make and model CPU we have in this machine. It will also make the packages not run well on anything else, fair warning :-)

Thirdly for this file, find a line starting with this:


There will be a number to the right and a close quote. Find out how many CPU cores your machine has, and add one; so if you have a dual core, you’ll add this line just below the original:


This speeds up package compilation a lot, even with just two cores, and enormously more with 4 or more.

There is one more item to prepare. In this file (“~” means your home directory):


you’ll want to add the following:

keyserver-options auto-key-retrieve
auto-key-locate hkp://

This eliminates the need to manually receive and approve GPG signing keys for various source files as they are downloaded.

Install an Optimized Kernel

So. Once the above is done, it’s not hard to use yaourt to build and install the Xanmod kernel, an excellent desktop-optimized kernel:

yaourt -S linux-xanmod

Yaourt will bring in the PKGBUILD, the file defining how the kernel source is download and package built. It quickly gives the option to edit it, and doing so is part of our procedure. As of this writing, you’ll look for one line:


and change this to:


This is according to documentation in the file itself; in this version at least, 22 equals “native”, which means the kernel will be optimized for the very specific CPU make and model in your machine. You can then save and choose the defaults for the rest of the process. It will take a while, 30 minutes often and much more on slower machines. Once the rebuild and install is done, you will notice a performance boost after booting the new kernel. Do be aware that automatic updates may override this kernel down the road; you can use grub-customizer (also available by yaourt) to specify which kernel you will boot.

Prepare the environment, part II

You can definitely use yaourt by itself to compile and install a very large number of packages, and given that the above steps have been taken, doing so means building packages optimized for your particular machine. But yaourt does not give us current distro packages: it only gives us the A.U.R., the Arch User Repository, which is packages either not part of the standard distribution at all, or packages closer to or sitting on the bleeding edge. For standard packages, we have to do differently.

One of the ways we can do this, is with pbget, which we can get with yaourt:

yaourt -S pbget

Then we make a folder /home/username/build , and cd into it.

Build glibc

After the kernel itself, by far the most used boulder of code in a Linux machine is the GNU C Library, glibc for short. So we rebuild this next.

We pull the PKGBUILD and related build scripts with pbget:

pbget glibc

And then we cd into the directory created by pbget, and light off makepkg and watch it go:

cd glibc
makepkg -s

If packages are needed for the build, install will commence, and then compilation. Compilation will take quite a while, longer even than the kernel. After it’s done, install:

sudo pacman -U *.pkg.tar.xz

and reboot to fully engage, though you may see improvement as soon as you start running or restarting programs.

Issues with many packages

There are issues which can show up with many packages.

First of all, compilation may fail. glibc is a huge package with a very large number of complications, and sometimes those complications have to do with specific versions of gcc and other items — which means if your machine is updated past those versions, you won’t compile successfully. You can either dig deep in code and/or forums to see what is going on, or just wait until the (very knowledgeable and capable, much more so than I) primary developers resolve it for all of us. Even something like the Xanmod kernel compilation may fail occasionally for the same reasons; there are quite a few more kernels available to try from yaourt, though each of them have different methods of setting CPU optimization, do watch for this.

Secondly, getting the versions you need. Right now, for instance, Manjaro’s standard stable xorg-server — a package we would very much like to CPU-optimize, because its contents use a lot of our CPU — cannot be retrieved using pbget, because pbget retrieves from the current Arch libraries not Manjaro, and to make it even more complex, Manjaro has just moved its PKGBUILD set from github to gitlab, so we have to look in the archived github area for the stable Manjaro xorg-server PKGBUILD if we want it, we cannot use pbget. Unless you are or plan to become very knowledgeable in these things, best to recompile versions you already have.

And thirdly, when you automatically update using pacman or GUIs, newer un-optimized versions will be autoinstalled over your optimal one. There may be ways to override this, but override is very questionable, because a very outdated package of many sorts is likely to produce crashes, especially something core like glibc or xorg-server. Better to just recompile after the update is installed. It is also helpful to choose such packages for the rarity of their updates, and glibc is one such.

Other packages to CPU-optimize

There are many other packages worth recompiling. I choose these regularly and differently according to high result/effort ratio! Here is a list, there are doubtless many more. These are all for the ‘pbget’ method used for glibc, not yaourt. There may well be others which will help more, certainly for particular use purposes, e.g., audio and video.


Categories:   Linux OS-level Issues   Linux Desktop Specific


Use Android Smartphone as High Quality Webcam
article #1049, updated 529 days ago

It’s called DroidCam, and it really works, Windows and Linux.

Under Linux you’ll need kernel module compilation capability, headers only for source. If you use the Adobe Flash Player for camera, or any other V4L version 1 application, you’ll want to start it like the below for the Pale Moon web browser:

LD_PRELOAD=/usr/lib/libv4l/ palemoon

Categories:   Audio-Video   Linux Desktop Specific


Fix Firefox Printing on Linux
article #1021, updated 537 days ago

First try installing this package:


If that doesn’t help and you have a 64-bit OS, create this file:


containing this line for 64-bit OS:

export GTK_PATH=/usr/lib32/gtk-2.0/

Categories:   Application Issues   Linux Desktop Specific


Install Fonts Manually in Linux
article #1048, updated 537 days ago

There is a per-user font installation procedure, but we’ll do this system-wide just in case. This procedure presumes that you are using a modern fully-fledged Linux desktop which includes a font server.

  1. First we create a folder for manual font installs, and give it the right permissions.
    sudo mkdir /usr/share/fonts/manual-installs
    sudo chmod 0555 /usr/share/fonts/manual-installs
  2. Copy all of your .ttf, .otf, etc., files, into the folder, and give them all the right permissions. We’ll say that you downloaded a file named to Downloads in your home directory, and unpacked it.
    sudo cp ~/Downloads/Fonts/* /usr/share/fonts/manual-installs
    sudo chmod 0444 /usr/share/fonts/manual-installs/*
  3. Update the font cache.
    sudo fc-cache

Categories:   Linux Desktop Specific   Linux OS-level Issues