Telling HAL about TUN/TAP interfaces

Today, I started using Virtual Machine Manager (VMM) to help me with my development. Previously, I had been using VirtualBox. Both are GPLed, but VirtualBox is Dual Licensed with a more “feature-full” version that isn’t GPL’d. The GPL’d version of VirtualBox doesn’t seem like it is really intended for hard-core use. So far I’ve really been liking VMM. It can bring up my instances at boot time and can run them headless. Nice. This will really help with the packaging work I’m doing right now for IntraHealth’s iHRIS Suite. Still, networking is a bear in both VirtualBox and VMM. I was able to use my TUN/TAP bridged network in VMM that I had set up before in VirtualBox. But only after I told HAL about the TAP interface. Here’s the deal: VMM uses HAL to discover the network interface. It then lets you use any of those interfaces that are bridged for your virtual machines. Alternatively, you can just use user-mode NAT, but that is less than ideal since ping doesn’t work and it is harder to test network apps or ssh into your virtual box. The problem: HAL only knows about physical network devices, not any TUN/TAP interfaces you have set up. Since my bridge was on a TUN/TAP interface, HAL didn’t know about it and VMM couldn’t use it. After a little poking around, I found the command line utility hal-device that would let me add the interface dynamically. Now, when VMM queries HAL, the interface shows up. (By the way, since HAL communicates over D-Bus, I was able to use Emacs’ D-Bus integration for debugging.) Here’s the script I wrote to add the TUN/TAP interface:

#!/bin/sh    hal-device --add '/org/freedesktop/Hal/devices/net_tap0' <<EOF  info.capabilities = {'net'} (string list)  info.category = 'net'  (string)  info.product = 'Networking Interface'  (string)  info.subsystem = 'net'  (string)  info.udi = '/org/freedesktop/Hal/devices/net_tap0'  (string)  net.address = 'ea:08:21:d4:c8:90' (string)  net.interface = 'tap0' (string)  linux.subsystem = 'net'  (string)  linux.sysfs_path = '/sys/devices/virtual/net/tap0'  (string)  net.interface = 'tap0'  (string)  EOF  

I hope to have something more generic that will work with HAL and Ubuntu’s networking soon so that any TUN/TAP interface is automatically recognised by HAL.

Switching away from Google Reader

I have this “thing” about owning my own data. I probably won’t be a real user of Tim O’Reilly’s Internet OS. I like running my own mail server — not relying on Google for Domains, not giving Google more and more data to feed into their advertising. But I’ve been using Google Reader. I’m not sure what Google is doing with that information, but, well, I can run my own feed reader on the desktop. So I switched to Liferea. Besides nice things like task-bar notifications, integration with — or, with a SMOP, my own GotNoBlog — it allows me to pull RSS feeds that require authentication so that I can read LiveJournal friends-only feeds now. I’ve managed to reclaim a little bit of my data. Hurrah!

Hurry up and wait + Drugs

Today, I spent most of my time waiting on a server. I couldn’t get Ubuntu to install on a Dell Poweredge server. Suse worked fine, though.  (It looks like I might have avoided some of the problem by changing a bios setting from “I2O” to “Mass Storage” but there doesn’t seem to be a good reason that Ubuntu wouldn’t work where Suse could.) This meant even more waiting for downloads over a very slow, African satellite connection.  The installation CDs I had for Suse didn’t have Java 1.5 and, joy of joys, I couldn’t find Java RPMs Suse 10.  So I’m downloading an installer from Sun.  17MB. Oh, and did I mention that KnowledgeTree needs OpenOffice running in the background?  Another 170Mb download.  (And why is the OpenOffice download finishing before the Java one?) While I waited, I sympathized with a fellow American suffering from a recurrence of Strep.  She had used up her pennicilin just before we left on the trip.  She was fine when we got here, but then seemed to have a flare-up. Of course, being used to the American medical system, we didn’t realize that you can purchase pennicillin (and most other drugs) over the counter here after talking to the pharmacist/chemist.  Even though my brother and brother-in-law are both pharmicists, I’ve often wondered what exactly they were supposed to be doing besides complaining about drug-ignorant doctors.  Seems like the Ugandans (and many other countries, for that matter) have the right idea. Instead of treating doctors like health-gods who are supposed to know everything (when the evidence clearly shows how ignorant many of them are about drugs), it would seem like they could work more closely with the dispensers of the drugs to make sure they get the right drug and dosage to a patient. In a related note, I had to get an anti-malaria drug, Malarone, for my trip to Uganda.  I knew I was up-to-date on all my other meds since I traveled just south of here a few months ago.  So, instead of going to the Travel Nurse again, I went to my family doctor.  (He had been bugging me to come in anyway when I saw him at church.)  He gave me a perscription for Malarone that the pharmacist was willing to fill, but forgot to put down a dosage. That’s the perfect situation for getting the drugs directly from the pharmacist without requiring the bother of a scrip-writer as the middleman. Still, it was gratifying to see my doctor.  I hadn’t been in for 3 and a half years and, in the meantime, had dropped 30 lbs.

Women and Computing

One of the never-ending subjects of Free Software is “Where are the Women?” While I see it as mostly a non-problem — that is, there are some obvious problems that need to be fixed with time, but no one is going to rectify them right now — I’m doing what I can to encourage my daughters and son in the field. In the meantime, The Decline of Women in Computer Science from 1940-1982 has some fascinating anecdotes:

Computing was unique, however, in the sense that the fledgling profession was still in its infancy and had no strong pre-war gender socialization.  This fact must have helped the women in that the returning men lacked programming expertise, and clearly had no expectation of “returning” to a programming job.  The lack of structure in the industry was also a boon to women programmers who wanted to continue working even after they became pregnant and had children.  Most notably, “Computations, Inc., of Harvard, Massachusetts (outside Route 128), formed in 1958 by Elsie Shutt and several other programmer-mothers who worked part-time and largely at home on problems contracted out to them by their former employers, such as Minneapolis-Honeywell and Raytheon”.  These women, widely known as the “Pregnant Programmers” were mentioned by speaker Richard H. Bolt at the M.I.T Symposium on American Women in Science and Engineering in 1964.  Bolt, who was a lecturer in Political Science at M.I.T and also a former Associate Director of the National Science Foundation (NSF) from 1960-1963, also mentioned the following:

“I asked one of the unmarried women, a computer programmer in industry, if she thought a woman’s activities as a mother and homemaker would interfere with her opportunities in a career.  ‘One good thing about programming,’ she said, ‘is that you can work part time.’”

GTD Goodness: Get the computer to tell you the time

Rich Mintz ( seems empty) gave me a great tip for keeping focused. He’s a Mac user and OS X makes it easy to get the computer to say the time every 15 minutes. It isn’t so easy on Ubuntu, but it is doable. Since I put this in place, I’ve found that it does help me focus more. It can also help keep me from working too late (not that it has yet). Anyway, here is the bit of magic that you need:

(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|espeak --stdout|sox -q -V0 -t wav - -t alsa pulse")|crontab -


(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|padsp espeak")|crontab -

will also work, but you may get emails filled with error messages from cron. Breaking it down

  1. (crontab -l; ...) | crontab -
    This part dumps the current crontab out, appends the new line (elided here, see the next step) and then, with the “crontab -” after the pipe, creates an entirely new crontab with the results. This way, we just add a new cronjob to the list of ones you may already have.
  2. echo "0,15,30,45 * * * * ..."
    The first part of any crontab file gives a schedule for execution. Since I just want this to run every 15 minutes, I haven’t set up anything besides that, but you could tell it “only during business hours during the work week” which might look something like “0,15,30,45 9-17 * * 1-5“. I recommend you RTFM for help on that, though.
  3. (echo it is now;date \+\%I:\%M\%p )
    Print out two lines that are what you’ll hear. If you don’t want to hear “It is now”, then you can leave out that echo statement and the parenthesis. The date command just formats the current time in HH:MM AM/PM time format. One problem is that at the top of the hour you have “00” which the synthesizer reads as “zero zero”. Oh well, all is not perfect.
  4. | espeak --stdout
    Every 15 minutes when the cron job is run, espeak reads the bit from date and produces a wav file with the sounds that your computer should play. Normally, espeak would just play this out on your speakers, but you might be listening to music. If the speakers were otherwise engaged (by, say, Rhythmbox), then you won’t hear the sound and cron will send you an email full of strange error messages.
  5. | sox -q -V0 -t wav - -t alsa pulse
    To get the sound to mix properly with other sound apps, it has to play out through pulseaudio (the new, default sound server in Hardy). Strangely enough, even though pulseaudio was supposed to Fix the Linux audio mess once and for all, we still have to jump through hoops.

There is a chance that saytime will just work for you. But, because of that “audio mess” that still exists in Ubuntu, it didn’t work for me.

Rwanda, Day 3

I was thoroughly exhausted this morning and slept 2 hours past the time I was supposed to meet the others for breakfast.  Ouch! I finished setting up the developer laptop and used bzr to download the source code for iHRIS Manage to the laptop.  I’ll customize the software for the Ministry of Health using the laptop and then, if we’re able to hire a Rwandan to do in-country development, they’ll have everything ready to go with php-mode set up in emacs and (of course) a link to my PPA so they can get updates easily.  Up till now, I’ve been pretty scared of the customizations they needed since I have to finish them up in the next few days. Once Vanessa started sending them to me, I was really relieved.  Most of it does look pretty simple.  “Add a field here, change a label there.” Speaking of in-country developers, I was pleasantly surprised to find out that dcm and Vanessa were able to find someone with LAMP experience.  One can always hope. In the afternoon I met with the head of IT at the Ministry of Health and installed Ubuntu on the server for them.  He doesn’t know much about Linux but seemed willing to learn.  I’d like to have someone here that I can talk to if we have problems, so I’ve been trying to at least get him or one of his underlings comfortable with Linux. We walked back up the hill to the hotel and dcm soon crashed.  I guess it was his turn to be worn out Overall, I’m really pleased with the way things are turning out.  I came into this really scared, but I’m getting more confidence by the day. One thing I would like to see is more support for Rwanda in Linux and especially Ubuntu.  When I’m setting up Ubuntu, “Rwanda” is not a choice for either the French or English language.  And, despite lots of work being done on Linux translations to Kinyarwanda, where “Ubuntu” is actually a word native to the Language, I can’t choose that language as the default in the installer.  This affects other areas of the installer, too.  When it comes time to pick a timezone, I can’t.  I have to tell the installer I’m in South Africa, which means that is picked for the Ubuntu mirror — a far better choice for the network connections I’ve used is still one of the U.S.-based mirrors.  (I’m not the only one to think Linux distributions should be more aware of Rwanda, either.) Finally, it would be great if RwandaTel or some other organization took an interest in promoting Linux in Rwanda.  They could set up a mirror so that I could get my Linux fix faster!

Rwanda Day 2 continued

I stayed at the Capacity offices as long as I could.  I could feel the fatigue hitting me pretty hard, but after lunch (including some kind of purplish yam and a good dose of caffeine) I managed to get the System 76 Laptop in some kind of working order. I should give props here to dcm who suggested that I “download the internet” and take it with me to Rwanda.  I managed to get around 175GB of the Ubuntu repository mirrored onto a disk.  This proved invaluable when I was installing the system and applying updates.  For a little while I switched to the usual web-based mirror and was told it would take a couple of hours to download everything I needed (for perspective, at home, the download times take no more than five or ten minutes).  Having the disk handy meant I could install packages directly.  The mirror isn’t complete, so some things did have to be downloaded, but the majority of stuff was right there. One bug I ran into showed up after I did an “aptitude dist-upgrade” after doing a clean install.  All of the sudden I couldn’t log in via GDM.  (The last time I had problems with a gutsy upgrade, it was using XFS so probably not something that was a core concern.) Weary from lack of sleep and not really in the mood for too much trouble-shooting, I ended up purging “ubuntu-desktop” (and its dependent packages) and then reinstalling it.  Strangely enough, that did the trick (for the most part). After that, I told Vanessa I was ready to give in to sleep.  We walked back to the hotel with me snapping pictures like a madman on the way back.  I saw some armed police standing outside and asked if I could photograph them.  “It is not allowed.”  Fine, no close ups for you! Once back I crashed in the hotel.  The turndown service woke me up twice.  First when they came in un-announced — or maybe I didn’t hear them knock and only woke up when they opened the door — and the second time when they called me (two times in a row).  I was so confused I thought they were asking for someone named “Tom”.  I was pretty annoyed, but it didn’t keep me from falling back to sleep quickly. Finally dcm woke me up so we could go have dinner at the Mille Colline.  Curried Veg, yum!

Day Two

(You may want to see my first post on my visit to Rwanda if you missed it.) Right now, I’m sitting in the Sentenary House, the home of the Capacity Project in Rwanda, upgrading a System 76 laptop with Ubuntu Gutsy.  I hope to prepare this laptop for a Rwandan developer for the iHRIS project I’ve been working on.  Of course, that’ll mean Emacs.  I hope to spread the Church of Emacs to Rwanda. In my last post I kind of left you hanging on the Mille Colline.  Yes, I had a coke there but I should tell you how disappointed I was that the movie showed a completely different building then the actual Hotel.  I’m sure they had their reasons (they always do) but I really do expect movies to give me an accurate portrayal of places I’m extremely unlikely to visit.  Just in case, you know, I visit. Also, we had a brush with fame.  The hotel I’m staying in (the Kigali Serena) is where Tony Blair was staying.  For a brief moment, we saw President Kagame rush in and then quickly back out.  I had no time to request an autograph.  Mostly because I didn’t recognize him. Dramatic difference between Kigali and the US: the number of gates and guards.  It seems that every major intersection has one or two men in uniform carrying AK-47s.  Almost every building and home has at least a guard and, unless it is right on the road, a fenced in courtyard with razor wire or shards of glass atop the walls. I remember similar gates and glass-topped walls in Haïti, but the guards are an unsettling addition. Vanessa told me that, in part, the practice started as a way to employ men who have been fighting most of their lives and hadn’t developed any marketable skills.  Fair enough. Another thing about Rwanda is the number of people walking along the road and the street vendors walking about.  Some (evidently) sell SIM cards or minutes for your phone.  This is in addition to a wireless shop on every other corner.  I was amused by the portable phones they carry that look similar to a desk phone, but without the desk. Finally, though I seemed to be on a normal sleep schedule after my first night here, I couldn’t sleep at all last night.  Seriously, I saw the sun rise.  I’m sure part of it was that I was up hacking away till 4 in the morning (“just one more thing”) but, still, right now I’m tired.  Thank God Rwanda’s primary export is coffee.  I need it now!

Ubuntu Packages and PHP

(Hello, Planet Ubuntu Users!  I’m looking for a second MOTU on my php-xdebug package as well as someone to revu my libapache-test-perl package.  Any takers?) Emacs CVS now includes XFT (i.e. smooth fonts) in the main branch, so I’m discontinuing my old emacs-xft-snapshot build.  Still, the other emacs-snapshot package is targeted to Debian and I’m running Ubuntu Gutsy.  So I’ve uploaded a snapshot build to my PPA on Launchpad. One thing that I included is flymake support for PHPCarl asked me earlier today if I knew how to get the compilation mode in Emacs to work with PHP’s lint function to find highlight problems.  I said flymake would be better, but didn’t know how to do that right off, either. After a bit of twiddling, I figured it out and, as a bonus, got compilation mode figured out, too. If you want to enable flymake for PHP-mode (yes, I have a Debian package for that, too) in a version of Emacs you already have installed, add the following code to your .emacs file:

;; Flymake PHP Extension (require 'flymake) (unless (fboundp 'flymake-php-init)   (defun flymake-php-init ()     (let* ((temp-file (flymake-init-create-temp-buffer-copy                        'flymake-create-temp-inplace))            (local-file (file-relative-name                         temp-file                         (file-name-directory buffer-file-name))))       (list "php" (list "-f" local-file "-l"))))) (let ((php-ext-re "\\.php[345]?\\'")       (php-error-re        "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)"))   (unless (assoc php-ext-re flymake-allowed-file-name-masks)     (add-to-list 'flymake-allowed-file-name-masks                  (list php-ext-re                    'flymake-php-init                    'flymake-simple-cleanup                    'flymake-get-real-file-name))     (add-to-list 'compilation-error-regexp-alist-alist                  (list 'compilation-php                    php-error-re  2 3 nil nil))     (add-to-list 'compilation-error-regexp-alist 'compilation-php)     (add-to-list 'flymake-err-line-patterns                  (list php-error-re 2 3 nil 1))))

Now, whether you’re using the emacs you started with or the latest emacs-snapshot, you need to tell emacs to use flymake on PHP files.  Add:

(add-hook 'php-mode-hook (lambda () (flymake-mode t)))

to your .emacs file and you’re good to go.