Linux stuff

Picade and audio

A while ago, Peter and I built a RPi based Picade box. It was a lot of fun! We had some issues with sound though, with a lot of static and clicking noises. After some digging, I ended up with the following configurations:

# Enable audio (loads snd_bcm2835)
# Try to fix sound

I'm not sure exactly which ones are absolutely necessary, but the above works well for us.


Slow emacs startup on CentOS7 under VirtualBox

I use VirtualBox for most of my development efforts on my macBook. I recently had to reinstall CentOS7 on this new machine, and was noticing a 10s (2x 5s) delay on startup times for Emacs. Doing an strace -tt on the Emacs binary, I noticed it would timeout on trying to lookup its own hostname. I'm not sure why, but this timesout on the DNS lookups were annoying the hell out of me. The solution was to add the local hostname (set in /etc/hostname) to the entry in /etc/hosts.


TCP Fast Open

i've been fiddling with TFO lately, and my BFF Randall found this excellent article on the topic. Well worth a read! Doing some tests, for small requests / responses, you can make resonse times quite noircably faster!

Note: On my modern linux kernel, the command to get the TFO metrics out of netstat is not correct. It should be

$ grep "^TcpExt:" /proc/net/netstat | cut -d " " -f 91-96  | column -t



Comparing RPM packages between two systems

I needed to sync two different Fedora boxes, such that they have similar (but not identical) packages installed. This turns out to be fairly straight forward with some basic command line utilities. First, create a list of all packages on each machine, with something like

$ rpm -qa --queryformat='%{NAME}\n' | sort > machine-1.txt
$ rpm -qa --queryformat='%{NAME}\n' | sort > machine-2.txt

​Then, using the -f option to grep, you can see what's missing from each system. E.g.

$ grep -v -f machine-1.txt machine-2.txt


Swapping CAPS lock and CTRL on Raspbian

I was fiddling with one of my (new) RPi's, and realized there was no UI component to switch the CAPS lock to be CTRL. Really? So, found a couple of things that has to be modified:

First, I edited /etc/default/keyboard, adding


​​Secondly, I modified my ~/.config/lxkeymap.cfg, adding

option = ctrl:swapcaps



Fedora 24 issues on VirtualBox

As of some recent upgrades to my F24 VM (running under VirtualBox), my system would not boot properly any more, getting errors like

NMI watchdog: BUG: soft lockup - CPU#0 stuck


I couldn't find any details as to why this was, other than someone having similar issues with a bad GPU card (not under a VM). I checked my display settings for the VM, which had the minimum recommended setting of 21MB. This ought to have been plenty, since I run my Linux system in a head-less mode (no display etc.). However, Linux must have changed something, cause this no longer worked, but bumping the GPU memory to 32MB seems to have fixed it. Bizarre.


firewalld and network interfaces

I have to say, firewalld and firewalld-cmd really sucks. But, since it's the default on a bunch of installations I use, and I try to "drink the koolaid", I've had the misfortune to try to set it up. Now, it mostly works, except when it doesn't, and then it really fails hard. Case in point, I wanted to reassign some network interfaces to a different zone, and naïvely thought that e.g. this would work:

$ sudo firewall-cmd --permanent --zone=public --remove-interface=eth2
$ sudo firewall-cmd --permanent --zone=internal --add-interface=eth2


Yeah, not so much ... What does instead work is adding lines like this to /etc/sysconfig/network-scripts/ifcfg-eth2:




Clamav installation failing on Fedora Core 18

Someone majorly botched the clamav packages in Fedora 18, where the packages fail to create the appropriate user ID and group ID. The output from the yum install looks like

Running Transaction
  Installing : clamav-data-empty-0.97.8-1.fc18.noarch                       1/5 
  Installing : clamav-lib-0.97.8-1.fc18.x86_64                              2/5 
Usage: groupadd [options] GROUP

  -f, --force                   exit successfully if the group already exists,
                                and cancel -g if the GID is already used
  -g, --gid GID                 use GID for the new group
  -h, --help                    display this help message and exit
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -o, --non-unique              allow to create groups with duplicate
                                (non-unique) GID
  -p, --password PASSWORD       use this encrypted password for the new group
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into

useradd: group 'clamupdate' does not exist
  Installing : clamav-filesystem-0.97.8-1.fc18.noarch                       3/5 

This is reported in RedHat bug 963920. As commented on this bug, the work around is to assure these users are created before installing the clamav packages. E.g.

$ sudo yum remove clamav\*  # Be careful with this, make sure you are not losing anything you wish to keep
$ sudo groupadd -r clamupdate
$ sudo useradd -r -g clamupdate -d /var/lib/clamav -s /sbin/nologin -c "Clamav database update user" clamupdate
$ sudo yum install clamav-data clamav clamav-update clamav-milter



I use more and more remote X11 applications now, and VNC, since I switched my desktop (and laptops) over to use OSX entirely. This works great. Sometimes, it can be a bit annoying to get the clipboards and selections to synchronize across windows, or even to just get a portion of a file from e.g. X11 into OSX. There's a very useful command for this, that can easily be scripted (and bound) to some key of your own preference. For example, to take the clipboard from an X11 app, and put it into the main selection buffer, you can do

$ xclip -o -selection clip | xclip -i

To put a portion of  a file into both the clipboard and the primary selection:

$ head -10 /etc/group | tee >(xclip) >(xclip -sel clip) > /dev/null

You can obviously make some convenience macros around this, or simple shell scripts.



Subscribe to RSS - Linux