Archive for January, 2007

A New Car!

Yay, I’m joining the hybrid club ;). I won this 2003 Honda Insight! It’s Automatic and has 45,000 miles. KBB said this car in ‘good’ condition should be $12.9k and I paid $11k, so I think I got a great deal :). I’m going down to Long Island Saturday to pick it up.

Add this to my recent purchases of carbon offsets and I’m on my way to doing my part to help stop global warming.

Oh, also the Insight just has so much geek chic ;).

Why Gentoo is a Great Server Distribution (a Rebuttal)

Some history: I’ve been using Linux since 1998, when a friend of mine showed me RedHat 5.0. I was instantly hooked, and over the years I’ve spent a lot of time using various flavors of Linux and other Open Source tools. For the past 6 years or so, it’s been my job to administer Linux systems. I’ve used various distributions for this task: RedHat, Fedora, Debian, and Gentoo.

When I read Why Gentoo Shouldn’t be on Your Server, I felt Gentoo was getting a bad rap. I’m currently using Gentoo on a number of production servers for a fairly heavily-used website. Gentoo has simplified my administration tasks greatly, and allowed me the flexibility I need to build the best possible set of systems to handle the job at hand.

Build Times
My current setup has 10 identical machines running Gentoo. One of them I’ve designated as my ‘build server.’ It handles the actual building of new packages, mitigating to a great deal the time spent updating software. My other 2 Gentoo-based machines have rather different configurations (one is even a sparc), so they have to build their own sets. All of these machines have been running Gentoo for over a year.

Building
For any build process, I’ve found screen to be indispensable. I’ll start up (or reconnect) a screen session, then start the emerge process. Usually I’ll add ‘nice -n19′ to the beginning of the command to minimize the impact of the build process. Every time I update, I ‘emerge -uDav world’. This allows me to review upcoming changes. The only reason I do this is to see if any php webapp updates are coming in - I need to handle the upgrades for those by hand still.

Updating Configuration Files
Once the build is done, etc-update lets me view the list of updates. I never bother reading through changes to init scripts (/etc/init.d/*), as I trust the distribution enough to handle those. In fact, I trust the distribution to do the right thing 90% of the time, and often I end up just entering ‘-5′ to let the update system auto-merge all the latest changes. This is what other distributions do most of the time behind your back, anyway.

It’s only for those few configuration files that I have changed where I need to take a look and handle things manually. For those, I’ll look at the diff first (it’s what comes up when you select the update). Most of the time here, I’ll see the update is trivial and either let it apply (’1′) or ignore it (’2′). Sometimes I’ll need to edit the two together - choosing bits and pieces from each to ensure the proper result is achieved. Here, etc-update uses a very intuitive merging tool (’3′). For each change, you can choose which version to use. The old file is on the left, the update is on the right. To use the left hand’s version, you just enter ‘l’. For the right’s version, ‘r’. Only about 1% of the time do I need to do something else, and then I’ll enter ‘ed’ to edit both versions together. All in all, this makes handling configuration updates very simple and ensures the distribution doesn’t do anything it shouldn’t behind your back.

Profile Updates
One of the previous article’s main gripes was about profile updates. Let’s reiterate: Gentoo is a source based distribution. In order to apply security updates, you need to have up-to-date dependencies. In order to have up-to-date dependencies, you need to have a capable base system. These profile updates ensure just that—that you have an updated base system. I’ve found profile updates to be painless. All I do is update the /etc/make.profile link, emerge -e system, then emerge -e world. Again, thanks to the use of nice and screen, I don’t even notice the compile time spent here. My non-build servers spend no time at all. I never have had to rebuild one of my machines from scratch. If I ever do, I’ll wonder what I did to break Gentoo’s well-designed build system.

Closing
In short, Gentoo is one of the most well thought out distributions I’ve ever used. The irony is that I don’t use it on my desktop! I use Ubuntu, mostly because I don’t need the flexibility Gentoo provides and I don’t want to use noticeable processor time building new packages.

Gentoo, through portage, provides a robust, friendly, and dependable build system. It is also important not to forget one of Gentoo’s driving philosophies: If you don’t need the package on your system, don’t install it. Use those USE flags to reduce the number of unneeded dependences! If you only build what you need, you will spend less time building. When you run ‘emerge -uD world’, you know that the updates you’re getting are updates you need. Unlike under most distributions, My servers run with a minimalist list of installed packages. This saves me headaches from security issues, and also decreases the disk footprint of the OS, allowing me to use that capacity for business needs instead.

I’ve occasionally questioned my use of Gentoo on my servers, but each time I come back to Portage. No other distribution lets me control with such a fine grain what goes on my system. No other distribution offers the wealth of packages Gentoo does. Other distributions might be easier to administer, day to day, but they do this by hiding from you things that I actually use. If it’s your job to administer servers, why not take the time to learn about what’s happening? You’ll end up being a lot less paranoid, and a much more capable admin. You’ll even end up saving yourself a lot of time.

The Saga of the Corrupt Registry

Saturday while Jen was preparing some wood boxes for painting, I was trying to see if I could get Bumble (Jen’s Windows 2000 based computer) to sleep or hibernate. My motive for this was due to all of the energy conservation literature I’ve been exposing myself to lately - I figured I could save power if I got Jen’s computer to quickly sleep while not in use. I quickly found out sleep mode wouldn’t work, but I figured Hibernate would be just fine. After enabling hibernate mode, I (seemingly) hibernated the computer with no problem. This was around 5pm.

When I turned Bumble back on, it started to boot just fine, but right about the time when you expect to see the GUI come up, it would reboot. If I let it, it would keep doing this startup/reboot loop forever. I tried booting into safe mode, but I experienced the same reboot loop problem. I had no idea what was going on at this point.. I thought maybe windows was reading something in the something in the hibernation file (hiberfil.sys) that it didn’t like and then rebooting. I thought if I could only remove that file, everything would work fine.

Luckily, I had ubuntu installed on another partition (dapper drake (6.06).. a little old, but still very useful). After fighting with the wireless card momentarily (using ndiswrapper and windows based tnet1130 drivers), I was able to browse the web and find that I needed the ntfs-3g driver to write to (or delete from) NTFS filesystems. I got the appropriate driver and setup everything, but the filesystem wouldn’t mount. The ntfs driver complained the filesystem was marked as crashed and told me I’d need to run windows’ chkdsk utility. Great, I don’t have windows accessible at the moment!

I searched around a bit for some operating environment that would let me run chkdsk and found BartPE. This is a great utility that basically builds a windows livecd using whatever current version of windows you have running. As I was running Linux on my laptop at the time, I rebooted into windows (good thing I keep XP around!) then created a BartPE disc.

Booting BartPE on Bumble was a little odd - it asks (scarily) to upgrade or install a new version of Windows XP, but pressing F10 (to select a new install) just starts up BartPE. I guess that’s what happens when you use a OEM version of Windows to build a BartPE disc.

Inside BartPE, I was presented with a strange ‘mini-windows’ The PE builder replaced Windows XP’s start menu and taskbar with something very stripped down. It seemed to work however, and provided me with a minimalist working environment. I was able to open a command line window and start chkdsk.

Chkdsk ran for about 2 or 3 hours doing a full filesystem scan. This was probably unnessecary, but I wanted to be sure there would be nothing left to blame on the drive. During this time I was able to eat the dinner Jen had been very graciously slaving over for hours (awesome beef/bean/stuff enchiladas!). Finally able to mount the ntfs partition in Ubuntu, I removed hiberfil.sys and rebooted. No dice. Damn!

After lots of searching, I found that having a corrupt registry could cause this reboot loop. Thanks to this post on google groups, I found old registry from feb 2005. This registry was so old it was basically useless, but it let me boot the computer at least! I then tried a variety of old and new registry file combinations until I found the corrupt file - of course the biggest and most important one, the software hive.

At this point I was able to boot into Windows 2000, but in a weird environment with user accounts but no settings or software registry. I tried to find registry recovery tools until around 1:30am. Among the various tools, I found Microsoft’s corrupt registry repair tool but I didn’t have the 6 floppies the tool required. I was so tired that I figured I’d get floppies in the morning at Staples, and went to bed.

Sunday morning, having made prior commitments, I went to spar briefly at 9 with some friends from Tae Kwon Do. We finished up around 10, but Staples was still closed. Cursing the gods of retail, I went home and did some more searching for corrupt registry repair tools.

Now that I’d had a chance to sleep, I quickly found RegDatXP. Its info page mentioned loading corrupt registry files in a newer version of windows (xp, vista). Apparently Microsoft realized the importance of registry files and built in corruption recovery systems to these later versions.

Feeling glad for once that I keep Windows XP on my laptop, I loaded the corrupt binary registry file in Windows XP’s regedit tool (file -> load hive). I assigned it to a temporary key under HKEY_LOCAL_MACHINE (tempKey). Regedit bitched that the file was corrupt, but loaded it anyway. I was able to open the temp key and see software entries. Huzzah! I first exported a .reg file, then unloaded the hive.

I copied the hive and .reg files back to Bumble, opened the repaired hive in regedt32 (on Bumble) and was able to browse the hive without trouble! I tried to import the hive into the live system, but (of course) it said I couldn’t. I then went back to Ubuntu and (after saving everything - can’t ever have too many backups!) replaced the operative software hive file with the repaired original hive (these files are in C:\WINNT\system32\config).

Finally, I booted Windows 2000 and everything worked fine! Yay! I didn’t have to buy any tools of questionable quality or content! I didn’t have to use 6 floppies (although that probably would’ve worked had I not had Windows XP sitting around as well). Huzzah!

Lesson learned: Don’t trust Microsoft when they say Hibernate works! In fact, don’t change any settings in a working Windows install, ever. Especially Windows versions older than XP (which has better recovery tools built in). Also, for good measure, Microsoft sucks! ;) Use Linux! ;) If Jen just used Ubuntu all the time, not only would she not be able to run half the software she uses daily, she would also not be subject to time wasting breakage like this :).

So, here’s the short fix if this happens to you:

  1. Get BartPE and run chkdsk to ensure your filesystem is intact.
  2. Backup your current registry hives (C:\WINNT\system32\config). Backup your backup hives too, just to be sure (C:\WINNT\repair\*.*)
  3. Figure out which combination of new and old registry files breaks your system.
  4. Copy the bad files to a working Windows 2003 or newer install.
  5. Load bad hives in regedit on the newer Windows.
  6. Unload now fixed hives, copy back to broken system.
  7. Place hives back in place while not booted into broken system.
  8. Go back to hatingenjoying your windows install!

Game Music Test

Game Music Deity
You scored 88 % video game music expertise!
I’m impressed, you got a great deal of these questions right! You have the natural ability to remember most of the game music you hear. You probably also find yourself humming video game songs in your day to day life (and in no way is that sad, my friend). Hooray for that!
My test tracked 1 variable How you compared to other people your age and gender:

free online dating free online dating
You scored higher than 99% on expertise

Link: The Great Video Game Music Test written by JohnTheJubilant on OkCupid Free Online Dating, home of the The Dating Persona Test