Asterisk, and other worldly endeavours.

A blog by Leif Madsen

Archive for the ‘Technology’ Category

Brother printer doesn’t print in Fedora 17

Tip: If your Brother printer won’t print after installing the drivers, install glibc.i686

Today ran into an issue with my new Brother MFC-7460DN (which is a really nice laser printer with auto-feed scanner, Scan-to-FTP which creates a PDF file, and other things). I had just recently done a clean install of Fedora 17, and I could install the RPMs (which are i386 files on my x86_64 based system), add the printer to CUPS and all sorts of things that looked fine.

However when I went to print, it wouldn’t error out, but the printer wouldn’t actually print. I tried changing a file per but it didn’t help.

Then I found this post which reminded me to install glibc.i686. Wish the Brother drives would just make that a dependency in the RPM.

Written by Leif Madsen

2012/11/24 at 5:06 pm

Posted in Technology

Tagged with , , , ,

CentOS 5.8 On AWS EC2 With Xen Kernel (PVGRUB)

At CoreDial we’ve been using a lot of AWS EC2 lately for building sandbox infrastructure for testing. Part of the infrastructure is a voice platform utilizing Asterisk 1.4 and 1.8, and those voice platforms are using Zaptel and DAHDI respectively for use with MeetMe(). This hasn’t been an issue previously as our testing has either been on bare metal, or in other virtual machine systems where installation of a base image and standard kernel are not an issue.

However, with the introduction of a lot of EC2 instances in our testing process, we ran into issues with building our own DAHDI RPMs since there aren’t any EC2 kernel development packages outside of OpenSuSE (which we don’t use). After spending a day of trying to hack around it, Kevin found a PDF from Amazon that states AWS now supports the ability to load your own kernels via PVGRUB. Great! If I can do that, then I can just continue using the same RPMs I’d be building anyways (albeit the xen based kernel, but that’s easy to do in the spec file).

Unfortunately this was not nearly as trivial and simple as it appeared at first. The first problem was that I had to figure out the correct magic kernel AKI that needed to be loaded, and the PDF wasn’t incredibly clear about which one to use. (There is two different styles of the AKI, one called “hd0” and another called “hd00” which I’ll get into shortly.) After searching Google and looking through several forum posts and other blogs (linked at the end), I finally found a combination that seems to work for our imported CentOS 5.8 base image. Below is a list of the steps I executed after loading up an image from our base AMI:

  • yum install grub kernel-xen kernel-xen-devel
  • grub-install /dev/sda
  • cd /boot/
  • mkinitrd -f -v –allow-missing –builtin uhci-hcd –builtin ohci-hcd –builtin ehci-hcd –preload xennet –preload xenblk –preload dm-mod –preload linear –force-lvm-probe /boot/initrd-2.6.18-308.13.1.el5xen.img 2.6.18-308.13.1.el5xen
  • touch /boot/grub/menu.lst
  • cat /boot/grub/menu.lst
default 0
timeout 1

title EC2
     root (hd0)
     kernel /boot/vmlinuz-2.6.18-308.11.1.el5xen root=/dev/sda1
     initrd /boot/initrd-2.6.18-308.11.1.el5xen.img

Once the changes were made to the image, I took a snapshot of the running instances volume. I then created an image from the snapshot. When creating the image, I selected a new kernel ID. The kernel ID’s for the various zones and architectures are listed in the PDF. As our base image was CentOS 5.8 i386 in the us-east-1 zone, I had to select between either aki‐4c7d9525 or aki‐407d9529. The paragraph above seems to indicate there is a difference based on what type of machine you’re using, and references S3 or EBS based images. We are using EBS based images, so I tried the first one, which in the end failed miserably. After reading through the IonCannon blog post it became clear that the hd0 and hd00 AKIs are really differences in whether you have a single partition, or multiple partitions with a separate /boot/ partition.

With that bit of knowledge, and knowing that we only had a single partition that contained our /boot/ directory, I knew to use aki-407d9529 (hd0). Another forum post also pointed out that I needed to enable some modules for the xen kernel or the system wouldn’t boot (and I verified that by stepping through each of the steps listed above to make sure it was required). With those two major items checked off, I am now able to build an AMI that will load with a stock CentOS Xen kernel image, making it trivial to build RPMs against now.

Note: If you do happen to use separate partitions, make sure you use the hd00 AKI. In the menu.lst you need to make sure to use root (hd0,0) instead of just (hd0). Additionally, your menu.lst file needs to live at /boot/boot/grub/menu.lst since AWS is going to look in the /boot/grub/menu.lst location on the /boot/ partition. On a single partition the file can just live at /boot/grub/menu.lst.


Written by Leif Madsen

2012/08/22 at 9:10 am

.bashrc trick for git repo and branch information

The other day I was talking to my friend Russell Bryant who pointed me to some .bashrc magic that would show me which branch I was currently working with inside a git repo on my system. I found it incredibly handy and have modified the ANSI colour coding slightly.

export PS1='[\u@\h \[33[0;36m\]\W$(__git_ps1 "\[33[0m\]\[33[0;33m\](%s)")\[33[0m\]]\$ '

On Fedora Russell mentioned that you need the bash-completion installed. We’re unsure if you need anything on other distributions.

Edit: January 6, 2012
As I’m using my laptop today, I modified the .bashrc file on Ubuntu 10.04, and here is the PS1 code I came up with. It’s nearly the same, but I’m using bold today instead of the unbolded colours of lore.

PS1='${debian_chroot:+($debian_chroot)}\[\033[28;01m\]\u@\h\[\033[00m\]:\[\033[1;36m\]\W$(__git_ps1 "\[\033[00m\]\[\033[1;33m\](%s)")\[\033[00m\]\$ '

Written by Leif Madsen

2011/12/22 at 9:39 am

Posted in Technology, Useful Tools

Tagged with , , , , , ,

Relaying SMTP via Gmail (or Google Apps) Using Postfix

Today I had the need to start relaying mail through my Google Apps account since Super-Evil-Bastard-ITSPRogers blocks sending email (it’s probably a good thing, however it’s quite annoying when running some services from home).

Found this article while Googling, and it worked great first try. I like when things are this easy.

Written by Leif Madsen

2011/11/22 at 5:17 pm

Initial impressions of qemu-kvm (virtualization server)

The qemu-kvm ( package on Ubuntu 10.10 allows you to create virtual machines much like VMware, Xen, etc.

My initial impressions are generally pretty positive. I like that it lets you install multiple operating systems (including MS Windows, which I haven’t tried yet), and doesn’t use a web interface like VMware Server 2 (which I’ve found to be terribly crash prone, requiring a restart of the web interface at the least, and sometime the entire server needs to be restarted, often abruptly with the kill application). My favourite part is the libvirt-manager that lets you manage the system and install virtual machines remotely over SSH using VNC (or at least something similar to it).

The one problem I had initially was installing CentOS 5.5. It was terribly slow, and when I started the virtual machine, I coudn’t get it past GRUB. I thought perhaps it was just a problem with running CentOS VMs on an Ubuntu host machine, but then I had the same problem with an Ubuntu installation (which took at least 3-4 times as long to install as CentOS for some reason).

I got looking around and found people with similar issues as me, but they all basically just outlined reinstalling GRUB via a rescue disk. I tried this which got me just a little bit further, but still no GRUB menu, or system booting.

Then I found a post indicating that restarting the KVM service caused things to work, which I tried doing, but nothing changed. So as a last ditch effort I tried rebooting the service, which I didn’t expect to actually fix anything, but oddly enough worked. The existing VMs I installed started up fine, and the new installation I tried went significantly faster.

I haven’t had much of a chance to try more than what I’ve described, but thus far I like KVM a lot more than VMware. Hopefully I keep enjoying it as I go forward now that I’ve gotten VMs to boot 🙂

Written by Leif Madsen

2011/02/08 at 8:18 pm

Asterisk Cookbook Is On! (We Think :))

After finishing the first draft of Asterisk: The Definitive Guide (3rd Edition), I’ve been a bit antsy with wanting to do some more writing. After about a week of a break (i.e. sleeping in past 7am for the first time in nearly a year), Russell Bryant and I have decided to team up on delivering the long awaited Asterisk Cookbook.

To start off with, we’ll be writing a short, 80-100 page eBook that will be distributed by O’Reilly in all the formats they support ( The book is scheduled to have about 25 recipes, and should be written in the next 30-40 days, which would mean it should be available shortly after Asterisk: The Definitive Guide is released (which means you can bundle them together! :)).

We just finished the outline this morning and sent it off to our editor Mike Loukides. Unless O’Reilly is already booked up (pun intended?) for the next few months with production and other books, we should be starting work on this as early as next week. If all goes well after we’re done the eBook, we’ll continue expanding it with the goal of eventually releasing it as a print edition.

As a side note, we’re still accepting reviews from people for Asterisk: The Definitive Guide. We have to return all edits and changes to O’Reilly no later than February 14th, so that means you still have a couple of weeks to get some reviews and testing done! If you could make sure you have your reviews done before February 11, 2011 that would help us out tremendously as we’ll be working on getting all the edits we need done in an email to O’Reilly by Monday, February 14th. You can help out at

Thanks to everyone who has contributed thus far!

Written by Leif Madsen

2011/01/27 at 9:33 am

New headset thanks to!

Just got my new Plantronics headset from (or rather, the hardware store at and am extremely satisfied with the service. We had an issue with Purolator not wanting to deliver to the building and then not bothering to call me to let me know the address was incorrect. By the time I noticed and got the address corrected, they just decided to send back the package.

So after letting the guys at e4VoIP know what happened, they just drop shipped a headset via FedEx overnight and I had it by lunch the next day! Amazing service and great prices. I’m in Canada, so I know how much of a pain in the ass shipping across the border is, and usually there is a bunch of duty fees across the border, but this time around the headset didn’t cost me a thing.

I plan on getting a G.722 capable phone next because now that I have this headset attached to my Polycom, I’m kind of looking forward to high quality calls during the weekly VoIP Users Conference call! (

Written by Leif Madsen

2010/02/22 at 2:04 pm

Posted in Asterisk, Technology

Tagged with , , , , ,