Fri, 22 Aug 2008
dd, dd_rescue, and ddrescue
The short answer: "Use GNU ddrescue. GNU stands for Quality."
dd is a classic UNIX utility to read from and write to files (often devices). Typically, one uses it to copy a hard disk to a file, or to image a hard drive by copying a backup onto it.
One hits a problem when the hard disk has errors. In this case, dd abruptly stops working in the middle, reporting an "Input/output error." But when the hard disk has errors, usually what you want is to get an image of all the blocks on the hard disk that are readable - not just the first few before the first error!
(Note for the pedantic: Yes, I know about dd conv=notrunc,noerror. They're so easy to misuse (mostly by forgetting one of those two options) that they're worth avoiding.)
Two tools are available for this particular purpose. Confusingly, one is called ddrescue, and the other is called dd_rescue.
Around 2001, Kurt Garloff wrote dd_rescue. It does what dd does if you pass it some options, but it comes with instructions on how to use it to recover data from drivers, like by running it multiple times or bakcwards. A wrapper script called dd_rhelp automates that process.
When you're running dd_rescue on an obscure OS like Mac OS X 10.3 because you dropped your laptop in Uganda and the Linux partition grew bad blocks and you still want your data, you will find that dd_rhelp is written as a complicated shell script that relies on GNU versions of core system utilities. OS X provides non-GNU versions, and you will waste hours fiddling with compiling those utilities just so you can run some dumb shell script.
In the summer of 2004, the same summer as I dropped my laptop, Antonio Diaz Diaz wrote "ddrescue," a stand-alone C++ tool that does the same things as dd_rhelp, but more sanely and therefore more efficiently. It became an official GNU project. GNU ddrescue, like dd_rhelp, can keep a log file to let itself gracefully pick up after interrputions.
When your hard disk fails, you should turn to your backups. But if you need a tool like these, just remember: "GNU ddrescue."
$ sudo apt-get install gddrescue
Wed, 20 Aug 2008
Lamers
Kragen Sitaker and his wife Beatrice were very gracious in hosting me and my brother for a week in Buenos Aires.
I was looking for something on Kragen's website and found a ten-years-old discussion of how to find security problems in software. In it, he writes:
Body text last updated 1998-07-22. Recently has become the most popular page of mine, presumably because a bunch of lamers want to learn how to break into things. [...]
I wouldn't be surprised if calling 100-200 people a day `lamers' results in electronic attacks on me or my machine (kragen.dnaco.net.) All I can say is that people who do this would thereby demonstrate their lamosity.
Lamers, you say? Nelson took this picture of me a few years back. Look at the thumbs-up from the driver!
(Photo available for re-use under Creative Commons Attribution-ShareAlike 2.0.)
Note: Mako addressed this topic earlier this year, and then again more recently.
Sun, 17 Aug 2008
Fake Out in Buenos Aires
"Falso," he said.
I accepted the 100 peso (US$30) note back. The only place we had gotten 100 peso notes were ATMs.
I found a different one with a good watermark and handed it to him. (This happened a bit over a week ago.)
Fri, 15 Aug 2008
Hello Planet Debian
I have a face on Planet Debian!
(Thanks to John Wright for setting it up for me!)
Mon, 04 Aug 2008
Argentina for two weeks
For those of you I haven't told, I'm in Argentina. I've been here since Friday July 31. The idea is to take a week's vacation before heading to Mar del Plata for a week of the Debian conference, Debconf. This year, Debconf is held that beach resort town in the winter. From what I read, Mar del Plata is worth visiting even in this off season. On August 17, I'll be back in the Untied States (*).
The gracious Kragen Sitaker and Beatrice Murch are hosting me and my brother for a week in Buenos Aires. As a side note, right now I'm not in Buenos Aires but in a cold place called El Calafate.
On an overcast wintery day, B.A. looks like someone took a remix of Belgium and Paris and let it wear out a litte more than you'd expect from the Continentals. On any sort of day, from Kragen's and Beatrice's roof, it looks like someone ported Blade Runner to Europe.
(*.) [sic]
Francisco
Francisco is the name of the very energetic hostel attendant at America del Sud El Calafate.
After offering me a key (literally) for the wireless, he told me the password.
"What are you doing there?," he asked me. "It's email," I answered.
"Email? And how can you see? I can't see any letters." (The fonts are pretty small on my laptop.) "What program is that?"
"Pine," I said. "It's called Alpine."
He paused for a moment, and reported, "You look like a hacker with that." He patted me on the shoulder and wandered off.
Sun, 03 Aug 2008
Real DOS on a virtual disk
Sometimes you need to run DOS programs, like to flash BIOSs on your laptop. Sometimes, if you're Kragen, that lets you fix ACPI on your BIOS, giving you a hope that X will boot up more often than 1 in 3, sound will skip less, and the first PC card you insert will be assigned a valid IRQ. (The last one is particularly interesting: to get a working PC card before the promised joy of the BIOS update, you have to plug in one card, watch it get assigned the mostly broken IRQ 3, plug in a second card, watch it get assigned the useful IRQ 4, and then you can remove the first one. This is a good way to get a wifi card working.)
Here's a simple HOWTO for getting that going on a Linux machine without repartitioning or booting off external media.
I'll refer to aptitude; I'm assuming you're using a Debian/Ubuntu machine so that makes sense.
Step 1: Install syslinux
$ sudo aptitude install syslinux
Now memdisk is in /usr/lib/syslinux/memdisk .
You should copy it to /boot/ in case your root filesystem is encrypted:
$ sudo cp /usr/lib/syslinux/memdisk /boot/
Step 2: Get your DOS floppy in /boot
Debian packages FreeDOS in dosemu-freedos. Unfortunately that doesn't include a floppy image. Instead:
$ cd /boot $ sudo wget http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/fdboot.img
Step 3: Configure GRUB
Put this in your /boot/grub/menu.list and smoke it:
title FreeDOS kernel /memdisk initrd /fdboot.img boot
Step 4: Reboot, and choose FreeDOS!
Ta-da, you're done.
More options
For bonus points, you can customize the floppy disk image. The easiest way to modify is to mount it loopback:
$ sudo mount -o loop,mode=777 /boot/fdboot.img /mnt/
Then you can copy files into /mnt/, and then when you're done:
$ sudo umount /mnt/
Ta-da, the image has been changed! (Thanks to Kragen for confirming that this actually works.)
The lame old way to customize the image is to use "mtools."
P.S. Thanks to Albert Lee for explaining this trick to me in the first place!
Mon, 21 Jul 2008
Calorie Calorie
Last night I flew from New York's JFK airport to Portland's PDX. While at JFK, I was hungry. I was enticed by the delicious-looking fries in the display sample from "Cheeburger Cheeburger [sic]."
When I went up to order, I found the fries alone seemed to have over 1700 calories. Since when do fast food joints tell me how many calories are in the food right next to the price? I ordered my cheeseburger but could not in good conscience buy a side of fries that had nearly three times as many calories as the "entree" itself.
This morning I ran into a news article explaining that this is because of a new health inspector rule requiring calorie counts "displayed on [chain restaurant] menus in the same font and format as the name or price of food items." The article reports, "New Yorkers appeared unfazed by the rule."
It continues to quote a casually pro-corporation anti-informing-consumers analyst named John Owens, "I'd be shocked if consumers weren't already aware that when they're eating in a fast-food restaurant." I knew it wasn't "healthy" to eat burgers and fries from fast food chains, but I'm still a little shocked that the fries alone have more than 1700 calories.
Maybe we could have this sort of signage everywhere, even in cities that aren't New York.
Wed, 16 Jul 2008
IP over Avian Carrier: Security implications
BBC News has a story on Brazil's pigeon drug mules.
Quoth Bruce Schneier:
I think this is the first security vulnerability found in RFC 1149: "Standard for the transmission of IP datagrams on avian carriers." Deep packet inspection seems to be the only way to prevent this attack, although adequate fencing will prevent the protocol from running in the first place.
Fri, 06 Jun 2008
Build failure
A package I am working on fails to build. Mako helps me understand why:
<mako> problem seems to be liboobs <paulproteus> I'm afraid you're trolling me. <mako> i wish i was
