Kai Hendry's other blog archives

Back to bash after fish

Fish logo

I tried the http://fishshell.com/ instead of bash, mainly because my bash history is continually truncated despite my efforts to keep every command I've ever successfully (return code 0) typed!

x220:~$ wc -l .bash_history
84 .bash_history
x220:~$ history | wc -l

The fish shell's 85k SLOC versus bash's 225k was also re-assuring. autotools and cpp did make me cringe however.

So porting my aliases and such from ~/.config/fish/config.fish from my ~/.bashrc was a bit of a PITA since:

  • fish's conditional statements are not POSIX shell compatible <--- insane

Nonetheless I got fish up and running... and I used fish 2.1 for about a month.

So... does shell history work in fish?

Yes, yes it does. fishd provided me the commands I typed in, HOWEVER:

  • it logged failed commands, I DO NOT WANT FAILED COMMANDS SAVED
  • failed commands could be a password. To remove them I had to 'fish_config' and go to history tab.
  • ctrl+r (bash's reverse search) doesn't work. Instead you need to toggle between ctrl+f (autocomplete) and ctrl+p (search)

Tbh I could live with this fishiness. Simply because I had a working shell history. Seriously.

Why I stopped using fish

Consider this code from http://git.suckless.org/dmenu/tree/dmenu_run

dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &

So I would choose a bash script like screenshot, to be run by dmenu, which is then piped to $SHELL. $SHELL being /usr/bin/fish when using fish. Screenshot's shebang #!/bin/bash does not apply.

IIUC variable expansion in fish is done different causing 99% of shell scripts to fail when run by fish. Nevermind the crazy stderr caret stuff. fish being a non-compatible shell is just a TOTAL FAIL.

Furthermore setting up PATH on Linux is just generally insane, probably because I've (wrongly) setup the PATH mainly in my ~/.bashrc, instead of ~/.profile or is it somewhere else? Anyway my PATH was consistency broken in fish too and I never figured 100% why. Perhaps because of its variable expansion anti-feature.

Back to GNU bash

Tbh, ctrl+r aka (reverse-i-search) is much better & intuitive than fish's ctrl+f & ctrl+p.

Now if only I could get my bash history working. I miss fishd I guess. Tbh I did like fish's fish_config and the way it attempted but kinda failed to integrate with the browser.

Macbook Air Early 2014 Archlinux

I upgraded my Mom's old 11 inch Macbook Air since she said the screen was too small. Enter a 13-inch, Early 2014 model with OS X 10.9.3 and enter an opportunity for me to test how well Archlinux works on this gorgeous Apple hardware in the month of June 2014. Yes, I am looking to upgrade from my Thinkpad X220 and Lenovo sadness.

Firstly I must say, Archlinux wiki's Macbook page is a bit of a mess. It over-complicates partitioning and boot loading. However I don't feel like wading in there to try fix it.

It's surprisingly simple to Archlinux going on the Macbook Air.

  1. Boot into OSX. Upgrade.
  2. Resize the disk using Disk Utility, amazingly you can resize a running MacOSX install
  3. Install rEFInd, with the all drivers switch, ./install.sh --alldrivers
  4. Boot the Archlinux ISO on a USB stick by holding down the Alt key
  5. Fdisk, create a new partition /dev/sda4, mkfs.ext4 format it, mount it and pacstrap the mount
  6. Oops, pacstrap doesn't work without Internet and 03:00.0 Network controller: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter (rev 03) is not supported by the 3.15 Linux kernel :( Had to purchase a USB 3.0 to 10/100/1000 Gigabit Ethernet LAN Network Adapter, Apple IIUC doesn't offer USB3 hardware!?
  7. Reboot and with some luck rEFInd, will pick it up! Hint: Installing refind-efi and refind-mkrlconf should give you more control, e.g. for adding "rw quiet" or hitting F2 (twice).

Wireless is since working well so far with the broadcom-wl package from AUR.



The Alt key is way too small and I am not sure what to make of the fn & cmd key.

Fixed with setxkbmap -option altwin:swap_alt_win.

Someone needs to tell me where the HELL is the Insert key on a Macbook Air.


I am familiar with the Thinkpad nipple. I'm struggling with the trackpad. I can't figure out how to paste!!!

Is it a "three finger click" to paste? Anyone know the keyboard shortcut?

Better with synclient PalmDetect=1.

BETTER with xf86-input-mtrack-git from AUR.


Suspending, shutdown etc. works out of the box with Archlinux. I think systemd should get the thanks. Really fast.

When I close the lid, the Macbook Air goes to sleep. But sometimes it's doing a long upload or download and I do not want it to sleep.

Sound / Audio output doesn't work

rain:/etc/modprobe.d$ lspci | grep Audio
00:03.0 Audio device: Intel Corporation Device 0a0c (rev 09)
00:1b.0 Audio device: Intel Corporation Lynx Point-LP HD Audio Controller (rev 04)

I'm not sure what I did, but it's working now with pavucontrol. Might be my general confusion with starting pulseaudio.

Brightness buttons don't work

Pommed dies with E: Unknown Apple machine: MacBookAir6,2. Filed a bug.

Is the Thunderbolt port usable? Yes!

User Experience notes

The Air doesn't have a fan, so when I come back to using the X220, I find the X220 noisy.

The Macbook Air so far seems to hover around 51C (~70C with Youtube playback) and its temperature /sys/class/thermal/thermal_zone0/temp doesn't fluctuate as crazily as the X220 does. Which is good!! Its actually cool enough to be on my lap without feeling like I am killing my sperm off.

The 1440x900 screen is nicer, but I expected it to a LOT better. I guess I was stupidly expecting Retina.

The battery seems to drain as fast as the old 9 cell in the Thinkpad worryingly. I have tuned it with PowerTOP and still I'm not very confident at all. I suspect the screen on full brightness doesn't help.


The distro that I maintain and earn a living from, Webconverger works with the Apple Macbook Air hardware too with the USB network device is attached.


Latest tips

Ensure www-data is always able to write

Ensure your fs is mounted with acl.

 mount | grep acl
/dev/root on / type ext3 (rw,noatime,errors=remount-ro,acl,barrier=0,data=writeback)

And to ensure www-data always has free reign:

setfacl -R -m default:group:www-data:rwx /srv/www
Xorgs version
12:04 <hendry> i'm using wheezy Xorg packages  1:7.7+3~deb7u1 and http://ix.io/d2p says X.Org X Server 1.12.4
12:04 <hendry> Release Date: 2012-08-27
12:04 <hendry> Is that right?
12:05 <jcristau> probably
12:11 <hendry> wondering why there is a mis-match with versions
12:11 <hendry> is there a newer Xorg available for wheezy? something to eek out performance with intel cards
12:12 <jcristau> there isn't a mismatch
12:12 <jcristau> and no
12:12 <hendry> 1:7.7+3~deb7u1 & 1.12.4 doesn't make sense to me ... :}
12:13 <jcristau> you can't understand that different things can have different versions?
12:20 <hendry> so what does 7.7+3~deb7u1 refer to ?
12:22 <pochu> 7.7 is the upstream version, +3 is the debian revision, and deb7u1 is the first update to Debian 7 (wheezy)
12:22 <psychon> http://www.x.org/wiki/Releases/7.7/
12:28 <jcristau> 7.7 is the base version of X.Org's X11 distribution
12:28 <jcristau> 1.12.4 is the version of the X server


Setting a read S3 policy from the command line

Easier than logging into https://console.aws.amazon.com/s3/ since I need to get out my MFA device out everytime.

x220:/tmp$ bash allow-read.sh b3-webc
s3://b3-webc/: Policy updated

allow-read.sh is just a script to help write the policy:

x220:/tmp$ cat allow-read.sh
test "$1" || exit
s3cmd ls > $tmp
if ! grep -q $s3_bucket $tmp
        echo Could not find bucket s3://${s3_bucket}
        cat $tmp
cat <<END > $tmp
      "Principal": {
            "AWS": "*"
s3cmd setpolicy $tmp s3://${s3_bucket}
Failed to start Verify integrity of password and group files.

Fix it by running pwck.

x220:~$ sudo pwck
user 'umurmur': directory '/home/umurmur' does not exist
pwck: no changes
x220:~$ pacman -Ss umurmur
community/umurmur 0.2.14-1
    Minimalistic Mumble server
x220:~$ sudo vim /etc/passwd
x220:~$ sudo pwck
no matching password file entry in /etc/passwd
delete line 'umurmur:!:16094::::::'? yes
pwck: the files have been updated
From Apache to Nginx rewrites


RewriteRule ^client/(.*)$ /client.php?id=$1               [L,QSA]


rewrite ^/client/(.*)$ /client.php?id=$1&$args last;
  • Notice uris in nginx must start with /
  • Notice &$args is needed to replicate Apache's QSA feature

Powered by Vanilla PHP feedback form