Google Analytics

Tuesday, November 23, 2010

Upgrading the root file system on a Linode to ext4

The ext4 file system has been around for a while now, so I figured I'd migrate my Linode's ext3 partition to it for some of the reasons listed here.

The major downsides would be that I wouldn't be able to use some nice tools that Linode provide, such as their automatic partition resizing and automatic backup solution, and their rescue distribution, Finnix, doesn't support it. (Edit: Their rescue distribution does now support ext4.)

Obviously you'd want to make sure you have a full backup before proceeding with this. I didn't, but I'm an idiot.

First you need to make sure you're using a recent kernel — probably 2.6.30 or higher. This is because some applications had made bad assumptions. I'm using the latest 2.6 Paravirt that Linode provides, which is My system is Ubuntu 10.10 64-bit.
  1. From the Linode Platform Manager, restart in rescue mode.
  2. Run the following commands to update Finnix with a recent e2fsprogs that supports ext4:
    1. apt-get update
    2. apt-get install debian-archive-keyring e2fsprogs
  3. Perform the actual ext4 conversion:
    1. tune2fs -O extents,uninit_bg,dir_index /dev/xvda (It will no longer be ext3 compatible after running this.)
    2. e2fsck -fDC0 /dev/xvda
  4. Shutdown and boot up through the Linode Platform Manager
  5. The system should automatically mount the partition as ext4.
Even though the system mounted the partition successfully I figured I'd change the /etc/fstab to reflect the new file system.


Wednesday, November 18, 2009

Whitelist Twitter emails on Postfix

Unfortunately it seems that Twitter's email servers often end up listed on RBLs like SpamCop, which I use for spam filtering. This means my email account holders don't get emails about direct messages, new followers and other ego-building things like that.

Here's a simple way to white-list these emails for Postfix:
  1. Create a new file /etc/postfix/ip_whitelist with the following contents: OK OK OK OK OK OK OK OK

    These map from to, which seem to be all they have for now.

  2. Run: postmap /etc/postfix/ip_whitelist

  3. Edit your /etc/postfix/ file to include the IP whitelist. Find the line where you have your RBL checks, e.g.:
    and add the following line above them:
    check_client_access hash:/etc/postfix/ip_whitelist

  4. Restart Postfix.

These vital emails should now get through to your psychologically fragile account holders.

Monday, August 03, 2009

Apache segfaults after enabling the Zend Framework on Ubuntu Jaunty

After installing the Zend framework on an Ubuntu Jaunty server (PHP 5.2.6-3ubuntu4.1 Suhosin-Patch

# aptitude install zend-framework

I uncommented the line with the include path to make it usable:

# vim /etc/php5/apache2/conf.d/zend-framework.ini

include_path=${include_path} ":/usr/share/php/libzend-framework-php"

Then restarted Apache. Unfortunately it crashed straight away:

Aug 3 11:42:44 the-lake kernel: apache2[17487]: segfault at 0000000000000008 rip 00002b3c755d5070 rsp 00007fff3d94c1c8 error 4

Some searching revealed it was this bug.

Setting an initial include_path in /etc/php5/apache2/php.ini worked around the problem.

Wednesday, June 03, 2009

A fix for Windows Vista not connecting to a wireless network

Today my girlfriend's laptop (running Windows Vista) would not connect to my wireless network. It connected to her uni wireless network fine and was connecting to mine fine up until now. It had recently been upgraded to Service Pack 2, so this may have triggered the problem.

I unsuccessfully tried
  • rebooting,
  • removing the access point from its list of 'remembered' points, and
  • reinstalling the wireless card driver.
After some Googling the solution that worked for me was to create a new 32-bit DWORD value called ArpRetryCount in:
and leaving its value at 0. After rebooting it connected as normal.

Here is a .reg file to automatically apply the fix.

Monday, June 01, 2009

Installing the Passenger gem on Ubuntu

I just tried to install Passenger on my Ubuntu-based Linode. I like to use the gem (as opposed to distro packages) to make sure I keep up with new version releases. Unfortunately when I tried I got this error:

# gem install passenger
Building native extensions.  This could take a while...
ERROR:  Error installing passenger:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install passenger
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
        from extconf.rb:8

Since the machine is a VPS I like to try and keep the number of unnecessary packages down to a minimum. It turns out the only extra package I needed to install was ruby1.8-dev.

After Passenger built successfully, I had to add /var/lib/gems/1.8/bin into my $PATH and run passenger-install-apache2-module (which contained cushy step-by-step instructions from that point on).

Friday, May 15, 2009

Fixing the infamous Amavis + SpamAssassin cron messages

I'm using Amavis and SpamAssassin together on an Ubuntu server. For some reason, a cron email was being generated every 3 hours that looked like this:

bayes: synced databases from journal in 0 seconds: 811 unique entries (1420 total entries)

There is a bug report filed about it here but the solution didn't help me.

The file responsible for generating this message is /usr/sbin/amavisd-new-cronjob. I was able to stop the annoying messages by changing line 26 from:
exec ${CMD}
exec ${CMD} >/dev/null 2>&1
While this may clobber useful error messages as well, my care factor is low after being spammed so much.

Tuesday, May 12, 2009

Hiding windows with Ruby and appscript on OS X

At the moment I'm writing a Ruby script that interacts with iTunes on OS X. Fortunately this is fairly easy to do using the AppleScript bridge rb-appscript.

My problem was that I needed to hide the iTunes window (the same as using the ⌘H shortcut) so that the Ruby application didn't lose focus. Unfortunately it took me a long time to find out how to do it.

I didn't need to deal with OSAX. Here's a snippet of code that demonstrates the necessary incantation:
require 'rubygems'
require 'appscript'

itunes ='iTunes')
# Hide the iTunes window'System Events').processes['iTunes'].visible.set(false)
Here is what the actual AppleScript (which I was able to find easily) looks like:
tell application "System Events"
    set visible of process "iTunes" to false
end tell
You can see how the 'Rubyised' version maps to it, although it took a lot of Googling to translate!