linux

Installing Mongrel on Ubuntu Feisty with rubygems

When I recently re-installed Ubuntu 7.04 (Feisty), I found that I couldn’t build the native fastthread gem (a required dependency). If you get this error:

Building native extensions. This could take a while...
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1


ERROR: While executing gem ... (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0 for inspection.

then you need the ruby development libraries and the build-essential package. I’ve found that these commands will make sure mongrel (and rails) is installed correctly:

$ sudo apt-get install ruby1.8-dev rubygems build-essential rails
$ sudo gem install mongrel --include-dependencies

linux
rails
ruby

Comments (0)

Permalink

Using the Ubuntu Feisty Live CD as your primary OS

I had one of the most dreaded computer woes happen last week - my hard drive crashed.

Well, it didn’t crash completely. I have about a 70% boot rate. It makes a load noise like the bearings aren’t well lubricated when the drive won’t boot. I figured it was better (and less frustrating) to stop using the drive and just wait until the new hard drive arrived.

Luckily, I use unison over SSH to backup my files, so everything was already mirrored on my Debian file server at home, even though I was across the country when the failure occured. I’ve reminded myself that I needed to have my data backed up if something catastrophic ever happened to my laptop. In my mind the scenario was that my laptop was going to be run over by a truck (gotta think big), but I knew the hard drive crash was probably inevitable. Unison is a good tool to sync two file systems, however it does work best if you manually sync. If you want something to automatically back up files, set up rsync as a cron job on your system.

Coping with the problem

At first, I thought I should just go without my laptop for a few days (oh the horror!). Newegg ships fast, right? I should have known myself better than that. I immediately started thinking of how to run my system with a broken hard drive. Naturally, the idea of using a Linux Live CD came to mind.

To preserve the old hard drive, I physically removed it from the laptop. After that, I remembered I had ordered some Ubuntu 7.04 pressed CDs a while back so I popped one in.

To my surprise, Ubuntu 7.04 (Feisty) as a Live CD rivals my normal hard drive install in terms of performance! The bootup time is quite slow, but once it has started, it runs nicely. Since I spend a lot of time using Firefox, I don’t experience the spin-up-spin-down as often as I remember in previous Live CD usage. I think Feisty must also do a good job of caching programs in RAM when you first access them because I hardly ever hear the CD drive spin up unless I’m starting a new program.

The other nice thing is that the laptop fan almost never turns on. The old hard drive ran somewhat noisy and warm, causing the fan system to kick on about 75% of the time. I’ve really enjoyed the cool, quiet performance of running on a Live CD. The laptop is absolutely silent.

The only real obstacle I’ve faced is that I can’t shutdown my laptop unless I want to spend time re-setting up my Thunderbird profile and re-installing Firefox extensions. I guess you can’t have everything.

Why not switch completely?

If this setup works so well, I thought to myself, why not just switch to always using a Live CD and save $60 on a new hard drive? After thinking about it, I’ve decided that I would be willing to switch if a few conditions were met:

  1. A decent amount of persistent storage were possible
  2. I could install updates and new software without losing them each time I reboot
  3. Most or all of the OS could be loaded in RAM at boot

I could probably accomplish #1 with a USB drive and a persistent home directory. I think #2 would be harder with the USB drive - like what happens when you move between systems with the same flash drive - but still possible. In the end, I think I would be happiest by buying a Compact Flash to IDE adapter and a large (16GB or more) Compact Flash card. These are nice because you get the cool, quiet operation and persistent operation. I considered doing this instead of getting a new hard drive, but in the end I figured I would get much more storage but the price (80GB @ $60 or 16GB @ $150 or more). In the future I think many laptop hard drives will be completely flash based memory.

As for #3, I wish that Ubuntu Feisty had the ability to use the “toram” kernel boot option and load the OS into RAM during boot. I’ve done this with Knoppix CDs in the past. The speed increase is amazing. Granted, less RAM is available for program execution, but RAM is cheap enough these days that the productivity gain is worth the extra couple of dollars.

All in all, I give the Ubuntu Feisty Linux Live CD a surprisingly high thumbs up for everyday use.

linux

Comments (0)

Permalink

Use OpenDNS for faster and more secure browsing

I ran across opendns.org the other day and decided to try it.

There was a definite speed boost! I have Verizon FIOS and the OpenDNS servers are more responsive than Verizon’s DNS servers. I’ve noticed that most pages now load in about 3/4 of a second (time to look up the DNS name, fetch the page, and render it). I use fasterfox to time it.

OpenDNS also provides some interesting reports. You can turn off the DNS logs if you like (privacy and all), but I found them useful. I have a cron job that runs every 5 minutes and fetches my mail via POP and mails it to another account. The cron job had done over 24,000 DNS lookups of the same IP address in the last 8 days. My router is supposed to be caching those requests (isn’t that why you run local DNS?), but its easy to see that caching is not happening.

Also, OpenDNS gives you the ability to block domains, and automatically will block phishing and pornographic sites if you want. This can be pretty useful, for kid-safe and normal-user-safe browsing.

I’ve been pretty happy with using the service so far - especially since it is free. The only thing I’ve noticed is that I haven’t seen any *nix update clients. Anyone found one that they like?

Update: here are some screenshots from their interface

Recent Activity

Recent Activity

Unique Domains

Unique Domains

Top Domains

Top Domains

Sample blocked domain

Blocked domain

fios
linux
network

Comments (2)

Permalink

Automatic updates in Debian Linux (etch)

UPDATE: I found a better way to do this

I have half a dozen Debian Linux boxes in various places that I administer. Some are file servers, some are meant to do rsync backups, and some have lost their purpose and I simply keep them around because they are on a fast Internet connection. These are not critical in any way, but they are often useful to have around as an entry point into a network or to host some simple service.

I’ve searched the Internet for a good way to keep these boxes up to date without having to administer them all the time. After all, I don’t want to SSH to n boxes once a week (or more) just to run apt-get update && apt-get upgrade. And what if some critical hole is found in SSH and I can’t patch the box in a reasonable time? Or, more likely, what if I just don’t hear about the critical hole and the box gets exploited days later?

Most Debian administrators seem to think that using a tool like cron-apt is the best way to go about things. Cron-apt downloads all available updates and sticks them in apt’s cache, but does not install them. This does make it quicker to manually update since the packages are already present on the system. If I administered these boxes for a living, I would be plenty happy with the way that cron-apt downloads the packages and sends you an email when new packages are ready to install. But since I want the minimal fuss, I chose a different way.

Ideally, Debian would have a tool that did something similar to Synaptic’s GUI interface.

Synaptic Auto Update

This automatically installs security updates and leaves the rest to the user. I’m not quite sure what mechanisms it uses, but I’ve used this shell script to accomplish the same thing for over a year.

#!/bin/sh
/bin/date >> /root/autoupdate
/usr/bin/apt-get update >> /root/autoupdate
/usr/bin/apt-get upgrade -y -t security >> /root/autoupdate
/usr/bin/apt-get autoclean

I drop this script into /etc/cron.daily/autoupdate and forget about it. It logs all actions it takes to /root/autoupdate, so I can look back and see what has automatically been installed. It also only installs security updates, although I usually leave off the “-t security” part and let it install everything. In my experience, the stable version of Debian (currently etch) has very few updates that break anything, especially if you haven’t customized your configuration files heavily. I’ve been running this script in several places over the last year and each box will generally install everything except for kernel upgrades, since they usually require a reboot.

A lot of Debian administrators are nay-sayers to this type of approach. This is probably because they’ve seen many a non-stable distribution break horribly with something like this. If this were a production level box with many users depending on it, I’d also take the approach of manually installing updates. But when I actually want to do something else with my life than manually run apt-get on boxes I occasionally use, this is the perfect solution.

linux

Comments (1)

Permalink

Simple network uptime test

Trying to troubleshoot an intermittent network problem? Just want to know if you ISP is dropping packets or going down altogether?

So many times I’ve search the ‘net for a simple network uptime script. I always wanted to know the exact time the network went down (and came back up) so that I could track down the cause of the problem. Here is a dead-simple script that will do just that:

#!/bin/bash
## connect_test.sh ##
## This script continually pings an IP address / hostname and reports *only*
## when it is unable to reach the destination.
##
## Example: ./connect_test.sh www.google.com
 
if [[ $1 == "" ]];
then
        echo "Please provide an IP/host to ping"
        exit
fi
 
while [ true ]; do
        p=`ping -c 4 $1 > /dev/null 2>&1`
        if [[ $? != 0 ]];
        then
                d=`date`
                echo "Unable to reach $1 at $d"
                sleep 1
        fi
done

It works best if you open up multiple terminal windows and try to connect to different portions of your network simultaneously. For example:

./connect_test.sh [my neighboring workstation]
./connect_test.sh [my gateway]
./connect_test.sh [my ISPs DNS]
./connect_test.sh [random domain - ie. google.com or yahoo.com]

This way, you can determine exactly where the failure is AND you have a record of the time it occurred. Hope that helps!

linux
network

Comments (0)

Permalink

Advantages of being a WINE developer

I’ve often thought that it would be neat to contribute to a high-profile open source project. You know, something like Joomla that plans to solve all the world’s problems. I recently learned that contributing to the WINE project is just what I needed.

For the uninformed, WINE is a project that allows Microsoft Windows programs to be run in Linux. It sounds like a lofty goal - and it is - but sometimes its actually quite useful. For example, I once had to contribute changes to a Word document that had all kinds of complex formatting - and OpenOffice couldn’t handle it. To be fair, OpenOffice could open it fine, but the formatting was inconsistent with what is normally displayed in Word and basically corrupted the layout for anyone that viewed the document later. Long story short, I had no choice but to edit the document with Word, running Windows XP. In true Microsoft fashion, Word running on Windows XP did crash several times before I was able to finish my edits to the document. While I wasn’t sure whether to blame Microsoft or my professor for creating that extra-complex document layout, I do know I was yearning to experience those kind of program crashes while running my operating system of choice!

WINE let me do just that. Word 2000 actually runs quite well using WINE on Linux. I don’t think the newer versions have the same success though.

More to the point, WINE can run any Windows executable. It may not be perfect, but you have to thank the WINE developers for trying:

Yes, No, Cancel?

This is a picture of the free product Personal Ancestral File available from familysearch.org. It helps you keep track of your ancestors. What it wants me to do now is anyone’s guess, but it should be clear to you why I want to be a WINE developer. I want the privilege of saying “You won’t believe the fun I had today….”

linux
wine

Comments (0)

Permalink

First post on blog.layer2.org

Welcome to my new WordPress blog! This is the site I’m planning on using to write about my thoughts and experiences with technology and other aspects of life. I plan on writing a lot about Ruby, Linux, computer networking and other things. Hope you enjoy reading!

linux

Comments (0)

Permalink