2013-02-28

CPU microcode

CPU microcode is useful for defining hardware-level instructions in firmware. This allows CPU bugs to be fixed without the need to replace the chip. Unfortunately, microcode updates are volatile and need to be made at every boot.

To automatically update CPU microcode at bootup (for Intel and AMD CPUs) on FreeBSD, install sysutils/devcpu-data and add to /etc/rc.conf

microcode_update_enable="YES"

To automatically update CPU microcode at bootup on Archlinux, install extra/intel-ucode (for Intel CPUs) and extra/amd-ucode (for AMD CPUs) and create a file /etc/modules-load.d/microcode.conf with microcode as content.

To load the module directly on Archlinux run modprobe microcode and to check the update status and new firmware version run dmesg | grep microcode

2013-02-27

proper font rendering

The fontconfig and Xft configuration on GNU/Linux and FreeBSD require some trial and error to reach the desired font clarity and aesthetics. I reached a point where the following works quite well for me.
  • Enable the auto-hinter and disable the byte-code interpreter (BCI) for hinting. Auto-hinting works better for fonts without good hinting instructions (most fonts) and the BCI works better for fonts with good hinting instructions.
  • Use slight hinting as opposed to full hinting which works great with the auto-hinter.
  • Enable anti-aliasing and sub-pixel rendering to give the illusion of a high font resolution. The Lagom LCD Test can help you find out the correct sub-pixel arrangement for your monitor.
  • Enable the default LCD filter to reduce colour blur due to sub-pixel rendering. 
  • Set the font DPI to the correct monitor DPI to improve rendering and font proportions. Use xdpyinfo | grep -i resolution to find out the correct DPI value for your monitor.
The Xft configuration resides in ~/.Xresources


The fontconfig configuration file is ~/.config/fontconfig/fonts.conf (where .config is actually $XDG_CONFIG_DIR)

2013-02-25

systemd not cleaning up /var/tmp

If you notice /var/tmp being polluted with systemd-private-* directories then systemd is not cleaning up the directory on bootup or shutdown.

To fix that, add a tmpfile file /etc/tmpfiles.d/cleanup-var-tmp.conf with the following content

r /var/tmp/systemd-private-* - - - - -

systemd not cleaning up old journal entries

I noticed that systemd was not rotating and cleaning up old journal entries and the logs were indefinitely increasing in size. The number of .journal~ files was also increasing in /var/log/journal. For some reason systemd was not cleaning things up at shutdown.

To view the amount of space used by the systemd journal

journalctl --disk-usage

Limiting the journal size can be done in /etc/systemd/journald.conf

SystemMaxUse=16M

Note that I find 16M to be more than enough, should hold about 10 days of logs. Increase that value as you see fit.

If you are not using syslog then also disable the forwarding of journal entries to syslog logs in /etc/systemd/journald.conf

ForwardToSyslog=no

Finally, add the shutdown hook to the initramfs in the HOOKS list in /etc/mkinitcpio.conf

HOOKS="... shutdown"

And re-generate the initramfs

mkinitcpio -p linux

Note that already existing .journal~ files will not be removed, to get rid of those

find /var/log/journal -name "*.journal~" -exec rm {} \;