Articles tagged: computers

Debugging the OpenBSD kernel via QEMU

Recently I had to track down a minor bug in the OpenBSD kernel. I tapped QEMU and GDB as debugging tools for the task, running on Ubuntu 12.04 as the host OS. This combination worked extremely well, so for the record here’s how I set it all up.

OpenBSD comes equipped with two kernel debugging mechanisms: ddb and kgdb. ddb(4) is an in-kernel debugger, enabled by default in the GENERIC kernel, and can be invoked either explicitly from the console or automatically in the event of a panic. It is analogous to the Linux debugger kdb in that it can be used to set breakpoints and examine the stack or register state, but (like kdb) it is not a source-level debugger.

For source debugging there is kgdb(7), which offers the ability to remotely debug the kernel by way of a GDB stub running over a serial port; this is similar to the Linux debugger kgdboc. However, kgdb it is not available in the GENERIC kernel, and it imposes an additional set of configurations and debugger latencies on the user. If your debugging task is amenable to running OpenBSD within a virtual machine, as mine was, then …

Read more…

Updating your music collection with PowerShell

I’ve been banging my head against the wall on account of different music players which can’t play the subset of songs I have encoded as either Vorbis or AAC. So I’m slowly converting my entire music library over to MP3, which works everywhere, even if it’s less efficient.

But before I go digging through my old CDs I need to identify which albums I have to re-encode. My music is organized in folders by artist and then album, e.g.:

~\Music\Library\Pixies\Surfer Rosa\Where Is My Mind.mp3

So this means I effectively have to list the names of folders containing non-MP3 music files. Fortunately Windows PowerShell makes this a one-liner (though admittedly it’s a pretty long line; the backtick is PowerShell’s line continuation syntax):

ls -r Music\Library `
| ?{ $_.PSIsContainer -And ( $_.GetFiles() `
| ?{ $_.Name -Match "\.(m4[ap]|ogg|wma)$" } ) } `
| %{ New-Object PSObject -Property `
@{ Artist = (gi $_.PSParentPath).Name; Album = $_.Name } }

This will give you a nice list of non-MP3 albums, like:

Album              Artist
-----              ------
That's Your Fire   Aloha
Noble Beast        Andrew Bird
Believe It Mammals Bats & Mice
Charm School       Bishop Allen
[...]

And thanks to PowerShell’s object-oriented pipes, this …

Read more…

PXE booting OpenBSD on an ALIX via Ubuntu Live CD

Update: I’ve expanded the contents of this post into a full guide to running an OpenBSD router on an ALIX board.

This is a quick guide to booting the OpenBSD installer on a PC Engines ALIX board with tinyBIOS (such as the ALIX 2d3) via PXE, using just the following:

  • PC with two network interfaces. One of these needs to be Ethernet, and the other must connect to the Internet. For example, any standard PC laptop with both WiFi and Ethernet adapters will work if there’s a WiFi Internet connection available.
  • Null modem cable
  • Ethernet crossover cable
  • USB-serial adapter (unless your PC has a built-in RS-232 port)
  • Ubuntu Linux 10.10 desktop live CD

Thanks to the versatility of the Ubuntu live CD (specifically the use of AUFS to provide a writable root directory in RAM), you can set up the necessary PXE boot server without making any permanent changes to your PC.

Ubuntu packages

Boot the Ubuntu live CD and quit the installer. Ensure that Ubuntu has a working Internet connection, then enable the “universe” package repository by uncommenting the corresponding lines in /etc/apt/sources.list. Now open a terminal and run the following …

Read more…

Advanced Kindle store search

I just found a great web site providing a better Kindle content search than what’s baked into Amazon: eReaderIQ.com. You can search by price, publication date, reading level, and whether the book you want is in the public domain, among other things.

For example, this query lists only free Kindle books in the public domain. Very handy.

Microsoft Outlook ruins my evening

I had a funny experience yesterday.

I don’t typically use Microsoft Outlook with my home email account. But it was bundled with the copy of Office 2010 that I installed a few months ago, and I figured: heck, if I have it anyway I might as well hook it up to my personal IMAP account. So I configured Outlook, played with it a bit, then promptly forgot all about it.

Fast forward to yesterday evening. I launch my copy of Outlook for the first time in months in order to try something with the calendar, but then I get distracted and walk away from the computer. Five minutes later my cell phone gets a message from my FreeBSD server:

EMAIL SERVER HIJACKED - FIREWALLING POSTFIX

Oh. Fun.

A slight digression before I can get on with the story: I try my very best to be a good Internet citizen, and that of course means not allowing oneself to become a spam relay. Because this email server exists only for my personal use, it was simple to write a Perl script that monitors my Postfix logs and, if it sees anything grossly out of the ordinary sent out through the server …

Read more…

Pagination