winter's computers
found, loved, and nurtured for spring
my ugly geek secret

Saturday, July 14, 2007

installing xubuntu linux on libretto

Got a comment from Sully2 about libretto, wanting to know details of how I set up Xubuntu without a CD-ROM drive.

Funny you should ask, Sully, as just this week I started looking into a different version of Linux to load onto libretto. All my apps work well, but it takes ages for them to load (even with prelinking) and to switch between them. Feisty might be better than Dapper for this, but you might want to consider something like DSL (Damn Small Linux). That's what I'm looking at now.

Last week I even compiled my own kernel for it, but I couldn't find much to tweak and I didn't notice any speed improvement. One thing I noticed though is that it looks like everything that's not compiled into the stock Xubuntu kernel is set up as a module, which would explain why (X)Ubuntu has such great hardware compatibility. I think this also means that you can take a shortcut to install Feisty on your Libretto, if you still think you want to.

If you know nothing about Linux then I really recommend that you not attempt this, Sully, especially if you want to keep Windows. Ubuntu and it's derivatives are dead simple to install on most PCs and laptops, but the Libretto is a special case even if you have the CD-ROM drive and PCMCIA adapter. If I had detailed, step-by-step instructions for you then it wouldn't be too risky, but I didn't take notes so much of this will be vague.

You need a second laptop that works with the Libretto hard drive, or a PC with a laptop hard drive adapter. To avoid problems like modifying the wrong hard drive, the Libretto hard drive should be the only one in this other laptop/PC and you'll do all the work from the Ubuntu LiveCD.

Before removing the hard drive from the Libretto, defrag the Windows partition. Then, from the other laptop/PC , resize it with parted (see http://www.gnu.org/software/parted/manual/parted.html) or Ghost or Partition Magic or something to make room for Linux. This is assuming the hard drive is big enough to hold both OSes.

Leave room on the hard drive for the hibernation data. I marked the empty space (which DOS can't see but Linux can — don't know about Windows) as a special partition, but unless you want to use an extended partition you can just write down the details of where the hibernation space starts (if the drive is larger than — I think — 8GB, the hibernation space won't be at the end; it should be the size of your RAM plus video memory plus some overhead, but 100MB should cover it).

As mentioned above, there might be a simple way to install Xubuntu from this point: now that there's space on the hard drive, you could try just installing Xubuntu on the other laptop/PC. This would be straight forward, and when you're done you should be able to just move the hard drive back into the Libretto. Like I mentioned, it looks like everything's either included in the kernel or installed as modules, so it should work no matter what laptop or PC you put the hard drive in.

But I haven't tried that so I can't say for sure that it will work. So continuing with how I did it:

Copy an image of the Ubuntu install CD onto a 700MB temporary partition on the hard drive (right before the hibernation space); that is, there will be no filesystem on the partition and you'll have to use the dd command to copy the raw bytes from the CD directly to the partition (see https://help.ubuntu.com/community/Installation/FromHardDriveWithFloppies).

Setup another partition to run the install from. I seem to recall I was able to install Xubuntu onto this partition as well, so make it big (but try to leave room for a swap partition; I would put the swap partition right after the Windows partition, followed by the Xubuntu partition, followed by the hibernation space).

Copy vmlinuz and initrd.gz from the install folder on the CD to the root of the install partition.

Install Grub onto the hard drive's MBR; you can check https://help.ubuntu.com/community/GrubHowto/BootFloppy (step 4 in particular, substituting your hard drive for the floppy) but you probably just need the setup command.

Move the hard drive back into the Libretto and boot it.

At the Grub prompt, enter this (from https://help.ubuntu.com/community/Installation/FromHardDriveWithFloppies):

root (hd0,0)
kernel /vmlinuz append vga=normal initrd=/initrd.gz ramdisk_size=16384 root=/dev/rd/0 rw --
initrd /initrd.gz
boot

(that should be four lines, one each starting root, kernel, initrd, and boot)

... substituting your install partition for hd0,0 (where hd0 is the first hard drive and hd0,0 is the first partition on the first hard drive).

When asked to install modules from a disk, say no and specify the temporary partition you copied the CD to.

If everything goes well, Xubuntu will now install. If it has trouble booting (because you already installed Grub, above) you can use the LiveCD to do a repair and fix Grub.

When it works to your satisfaction, put the hard drive back in the other laptop/PC, boot from the Ubuntu LiveCD again, and use parted to remove the temporary 700MB partition and resize the install partition over it (be careful not to resize it into the hibernation space).

If something goes horribly wrong you may have to reinstall Windows, but I seem to recall that Win95 and/or Win98 required that you insert the CD during the install, which of course is impossible if you don't have the CD-ROM drive or PCMCIA adapter card. Something to keep in mind.