Skip to main content

How To Add Terminfo to FreeBSD

If you have ever tried remotely logging into a FreeBSD host from a terminal that uses its own terminfo (eg: konsole), you may have noticed the wrong characters displayed or errors like "tput: tgetent failure: No such file or directory".

As a workaround, you can "downgrade" to the xterm terminfo by setting the TERM environment variable to 'xterm' before you use ssh, but this is cumbersome. Doing a google search on this issue shows a lot of advice to "set your terminal's TERM environment variable to xterm" which isn't really the right answer here, especially when we can easily add the terminfo that we require to a FreeBSD host's termcap database.

In Linux, the terminfo for each supported terminal type is typically stored in individual binary files within /usr/share/terminfo. FreeBSD instead uses a single ASCII file: /usr/share/misc/termcap

In order to add an additional entry to termcap, you'll first need to convert the terminfo file from Linux into the termcap format for FreeBSD. You can do this by using the infocmp command:

$ infocmp -Cr /usr/share/terminfo/k/konsole-256color
konsole-256color|KDE console window with xterm 256-colors:\

You can then copy the output and append it to your FreeBSD host's termcap file (/usr/share/misc/termcap).

Finally, in order to use the new termcap, you'll need to update the terminal capability database by doing the following:

cd /usr/share/misc
cap_mkdb termcap

Once the terminal capability database is updated, you should now be able to remotely log into your FreeBSD using the full terminal capabilities of your terminal emulator. Hooray!

Apple Airpod Pros with Android and Linux

It's pretty clear that the Apple Airpod Pros are marketed towards iPhone and Mac users. However, the Airpod Pros work pretty well with both Android and Linux in my experience - although there are a few caveats to be aware of.

In Android, the Airpod Pros pair just like any other bluetooth device. You can put the Airpod pros into sync mode by placing them in their case and pressing the button on the case while the case is open. Then, they can be paired in the Android bluetooth menu. Once paired, the Airpod pros work just fine as both headphones and a headset. Keep in mind that Airpods do not report their battery health over bluetooth. Instead, you will need to install the OpenPods application to show you the battery status of each Airpod and the charging case:

In Linux, you can pair the Airpods with any of the various bluetooth tools, but only as headphones. Pulseaudio gives the option of using a "A2DP High Fidelity Playback" profile and a "Headset HSP/HFP" profile, but the HSP/HFP profile is unavailable. I don't think the Airpod Pros support HSP. I think it may be possible to get this working with pulseaudio and ofono somehow, but I haven't managed to get it working.

None of the AI assistant features work in Linux or Android, but I don't miss any of those. You can switch between transparency mode and noise-cancellation by holding the button down on either Airpod Pro. You can advance tracks by double clicking the button, and toggle pause with a single click.

One of the most annoying things about the Airpod Pros is the lack of an actual firmware update process. If you are using them with a (recent, 7 or later) iPhone, they shoud automatically update at some point while they are connected to the iPhone and charging. There's no way to force the process - so you just need to pair with a friend's iPhone, put them on the charger, and hope they update.

As long as you don't need headset functionality on Linux, the Airpod Pros can be a pretty good option for a pair of wireless earbuds - even if you use Android or Linux. It's pretty disappointing that there is not a way to manually update the firmware. Even worse, there's no way to update if you have an Android. That being said, I would still casually recommend them to anyone who doesn't mind the price and annoyances I've mentioned.

Mounting Storage in FreeBSD

After upgrading the root SSD on my server from a lowly 240GB Corsair drive with no DRAM to a 500GB Samsung 870 QVO, I found myself wanting to do something interesting with the recently decomissioned corsair drive. I decided to plug it into a SATA to USB3 converter and hook it up to my FreeBSD-powered router so that I can try out ZFS (without having to install the ZFS kernel modules, which you would need on a Linux box).

Before creating a zpool, I figured I would mount the drive before any modifications. After all, I've never actually mounted a linux-formatted drive in FreeBSD before. First thing I did was to take a peak at dmesg:

ugen1.2: <SABRENT SABRENT> at usbus1
umass0 on uhub0
umass0: <SABRENT SABRENT, class 0/0, rev 3.00/2.04, addr 1> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:5:0: Attached to scbus5
da0 at umass-sim0 bus 0 scbus5 target 0 lun 0
da0: <SABRENT  0204> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number YB4206942069G
da0: 400.000MB/s transfers
da0: 228936MB (468862128 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>

The dmesg output explains to me that a new SCSI device (da0) is being presented to the system by way of the USB mass storage kernel module. We should now have some new device nodes in /dev:

root@router ~ $ ls /dev/da0*
/dev/da0   /dev/da0s1 /dev/da0s2

Great! I see my ext4 data partition (da0s1) and a swap partition (da0s2). Now I should be able to mount my ext4 partition to a mount point:

root@router ~ $ mount /dev/da0s1 /mnt
mount: /dev/da0s1: No such file or directory

This is a misleading error message, because as we can see from the above "ls /dev/da0*" command, /dev/da0s1 is a file. We're missing something... In FreeBSD, you need to specify the fstype to the mount command. But what fstype should we use for an ext4 disk?

root@router ~ $ ls /usr/src/sys/fs
autofs    cuse      devfs     fdescfs   fuse      nandfs    nfsclient nullfs    pseudofs  tmpfs     unionfs
cd9660    deadfs    ext2fs    fifofs    msdosfs   nfs       nfsserver procfs    smbfs     udf

FreeBSD supports ext2/3/4 through the ext2fs kernel module. If we specify the fstype, we can mount the disk:

root@router ~ $ mount -t ext2fs /dev/da0s1 /mnt
root@router ~ $ ls /mnt
bin        dev        home       lib64      media      opt        root       sbin       sys        usr
boot       etc        lib        lost+found mnt        proc       run        srv        tmp        var

Now that I know I can mount my ext4 drive in FreeBSD, I'm going to umount it and follow along in the ZFS section of the FreeBSD handbook to create pools with "zpool" and start my journey into ZFS. I'm still not convinced that I would want to use ZFS instead of LVM, but the only way to find out is to learn more and try it for yourself. I may decide to post again with some useful ZFS information if I get a chance.

Building a Home Router

Is an ASUS RT-AC68U running ASUSMerlin firmware ( good enough for a home network? It's a pretty cost-effective solution that I employed the past five years or so to provide reliable network access and wifi to the different appartments and houses I have lived at. I started with one AC68U, but ended up adding two AC1900s wired over a CAT6 backhaul in my ASUS "AiMesh". The ASUS mesh system worked pretty well for basic things. Unfortuatenly, the AiMesh system cannot seamless handle a client roaming between access points, which would lead to frequent disconnects during video calls. Outside of mesh wifi performance, there are also some other limitations with a commercial router like this. Neither the official ASUS firmware nor the ASUSMerlin firmware allows you to reconfigure your LAN IP address space: you're stuck with You also can't add custom nameserver entries - the router's local nameserver will only respond with hosts configured via DHCP. It was also never clear to me how much these ASUS router's slow down general network responsiveness. I have a lot of bandwidth services running in my LAN that use the internet, how many of my packets are getting queued for routing when the ASUS is overloaded? How many of the temporary "This page could not be displayed" web issues were due to the router and not due to my internet provider? Some of these answers are difficult to determine without trying something else.

Even though I was relatively happy with my AC68U AiMesh network configuration, I decided to buy some stuff and build a router to see if I could do better with off-the-shelf hardware and open source software. The ASUS units can even be repurposed as access points. With this in mind, I built my first budget AM4 system with roughly the following specs:

  • $20 PC case on newegg

  • Spare ATX power supply

  • An extra DDR4 stick from my PC

  • Ryzen 2600 on sale (This is overkill for what a router needs, but the price point was just right)

  • Quad Gigabit Intel NIC

  • Old nvidia PCIE video card with the PCIE connector cut down to a 1x slot with a nibler

Once I got all the parts together and the system was POSTing, I opted to install FreeBSD. I could have installed PFSense ( to get something up and running quickly, but I wanted to force myself to learn more about FreeBSD and networking in general. PFSense is built on FreeBSD and all of the core functionality you need for a router (DHCP, DNS, Firewall, Routing) is all immediately available in a FreeBSD system.

Between the FreeBSD handbook ( and the man pages for bind and dhcpcd, all the documentation you need to configure this is Freely available. I do plan to detail more of my configuration and share some examples, but I'll share those details in part 2 on this series.

Good Cheap Guitar Pedals

NOTE: This was a draft from 2017 that I never finished writing, but wanted to post because it might be useful or interesting.

As a younger guitarist, I had a few stompboxes and pedals but primarily ended up using a KORG AX-3000G multiFX rig. MultiFX rigs have their share of problems in their past, and the professional stuff like AxeFX is extremely expensive so I decided to look into building a pedalboard. I thought this was going to be expensive, but I ended up building a decent board without dropping too much cash. Here's the breakdown:

  • Donner DB-3 Aluminum Pedalboard - $73

  • Danelectro FAB Chorus - $20

  • Joyo 6 Band EQ - $30

  • Cadine Blue Ocean Delay - $25

  • Mooer Phase 90 Clone - $40

  • Valetron Lazaro Fuzz - $40

  • Joyo Ultimate Drive - $30

  • Ibanez TS Mini - $50 (Used)

  • TC Electronics Polytune3 - $70 (used)

  • CryBaby Wah - dunno got it forever ago

  • Dunlop High Gain pedal - dunno got it forever ago

  • Ditto Looper - $50 (used)

Donner DB-3:

This thing is way cheaper than the pedaltrain but I see no reason to go with the pedaltrain over this. It also comes with a soft case and some offbrand velcro. If you want to save money you can just build one too, but I was in a hurry to get something going.

Danelectro FAB Chorus:

$20 for a chorus with rate/depth/mix knobs. It sounds like a chorus lol. It's fine. You don't really need a chorus if you have a phaser, but if you want one this is fine for $20. My only gripe is that the knobs are in weird positions and it takes up a decent chunk of pedalboard with its weird shape. The mini chorus seem to be $35+ - if space is a premium maybe go with a mini chorus but other than size this is fine. UPDATE: I've since spent $50 on a MXR micro chorus, but I kinda like the danelectro better because it's more configurable and has less noise.

Joyo 6 Band EQ:

You probably don't need this, but this is nice to optionally boost your mids or highs or to use just as a clean boost pedal. You can also do some interesting things but placing this in different parts of your chain - I typically use it between my modulation and my distortion but you can do whatever. It's pretty cheap and you tweak your other pedals wiht it so its nice to have but definitely not necessary. This doesn't look very durable - the plastic knobs look a little sketchy but i haven't broken them yet.

Cadine Blue Ocean Delay:

Digital delay with 3 knobs. You can get a 2 tap delay with this, or turn the knobs up to get a few different delay tones. This can also be used as a reverb in some settings. Pretty versatile for $25. Obviously not a stryman but for the basics it works great.

Mooer Phase 90 Clone:

I use this, but I honestly would have rather spent the extra $10 for a used phase 90. I might actually do that. This one is a little pricy and not quite a clone. It sounds fine but the phase 90 is so much better idk

Valetron Lazaro Fuzz:

More of a distortion than a fuzz, but its decent and cheap and has four knobs. REALLY bright green light so make sure to tape it so you don't lose your vision.

Joyo Ultimate Drive:

This is an OCD clone IMO. The tone knobs aren't the same and the switch is useless, but overall a good drive pedal. I put the TS mini before this to get a really solid rock distortion. UPDATE: I've since bought a legit OCD, but the joyo isn't bad. The joyo just has a much smaller range of where you can put the knobs and have the pedal still soung good.

Ibanez TS Mini:

Buy this!! Now! it's the best. This isn't a cheap chinese pedal, but I was able to find one used for $40. You can use this for so many things: boosting another drive pedal, you can use it as an overdrive, etc

Polytune 3:

I like this a lot but you can also buy a cheap tuner for way cheaper. I don't really use all the advanced features (like tuning 6 strings at once) but the display is very easy to see and never has an issue pitching a given sound.

CryBaby Wah:

Not sure why this is on this list; it's not a cheap chinese pedal but the crybaby is a great pick up if you can score on. It's not true bypass, you can mod it to be if you really care (I did, but probably didn't need to).

Dunlop High Gain Pedal:

This is great for swells and its also passive and doesn't require any power. Takes up a lot of room but it's worth it and is exactly same size as crybaby


Great song writing tool. I still haven't tried any of the cheap knockoffs yet because I was lucky enough to snag one for about $40 on eBay.

xanBLOG is alive!

I got tired of dealing with wordpress so I took it down for a while. In order to keep some old links alive, I've migrated my blog to Nikola and may tweak it some more and use it at some point. Cheers!

Migrating to a new provider

I'm currently in the process of migrating to a new provider. Long story that I won't get into right now. I'm really sick of setting up wordpress, so I will be looking to migrate this to a more lightweight blogging solution in the future.

Cheers and keep on rockin' in the free world!

Blog Refresh

I reinstalled wordpress today and purged all of the comments (100k spam comments in moderation :X ). I haven't been posting much lately because I've been busy doing other things, but I have a couple things in mind that I want to post about if I get around to it.

Cheers; keep on rockin' in the free world.

Gracefully killing "stuck" SSH sessions

On my home WiFi connection, I occasionally find my SSH sessions being stuck and completely unresponsive. The only way to resolve the issue has been to close the window of the terminal emulator, which is usually no big deal. This becomes more of an issue when using ChromeOS on my CR48 where you can't close the shell window by any means other than the "exit" command. Prior to discovering a more graceful solution, I had been using this somewhat lengthy workaround (which requires ChromeOS to be in dev mode):

  • Press Alt-Ctrl-T to open a new crosh shell.
  • Type "shell" to open a Linux shell.
  • Run "ps fax | grep ssh" to find the process id of the stuck ssh session.
  • Kill the stuck session with "kill -9 [process ID]"
Killing the process manually is not ideal, especially when your WiFi drops whenever the router yawns.

This solution that is built into the standard openSSH client takes a lot less time and closes the connection as opposed to just killing the client process. When the session is stuck, press the following keys to close the SSH connection:

  • Enter
  • Tilde ( "~" / shift back-tick )
  • Period

That's it! Your connection will be closed with the "Connection to [host] closed" message. I hope that you find this tip as useful as I did. Happy hacking!

Exploring Perl

Throughout my years of programming, I have heard abundant praise about the Perl language.  On the other hand, I've known some programmers that refuse to touch Perl with a ten foot pole.  Python had been my scripting language of choice in the past. Regardless, I decided it was in my best interest as a programmer to at least be familiar with the language.

After some quality time with "man perlintro", I began to get fairly comfortable with the syntax.  Diving into "man perlretut" really opened my mind to ways to parse text in new ways with regular expressions instead of complicated code chock-full of nested loops and loads of conditionals that are quite frankly awkward to code.  Another great thing about regular expressions is that many other languages and programs have support for them or a similar syntax (python re and vim for starters). I highly recommend any programmer with some spare time to check out the perlintro and perlretut manpages if they haven't already.

I wanted to dive into a bit of web programming with Perl, so I installed and configured mod_perl for my apache2 server on my Linode.  On Arch Linux, you can install mod_perl with:

pacman -S mod_perl

I added the following entry to my httpd.conf file to enable mod_perl:

<Files ~ ".(pl|cgi)$"> PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlSendHeader On </Files>

Your mileage may vary with your distribution and version of everything, but that was enough to get me started with mod_perl and apache2.

My first script was a warsow server status checker for my warsow server. You can check it out here and the source can be found here. The script is pretty simple, it basically scrapes the output of qstat (a command-line program to query quake/warsow servers) and formats the output into an HTML friendly format. Regex is used to parse the qstat output into variables that can be used to form the HTML friendly output. The code probably isn't as optimal as it could be -- for anyone checking out the source keep in mind that I was learning everything about the language and regex as I was writing this. The output of the script is currently bare-bones HTML, but with CSS added the output could also be easily improved to be more eye-friendly. Maybe one day I will extend this script further, but as it stands it was a great learning experience and still serves a useful purpose. I'm looking forward to learning more Perl and regex; I feel as if I am only scratching the surface of how much these tools will make my life easier as a programmer.