I wonder if Google worried about the strength of their trademark when the American Dialect Society chose “google” (the verb) as the word of the decade for 2000-2009.
Dump core without crashing
Sometimes you can’t wait for a program to crash to inspect its core file. Or perhaps it’s best if the program doesn’t crash at all. In these cases you can ask for a core dump without harming any processes. You need to know the PID of the running program, so look this up with ps beforehand.
AIX
On AIX use the program gencore to request a core file.
Usage: gencore
Example:
$ gencore 6226066 java.core
Linux
Linux doesn’t have a dedicated program to perform this task. Instead, you attach gdb to the process and use its gcore command to dump a core file into the current working directory.
Fortunately, gdb is scriptable and can run commands given as arguments non-interactively. We can write a shell alias to mimic AIX’s gencore command:
$ alias gcore='gdb --batch -ex gcore --pid'
Now, run this command with a process ID:
$ gcore 16376
0x00000000005306ba in sigsuspend ()
Saved corefile core.16376
After many years of adamant refusal…
…I have posted a video to YouTube. But only because school made me do it. I was trying to talk my wife out of making a vlog, but have now lost any credibility I may have had in that argument.
I’m trying to combine two of my favorite things here: hardc0re computer science and Red Eclipse. I hope the results are as awesome as they sound.
Chicken Scheme built on Raspberry Pi
I’m a little ashamed that I hadn’t tried this sooner. But one of my favorite open-source projects, Chicken Scheme, builds an runs flawlessly on a Raspberry Pi.

Though I forgot to time(1) the build, I estimate that it took roughly 1 hour 40 minutes to complete on the RPi. I built it on the Debian “Squeeze” image provided by the Raspberry Pi Foundation (I haven’t gotten around to installing Raspian).
I didn’t have to do any tricky stuff to get it to build: it was as easy as downloading the latest stable build from http://code.call-cc.org/ and issuing the commands
% make PLATFORM=linux PREFIX=/usr/local
% make PLATFORM=linux PREFIX=/usr/local install
I’ve tested building eggs such as linenoise, base64, getopt-long, and fmt.
So far, so good!
I hope this helps to bring Alaric Snell-Pym’s great idea closer to reality.
Disable Windows Error Reporting on Server 2008
Since at least Vista, Windows has featured a singularly useless feature that combines the grace and good-timing of a Steve Urkel entrance with all of the aplomb of a Shia LeBeouf lead role:

Windows Error Reporting. Bless its little heart, Windows is trying so hard to be useful.
In all the times that I’ve been graced by this dialog I’ve not once been helped by it. I mostly encounter it as a result of a crash within our own under-development software. Why on earth would an appeal to the internet be of any use for the code I’m hacking on myself?
Even when this dialog comes as the result of another program’s crash, it never offers any helpful advice. I take that back – it never offers any advice. It sits there for a few minutes and comes back with “so… Big gulps, huh? Well, see ya later!”.
When this silly pop-up occurs on my work machine under normal circumstances, it’s merely annoying. It doesn’t help me, but at least I don’t need to jump through UAC to dismiss it.
What makes this unforgivable is that it gets in the way of automation. At work I’m developing an automation framework (similar to Puppet or SaltStack) to facilitate the unattended testing of our software installers. We are starting by simply smoke-testing our installers. If one encounters an error (such as a crash), my program should log it and move on to the next installer. The only human interaction comes the next morning when a denzien of meatspace checks his email for a listing of installers that broke.
I have come to understand that “unattended” and “Windows” are mutually exclusive concepts. Only Windows is so imperious to presume that a live being is constantly seated before it, waiting with bated breath for something to happen. When something happens, the living being is expected to offer oblations in the form of input events, thus sating Windows unconquerable lust for attention… for now.
Think about it: how many embedded systems can you think of that run Windows underneath? It’s not just that Windows requires more resources than embedded systems have at their disposal which keeps Windows out of this space; a Windows system would surely die of neglect if it couldn’t count on the rapt attention of a user.
Being a Linux user, I take it as a personal insult to my intelligence when a computer thinks it knows better than me. I also don’t appreciate it when a computer requires my personal guidance to complete such basic tasks as iterating a for loop. But when a computer demands constant coddling and attention it ceases to be a useful tool and becomes an unrewarding hobby. Know that I am saying this as a Gentoo user: Windows has crossed a line here.
Being a Linux user, I have come to expect that I can bend a computer to my will. In researching how to disable this feature (surely something as cumbersome and obstructive as WER is optional) I came across many possible solutions involving various icons in the Control Panel. These solutions described how to find relief in Vista and 7, therefore none of the icons existed in Server 2008′s Control Panel. Say what you will about the /etc directory; but at least you can grep it. Windows’ new Control Panel search feature narrowed things down for me somewhat, and I only had to click through a handful of screens to find the right option:

FFFFFFFFFFFFFUUUUUUUUUUUUUU!!!!!!!!!!!
Why are you asking me to close the crashed program?!? It already closed itself! Since the program has already crashed, and I have no debugger on this computer, what can I possibly want to do with it at this point? Instead of blocking my automated tester over a choice between the lesser of two evils, you’ve held it up with an even more pointless question! Was WER designed by sadists or push-pollers?
It turns out that there is a secret cheatcode that will get Windows to behave as I want. Of course I only have to EDIT THE REGISTRY to do it. This is so much easier than Linux, even my mom can do it!
Here’s the tl;dr for you:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting]
"Disabled"=dword:00000001
"DontShowUI"=dword:00000001
Read the knowledge base article for more details. (Protip: if you export this registry setting from regedit and want to edit it in Vim, open it like this:
:e ++enc=utf-16le wer.reg
I didn’t find this written down anywhere, but regedit exports these in utf16 little endian format.)
Yes, it’s actually two registry settings. One to disable the dialog, and the other turns off error reporting. You see, when you click the “Check online for a solution” button, Windows is not so much looking for a solution to your problem as it is sending a minidump back to HQ.

If you disable the GUI the minidump is silently sent to Redmond.
So, to recap
- The default Windows Error Reporting setting is useless
- The default Windows Error Reporting setting disregards your privacy
- You can’t disable the GUI from the Control Panel
- The actual fix is not well documented
- The actual fix involves EDITING THE SCARY REGISTRY
Why do people think this is easier to configure than a UNIX box?
Kevin Benko’s excellent iptables tutorial
In June of 2009 Kevin Benko delivered an introductory presentation on iptables to the Salt Lake Linux User Group. I was not in attendance, but benefited greatly from the PDF slides that Kevin created for his talk. I had read my share of iptables tutorials before, but Kevin’s explanation was the first one that clicked for me.
These slides were hosted on the web server belonging to one of the members of the LUG. Over the course of time the slides were lost, both from my PC and from the the LUG member’s web server. This was rather tragic to me last week while I went through some firewall issues on my router.
I searched my hard drive, scoured mailing list archives, spammed IRC channels and even tracked down Mr. Benko and the LUG member who had hosted the slides. Nobody had a copy of this PDF from so many years ago.
It turns out that as I was trying to recall the contents of the slides I remembered reading them at my old PC. I got that computer out of mothballs, mounted the hard disk, and sure enough there was the very file in my old Documents directory.
I must have done some “cleaning” when I merged my old home dir over to my new PC, and was a little over-zealous in what I cleaned up. Or, I put too much faith in “the cloud” as my backup plan. Now kids, this is why you should periodically make a complete and off-line backup of your home directory.
I do not wish to see this tutorial go the way of the Library at Alexandria, and will re-post Mr. Benko’s excellent iptables tutorial here.
Raspberry Pi Unboxing
After many months of excitement, waiting, setbacks, and some more waiting, I’ve finally got it. My very own Raspberry Pi.
I live rather close to my office. I also live very close to one of the local UPS hubs. Whenever I order something online, it invariably arrives very late in the day. They always come far too late because by the end of the day I’ve just about worn out the F5 key. And I certainly don’t envy the poor UPS drivers who get to work their routes so far into the evening.
I really need to remember to ship things to the office where the UPS guy comes in, like clockwork, at 10:30 am to drop off our shipments and to fill up his fountain drink in our break room. I thought he had looked familiar when he handed me this envelope at almost 6:00 pm at my house, not 1.5 miles away from the office.
I live on the same route as my office, and what’s more, the driver passes my house on the way to the office!
I had pictured getting a small brown box, but instead the driver handed me this cushioned envelope. When I first grasped it, I thought it was empty.

Inside the envelope was a packing list and this understated box.

And here she is, plugged in next to something else I found in the mail; a complimentary invitation to the AARP. I used to think that the ‘A’ stood for American, but I guess it really stands for AOL. I wonder how many free hours of AARP membership I can enjoy before I have to give them any money…

I’m running the Debian “squeeze” image. I would show a screenshot, but since I’m running it headless they wouldn’t be much to look at. Plus, I don’t even own a TV to plug it into. I have uninstalled X11 and all other GUI packages and reclaimed over 300MiB.
There were a few unusable packages on this disk image, such as wpa_supplicant (unless I’m mistaken about the hardware capabilities, because having WiFi built in would ROCK).
The only other thing that I would warn you of, is that sshd is not configured to launch at boot. If you want to go headless like me, you’ll need to do a tiny bit of tweaking to the image before you fire it up.
First, download, verify and unzip the file from The Raspberry Pi Foundation.
Then dd it onto your SD card.
Or, you can be a smarty-pants and use
parted debian6-19-04-2012.img unit B print
to find the offset of the /boot partition (hint: it’s the 1st one) so you can
mount -oloop,offset=1048576 debian6-19-04-2012.img /mnt/loop
mount it on a loopback device. Whatever floats your schooner.
Once you have mounted the /boot directory, you’ll want to
rename boot_enable_ssh.rc to boot.rc. That little nugget of knowledge would have bought me an extra hour of sleep last night. C’est la vie.
Kaspersky predicts the end of the world in 2012
I just read this crazy crap, and have disabled my “Kaspersky Endpoint Security 8 for Windows” in protest.
Before:

After:

Also, that piece of junk was slowing my Cygwin all the way down. When I don’t want viruses, I’ll stop opening every piece of email anybody ever sends me. In the meantime, I’ll need a responsive command-line here if I’m going to get anything done at all.
However, considering the history of democracy in Russia over the past 20 or so years, I can’t be too surprised he takes such a dim view of the electorate. If I was from the country that re-elected the Slavic Terminator, I’d be cynical, too. 
I’d just hope that a guy that defends Windows machines for a living would understand how colossally idiotic it would be to insist that all elections take place online. I fail to see how voter apathy can be in any way mitigated by technology. There are plenty of important things that (should) happen online that the vast majority of people can’t be bothered to do. A few examples:
Any these occur more frequently than, and have a more immediate impact than an election, but very few people do anything about it. Online or off.
I propose that instead of talking about how we can make things even easier for increasingly lazy people to do, we begin expecting that citizens put in a minimum of effort to maintain their own standard of living. Even if that means the people have to leave their house once every two years to stand in a short line and poke some holes in a paper. Because the minute you make something trivially easy is the same minute you make it trivial.
At any rate, we all know that this keynote address is really about securing the future of Kaspersky Lab. A future which we must protect from collapse through electronic voting machines must look very bright indeed.
Check the picture of Eugene K. in the story above, and tell me if you don’t think he resembles this guy.
They have a lot in common, besides the receeding-in-the-front-party-in-the-back look. They each command authority because of their technical know-how, they know how to entrance an audience, and they can get people to do any number of silly and dangerous things in return for their “protection”.
My new 2nd favorite WHOIS lookup
Coming in at #2 behind /usr/bin/whois is WHODAT.BIZ. This is exactly what the internet has been missing.
I added the WHODAT search plugin at the Mycroft project for your convenience. Now doing a WHODAT in Pentadactyl is almost as convenient as doing a WHOIS.
…Anyway, the real shame about this is that WHODAT.BIZ launched just a few short days before April 1st. Now what do I have to look forward to on Sunday?
Migrating partitions between filesystems on Linux
I recently converted my hard disks from ReiserFS to ext4. I did this because the ReiserFS project doesn’t seem to be able to go on after Hans Reiser’s murder conviction in 2008, despite its technical merits and great promise. I have accepted that ext4 is my destiny.
I did not, however, want to use this as an occasion to re-install my entire system. I’ve been a Linux user long enough now that my first instinct is not to reinstall my OS every time it provides a challenge. Unlike some of the more anemic OS offerings in the marketplace, my computer comes equipped with sufficient tools to administer it. A little bit of thought and planning yields a straightforward way to migrate my data between two incompatible filesystem formats. In the end, I was able to effect a transition so smooth that my wife wasn’t able to tell the difference. All it took was time – and an extra hard disk.
All together, my computer has ~700GB of storage across four ReiserFS partitions that needed to be converted. Fortunately, this implies that I can tackle the problem in four pieces instead of needing to do it all at once. That’s great because it took a lot of time to copy the data around. (Though if I get to do this again I’ll buy a new internal SATA disk instead of using an external USB drive.)
My largest partition is ~290G, so I’d need at most that much extra storage off to the side. I had previously won a 1TB external drive in a drawing, so that need was covered.
Three of the partitions in question were not the root partition, so I would be able to convert them within my regular operating system in single-user mode. To migrate the root partition I’d have to boot into a LiveCD so that I could access the needed tools without mounting /. My distro of choice is Gentoo, so it follows that my favorite LiveCD distro is SystemRescueCD. Since I always have a SystemRescueCD laying around, that problem is solved.
And now the fun part. For this example I’ll be converting my sdb2 partition which held my /home directory to the ext4 filesystem.
0. Enter single-user mode to ensure that only a minimum of programs are running to avoid trouble with your target partition:
# init 1
1. Unmount the target partition, and mount the external drive.
# umount /dev/sdb2 # mount /dev/sdd1 /mnt/external
2. Kick off dd (what else?) to copy the data from the partition device to a file on the external disk:
# dd if=/dev/sdb2 of=/mnt/external/sdb2.img
I tried experimenting with different block sizes to see if I could speed this step up, but it seemed that the default was as good as it gets. I’m sure the bottleneck was USB 2.0 and not the disk I/O itself.
As an aside, you can monitor dd’s progress by sending it SIGUSR1. For this task, I would background dd and run this shell command to get some stats every couple of minutes:
# while kill -0 $DDPID; do kill -SIGUSR1; sleep 120; done
The `kill -0 $DDPID` bit means that the while loop will run so long as this dd process is running.
3. Take the SHA1 hash of original partition and the image to ensure that they’re identical:
# sha1sum /dev/sdb2 /mnt/external/sdb2.img
This step takes forever, but is critical. The checksums didn’t match on one of my partitions and I had to start over. I will never know how much headache I saved myself by taking this precaution.
4. Make a new ext4 filesystem on the partition:
# mkfs.ext4 /dev/sdb2
5. Update /etc/fstab with the new partition’s UUID and fstype:
# /sbin/blkid /dev/sdb2 >> /etc/fstab # $EDITOR /etc/fstab
6. Mount the new ext4 partition, and mount the ReiserFS image on a loopback device:
# mount /dev/sdb2 # mount -oloop sdb2.img /mnt/loop
7. Recursively copy files from loopback image onto new partition:
# cd /mnt/loop # cp -av * /home
The -a flag to cp means the same as “-dR –preserve=all”, which goes a long way to ensuring that the wife can’t tell the difference. I find that there is nothing so unsettling as a busy computer with a churning hard disk showing nothing but a blinking cursor, so I added the -v flag just so I could rest easier. Then I let it run all night long, thereby missing all of the exciting output. But I did sleep soundly!
8. Return to multiuser mode. For my system, that’s runlevel 3:
# init 3
Everything worked like a charm after that. I was able to piecemeal convert all of my partitions in this fashion over the course of a couple of weekends. The only one that required a reboot was the root partition. As I can’t even update Java on my Wintendo at work without a reboot, this counts as a win in my book.