Hibernate issues on Thinkpad T450s

Read updates after the main body for context.

UPDATE (May 22 2017) When I forced the firmware to use ucode version
17 for the iwlwifi driver, my network has been a lot more stable even on
the enterprise networks like my university network and eduroam.
Hibernate is pretty stable except for the following problem:

Close the lid and systemd-logind triggers suspend. Using the suspend hook,
the delayed hibernate script triggers a wake after 2 minutes. Then the
computer hibernates. However, I cannot awaken the computer (using the power
switch until I plug it in again!) Once I do so, the power switch works
normally and the computer resumes from hibernate.

One option is to manually handle the powerswitch using xfce power
manager or something. Here are some ideas:

  1. Disable systemd-logind handling of the lidswitch and try xfce4 power
    manager, and see if the original issues it had are resolved.
  2. Disable logind and xfce power manager (that I use primarily for
    dimming and locking the screen). Then, switch to acpid for hitting
    systemctl to handle the lidswitch

UPDATE (May 13 2017) I couldn’t track down the patches on the 4.4
kernel to apply it properly. So I reverted the ucode version that the
iwlwifi driver was using on the 4.10 kernel to see if this solves my
wifi instability issues.

dmesg | grep iwl

The 4.10 kernel appears to use

loaded firmware version 22.391740.0 op_mode iwlmvm

and the 4.4 kernel uses

loaded firmware version 17.352738.0 op_mode iwlmvm

I deleted the


and now the 4.10 kernel seems to load an earlier firmware version.
Perhaps this fixes the instability on networks that use WPA2-Enterprise.

UPDATE (May 12 2017) I have wifi instability issues on the newer
kernels like 4.9 – 4.10 on the iwlwifi driver. I don’t know what
changed, but I frequently need to ifconfig down/up the interface or
rmmod/insmod the iwlwifi driver.

So I went back to the 4.4-lts kernel available on the AUR with the
4.4.64 patch set. Then I installed the following two patches:

  1. https://patchwork.kernel.org/patch/9208541/
  2. https://patchwork.kernel.org/patch/9202321/

One of the patches didn’t apply since they were meant for the 4.1.6
kernel, so I manually inserted some of the rejected patches. It appears
to work after a couple of tests. The patch appears to be merged with the
following commit number


It’s quite annoying that the iwlwifi driver is so unstable on the newer
kernels with my Intel 7265 card. I will update it if there is a problem.
Also, the unpatched 4.4.0 kernel also appears to work quite well, even
without the patches, but I haven’t tested it with more that 8GB memory
in used, which is what seems to create the problem.

UPDATE (May 09 2017) Intel rapid start (irst) craps out every once
in a while. After a few successful hibernates, it seems to go into a
boot loop of some sort, and then simply unsuccessfully reboots. So I’ve
disabled it, and moved to a newer kernel (4.9) that does not appear to
have hibernate issues. I’m using this delayed hibernate script on the

I’ve been having Hibernate issues on my thinkpad 450s. Apparently this
is quite common see this kernel bug
and has
existed in the newer kernels since version 3.x. So my solution was to
use the Intel Rapid Start technology. It was originally suggested on the
kernel bug report. It was quite easy to do.

  1. Make a partition that is greater than or equal to the amount of ram
    in your notebook.

    gdisk /dev/sda

    Then, set partition name, start sector and size by following the
    prompts. Select 8400 (Intel Rapid Start) when prompted for a
    Hex Code or GUID. Hit w to write the partition table and q to

  2. Go into the bios, and under power you’ll find the Intel Rapid Start
    technology. You can set deep sleep mode to set in after an hour of
    suspending – that’s what I’ve set mine too.

  3. Next time just suspend your thinkpad. Rapid Start works flawlessly.

The old hibernate issues have been resolved on newer kernels (4.7 and
above). But I always find hibernate a little buggy. For example, the
display frequently gets screwed up on my laptop and I have to restart X
or my display manager.


Exim with gmail as smarthost

I’ve been using exim with my google account to send email quite
successfully. I essentially followed the arch
It allows me to send mail from any of my machine on my local area
network through my server. This is quite convenient because a lot of
them run cron jobs, and it’s useful to a have an email relay server
running on the network. Comcast, my ISP, blocks smtp ports and so I
cannot run my own email server at home. So I setup an exim based relay
that accepts email from within my local area network and sends it using
my gmail address.

However, it stopped working without warning one day. My log
/var/log/exim/mainlog started being populated with messages like

    535-5.7.8 Username and Password not accepted. Learn more at
    535 5.7.8  https://support.google.com/mail/?p=BadCredentials v9sm11944329pfg.133 - gsmtp

This was apparently because I did not have two-factor authentication
enabled, and gmail had started flagging my application. So I enabled
two-factor authentication, and gave my it an app password. It started
working again.

Getting ibus to work for Tamil input

–\> I was trying to get tamil input to work on both my debian and arch
systems, since I wanted to use the tamil
to look up
words. There are two ways of doing this.

  1. Use xkb layouts. xkb supports tamil input natively, but they keymaps
    are a little weird. I spent some time trying to figure out the
    keymap it was using, but wasn’t very successful. I’m guessing it’s
    using the Tamil 99 layout, that can be found
  2. Input methods. This is the more powerful way of doing things,
    especially because there are multiple tamil layouts available and
    it’s easy to switch between them. If you use xkb, you’d typically
    have to restart X to install new layouts.

There are a bunch of input methods

  • scim
  • ibus
  • nimf (korean, chinese)
  • dasom (korean)
  • fcitx (popular in taiwan)
  • uim (japanese)

Of these, the scim and ibus are the most well known, and work well with
the m17n library. They’re largely the same, but ibus is the default in
many desktop environments. This
thinks that ibus’
interface is a little better. I think one can’t go wrong with either
one. I chose ibus.

Install the following packages

ibus-m17n, ibus-gtk, ibus-gtk3, ibus-qt4

There are ibus packages available for clutter too. For Arch Linux, I
followed their wiki.

You need to set a few environment variables:

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

On debian, it’s a bit easier since you first install the im-config
package and then run

im-config -n ibus

which will write an .xinputrc file. Debian has some dbus rules setup
that automatically set the GTK_IM_MODULE and other environment
variables. So it doesn’t appear to be necessary to insert the
environment variables into your .xinputrc. In any case, it doesn’t
seem to hurt whether you do it or not.

The Arch Wiki suggests inserting

ibus-daemon -drx

into my .xinputrc. This doesn’t work so well if you use a login or
display manager like lightdm. This is because the ibus daemon does not
like being started too early
. A symptom of this was that tamil input
worked inside my terminal emulator, but not inside firefox.

I use lightdm and i3, and what works for me is to insert
ibus-daemon -drx into my .i3/config file as

exec --no-startup-id ibus-daemon -drx

For other desktop environments like xfce or cinnamon, use the system
that allows you to specify ibus-daemon as a startup program.

I use phonetic tamil input and it’s absolutely amazing.

Remember to install tamil fonts! See this

Mathjax font errors in firefox

I started getting errors in firefox recently complaining about Math Processing Errors and problems loading imagefonts. It was sort of like this bug where a file called imagedata.js was not getting loaded.

Mathjax shouldn’t have to use imagefonts in any modern browser; mathjax was working perfectly in chrome for example. So what had happened was I’d unchecked the

Allow pages to choose their own fonts, instead of my selections above

under Preferences > Content > Advanced.

My firefox version is

Mozilla Firefox 45.0.1

It’s also interesting to note that the usual packages in ArchLinux and Ubuntu don’t package MathJax image fonts by default. These are however available in their github repository.

CUPS unable to automatically locate printer

After an update sometime ago, cups started to fail when trying to print to printers that were automatically detected. The printers address would show up as


When trying to print to such a printer, cups would give the following error:

Unable to locate printer 'BRWXXXXXX.local'

If you have avahi running, then you can run

lpinfo -v

to list all the network printers. This would show, for example

network ipp
network ipps
network socket
file cups-pdf:/
direct hp
network lpd
network http
network https
network smb
direct hpfax
network dnssd://Brother%20DCP-L2540DW%20series._ipp._tcp.local/?uuid=e3248000-80ce-11db-xxxx-xxxxxxxxx
network lpd://BRW1008B19C71E2/BINARY_P1

The problem is that the correct libraries were not installed; see this askubuntu page. It tells you that you need to install the nss-mnds library. This is some sort of dns service that is necessary for cups to function. Once you install it using

pacman -S nss-mdns

Edit the file


so that the hosts line contains.

   hosts: files mdns_minimal dns mdns

LM sensors on a Gigabyte H97-D3H motherboard

I was having trouble with lm-sensors, since it was only detecting cpu core temperatures. This meant that it wasn’t detecting my hardware monitoring chip, as evidenced by

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): 
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      Yes
Found unknown chip with ID 0x8620
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      No

The Super I/O chips usually provide advanced monitoring tools. A little searching found that the latest it87 driver supports the ITE chip with ID 0x8620. So I ran

git clone https://github.com/groeck/it87
cd it87
sudo make install

If this gives an error, make sure you have the kernel headers installed

sudo apt-get install linux-headers-$(uname -r)

Then I inserted the new kernel module with

sudo modprobe it87



now shows

        Adapter: Virtual device
        temp1:        +27.8°C  (crit = +105.0°C)
        temp2:        +29.8°C  (crit = +105.0°C)

        Adapter: ISA adapter
        Physical id 0:  +32.0°C  (high = +80.0°C, crit = +100.0°C)
        Core 0:         +31.0°C  (high = +80.0°C, crit = +100.0°C)
        Core 1:         +32.0°C  (high = +80.0°C, crit = +100.0°C)

        Adapter: PCI adapter
        temp1:        +43.0°C  

        Adapter: ISA adapter
        in0:          +0.06 V  (min =  +0.00 V, max =  +3.06 V)
        in1:          +2.05 V  (min =  +0.00 V, max =  +3.06 V)
        in2:          +1.97 V  (min =  +0.00 V, max =  +3.06 V)
        in3:          +1.99 V  (min =  +0.00 V, max =  +3.06 V)
        in4:          +0.01 V  (min =  +0.00 V, max =  +3.06 V)
        in5:          +1.75 V  (min =  +0.00 V, max =  +3.06 V)
        in6:          +1.55 V  (min =  +0.00 V, max =  +3.06 V)
        3VSB:         +3.38 V  (min =  +0.00 V, max =  +6.12 V)
        Vbat:         +3.00 V  
        +3.3V:        +3.48 V  
        fan1:        1205 RPM  (min =    0 RPM)
        fan2:           0 RPM  (min =    0 RPM)
        fan3:         860 RPM  (min =    0 RPM)
        fan4:         819 RPM  (min =    0 RPM)
        fan5:           0 RPM  (min =    0 RPM)
        temp1:        +33.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
        temp2:       -128.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = disabled
        temp3:        +24.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = Intel PECI
        temp4:        +33.0°C  
        temp5:        +37.0°C  
        temp6:        +45.0°C  
        intrusion0:  ALARM

The game of the century and proof by contradiction

The Game of the Century is a chess game between 13 year old Bobby Fischer and Donald Byrne, played in 1956. Byrne was an established player, and had won the US Open championship in 1953. Although Fischer’s star was rising, Byrne was considered the favorite. Byrne, immaculately dressed, in a suit and tie, sits with a cigarette between his fingertips.

The opening moves in chess, pretty much fall into set patterns until about move 10 or 11. Then in a few more moves, something called “novelty” happens. This is when the chess game evolves into a unique position; one that has never ever before been played in this history of humanity. This is a combinatorial fact. This is where the game of chess leaves “the book”, and the players must innovate.

Byrne opens the game with Nf3; a pretty nondescript opening that evolves quickly into something called the Gruenfeld Defence. This is a fairly well known chess opening. Fischer defends based on “hypermodern principles”, inviting Byrne to establish a pawn stronghold in the center that he will attack in the mid-game.

10 moves pass, and they’re pretty evenly matched. On move 11, Fischer offers a knight sacrifice. There is usually a person recording chess games in chess notation. Fischer’s knight sacrifice is usually written as

    11 ... Na4!! 

“On the 11th move, black moves knight to position a4 on the chessboard”. The two exclamation marks at the end indicate that it’s a very interesting, delightful move that has strong consequences in favor of the mover. Byrne, the consummate chess master, wisely says “No thanks!” to Fischers clever ploy.

On moves 16 and 17 Byrne threatens Fischers queen. Fischer is in trouble now. He has problems with his queen, and stands to lose a knight if he protects his queen. Instead, Fischer moves Bishop to e6. Fischer does not protect his queen; instead, he moves his bishop and offers his queen up as sacrifice. This is considered the greatest move in all of chess history.

One can imagine Byrne dragging hard on his cigarette, inhaling deeply. “What’s this kid doing?” After some thought, Byrne takes the queen. After that Fischer begins a windmill – a series of discovered checks – that wins him a a rook, two bishops and a pawn for his lost queen. Experts say that after this move, there is nothing that white could have done to recover.

Proof by contradiction, in GH Hardy’s words (see A mathematicians apology (1941)), is much like a chess gambit. He says,

    Reductio ad absurdum, which Euclid loved so much, is one of a mathematician's finest weapons. It is a far finer gambit than any chess play: a chess player may offer the sacrifice of a pawn or even a piece, but a mathematician offers the game. 

I find this a very appealing metaphor. I was listening to radiolab’s podcast (Games) which talks about The Game of the Century and was reminded about Hardy’s quote about chess and proof writing. Of course, the process of doing mathematics has nothing to with playing chess.