Category: Linux

Testdisk saved my Ubuntu bacon

Last week I got my Dell D820 running Windows XP set up to be dual-booted to Ubuntu. I used Ubuntu 5.10 (Breezy Badger) because that’s what I had handy. I was following Mathew J. Miller’s excellent instructions on how to do it.

My only problem came when it was time to install the boot loader. I had forgotten (or chose to ignore) the little partition that Dell puts on their hard drives. That meant that my Linux partition was actually number 2 (the third partition) instead of partition number 1 (the second partition) which is, unfortunately, where I told it to put the boot loader. Partition number 1 is my Windows XP partition–exactly where I did not want the boot loader written to.

And neither did Windows XP. On restart I got the dreaded “Missing operating system” error. “Thanks for the new laptop. Look what I did!”

I had used the Ubuntu Live CD to run QTParted to successfully partition my hard drive so I thought it might be able to get me out of the jam. But after the erroneous boot record write, QTParted didn’t want to have anything to do with that partition. It just threw up its hands.

I booted to the Windows XP Recovery Console and ran fixmbr as well as fixboot but neither of those were effective.

Fortunately, for times like these, there’s testdisk. Testdisk is a wonderful little utility freely-available under the GPL that can recover Windows, Mac, and Linux partitions. I booted into my Ubuntu Live CD, used apt-get to install testdisk (sudo apt-get install testdisk) and fired it up. I then disabled the “bootable” flag on the Linux partition and made my Windows XP partition bootable-primary. When I restarted, Windows XP was alive and well again.

I thought about leaving well enough alone–I was leaving for a client site the next day–but my success bolstered my partition recovery confidence. I formatted the Linux partition and re-did the Ubuntu install paying closer attention to the boot loader step. That time everything went off without a hitch.

I’m still getting used to Ubuntu. It’s a bit different than RHEL but overall I think it’s going to work out.

My LAMP VMWare image is rocking

Everything’s working great on my LAMP VMWare image. This evening I went through the IBM LAMP Tutorial. The good news is it doesn’t take too long to whip through it (about half an hour). The bad news, at least for those that lack previous programming knowledge, is that the examples are really sloppy. It’s better to follow the tutorial as a rough guide and then do your own thing than try to follow it verbatim. You would think someone would have worked through the tutorial before they put it online.

I’m definitely ready for some beefier examples. After playing with it for a few hours, I can see the attraction to PHP over the other “P” languages, at least for working with web applications. Having all of the presentation and business logic intermingled kind of makes me feel dirty, though. Hopefully, there’s a way to separate the two.

LAMP progress

Got PHP compiled and smoke tested last night. After the initial make/compile, the mod_php5.so library didn’t get compiled and my apache config file, httpd.conf, didn’t get updated with the LoadModule/AddModule entry. So I re-ran the make/compile and it worked. Weird. This weekend I’ll test the whole LAMP setup together.

Revisiting book: Setting Up Lamp

I’m re-visiting a book I got a while back called Setting Up Lamp: Getting Linux, Apache, MySQL, and PHP Working Together, by Eric Rosebrock, et al. The book serves as a nice punch list for getting everything installed and configured.

Anyway, per the recommendation in the book I was removing Apache from my Linux install so I could manually compile and install Apache 1.3 and I couldn’t get past the make step. It was complaining that it couldn’t find some statically linked shared objects. I tracked it down to a problem with libdl.so.2. I thought maybe my glibc or gcc install was bad or maybe I got over zealous in my removal of Apache and some of the packages that depend on it.

As it turned out, I had some broken links in my /usr/lib caused (I think) a while back when I had to relocate /usr/lib to a different mount point. As soon as I fixed the broken links the compile worked like a charm.

Bugzilla up-and-running

I got Bugzilla installed locally over the weekend. It was pretty straightforward, especially with this great step-by-step doc, although I had problems getting Apache to compile the Bugzilla Home Page(index.cgi) page. As it turned out, when I gave my Apache account rights to the Bugzilla directory, I had neglected to tell Windows to propogate those rights to all sub-directories. That kept Perl from finding the bugzilla/Constants.pm file.

My goal was to compare Bugzilla to Scarab. Unfortunately, I didn’t thoroughly RTFM before I upgraded my local MySQL installation. Apparently Scarab is picky about only running on MySQL 4.0.x. Now I’ve either got to revert to the old version if I want to take a look at Scarab but I may skip it.

Samba Success

My frustration level with Samba on my VMWare Linux guest OS had reached the tipping point last night when I finally had a breakthrough.

Installing the samba-client and samba-swat packages helped a bit. I used samba-client to validate that my Linux box could connect to its own shares. I used samba-swat to validate my config and get context-sensitive help on some of the smb.conf parameters.

But my Windows host OS still couldn’t see the linux shares. The host and guest could ping each other so I knew I had a base level of connectivity. Then I noticed that my Windows box couldn’t telnet to the Linux guest. That’s when I started suspecting a firewall problem on the Linux box.

I fired up the security level configuration dialog in Gnome and noticed that “eth0” was not a trusted device. As soon as I checked the box to make eth0 trusted I was able to map the shares to the host Windows box.

Linux learnings

I made progress on my Linux install a few nights ago. I had run out of space on my VMware disk image I originally created for Linux so I “grew” it using one of the VMware utilities. But, I never figured out how to get Linux to recognize that the hard disk could go beyond the original 3GB that I allocated it. So, instead, I just added a new virtual disk. Then, using parted and fdisk, I figured out how to create a file system on that new disk.
Then I created a directory and mounted that to the new disk. Next, I moved my /usr, /home, and /opt directories to the new directory/disk and created symbolic links to point there.
Below are some learning points…
1. I need to study up on mount points
It hadn’t clicked with me that if you mount a file system like /dev/sdb1 to /opt as well as /usr, you are pointing to the exact same thing. Obviously, that’s not what I wanted. I either needed to create separate file systems for each of those or what I ended up doing which is to create a higher level directory (I called it /vol2 for no good reason) and then put opt, usr, and home inside that with symbolic links from root pointing to those. I have a sneaking suspicion that the “right” way for me to create that directory was to put it under /mnt instead of the root, but I’ll fix it later.
2. Always RTFM
Even though it reminds you to do so in parted/fdisk, I neglected to update /etc/fstab with the new mount so when I restarted, it obviously couldn’t find any of my relocated volumes.
3. tar is your friend
I learned how to use tar to move files with the directories and permissions intact. I obviously could have used mv but I wanted to keep the old stuff around in case something tanked. For future reference it is: tar cvf – *|(cd /somedir; tar xpf – )
4. VMware networking modes really do work
I can now successfully switch between “bridged” and “nat” network mode in VMware. The trick is to remember to run /etc/config/network-scripts/ifdown eth0, ifup eth0 after reconfig’ing the network in VMware. Moving to NAT lets me VPN to Navigator on XP and then leverage that connection from my Linux image.
5. Living without the Microsoft OS is actually within reach
There is now seemingly no need for me to run X-Win32 on my machine. I can just use Linux all of the time. In fact, if Open Office lives up to expectation, and if I get Firefox installed plus my other dev tools, the *only* reason to use XP during a day is for web sites that require MSIE, for MS Office incompatibilities, or to use software that doesn’t yet run on Linux. I know there are bridging technologies that would allow me to clear even those hurdles but I’m not ready for that yet.
6. Living in emacs for the past few weeks is paying off.
Emacs is OOTB with RedHat Enterprise Linux WS 3 so I can use it for all of my editing in both Linux and XP. Another great tool that comes pre-installed is The Gimp. I haven’t had to do enough graphics editing lately to be completely comfortable with it but it’s there if I need it.
7. Moving files between the host XP OS and guest Linux OS is easy–provided vmware tools is config’d
I need to reinstall “VMware Tools” so I can move files between XP and my Linux image using the “shared folders” feature. I’ve got it enabled but it isn’t working. I think I need to re-run the install and possible re-compile it.
8. Maybe moving my /usr directory wasn’t such a great idea
After I ran up2date to get all of the latest fixes for the OS, my X stopped working. I thought it had to do with a newer version of XFree86 and an incompatibility in the VMware video driver. Today I realized that either the update or my relocating of the /usr directory fouled up some links. Once I fixed them, I was able to start up without any problems. For future reference, you can use symlinks to find broken links. An example searching recursively from root is: symlinks -r / | grep ^dangling
9. Back in business with Ant and Cocoon on Linux
I finally got Cocoon to build. Way back when I first installed Linux I tried to get Cocoon to build so I could try out some of my Documentum-Cocoon integration components but I couldn’t get Ant to run. All path and classpath variables were seemingly correct but Ant couldn’t find its launcher class. This evening I realized that there’s an ant.conf file in /etc. The file declares an ANT_HOME which overrides the ANT_HOME set in the profile. As soon as I commented that out ant started working and the build worked great (and about 25% faster than the build on my host XP OS).
I think I’m damn close to doing a “live in Linux” experiment. Too bad Radio Userland doesn’t have a Linux distro. I suppose I could enable the “remote posting” feature and hit it via the network between my Linux OS and XP.