PDA

View Full Version : Instructions: Dual booting Poor Man/Win2k using GRUB



Jansi
02-02-2005, 07:17 PM
Hi people -- because of problems with LILO on the current release of KNOPPIX (3.7), I was finally inspired to delve in to GRUB... needless to say, I am no expert on GRUB (or anything Linux/KNOPPIX for that matter!). But for the people like me who simply want to be able to boot a "Poor Man's Installation" from an old windows workhorse, I decided to clean-up the (very explicit) outline I wrote for my own use and share it with you. I've tested the general procedure on several computers -- but so far I've only on one true Win2k installation like I describe below (my own home one -- the other 3 computers I tested it on in the past 2 days were trashed old ones with no OS on them - these instructions worked with very minimal simplifying). I am going to try it on another Windows installation this afternoon I hope, with a friend's permission. Eventually, when I clean this up, I'm thinking this should go in the docs right above this:
http://www.knoppix.net/wiki/Hd_Based_HowTo#1.2.1._Knoppix_3.4_version_only
I've been using those for some time, well over a dozen times on computers for public kiosk use among other things (thanks, RD! And Marcus for reformatting it) -- but it is starting to be problematic that those instructions don't really apply past 3.4 anymore for me without a bunch of LILO fussiness. Mine apply to at least 3.7, and I'd guess everything since 3.4.

Incidentally, part of the reason I like the "Poor Man's Installation" (besides its iron-clad public kiosk suitability) is that lately whenever a friend or family member with DSL asks me to "fix their computer" I do, but lately my "price" is that they get a dual-boot Poor Man's Install of KNOPPIX! They could care less -- their computer gets fixed, and as the only new feature is that their computer pauses for 5 seconds at the LILO screen... and when I point out to them that they can do all the browsing, emailing, chatting, printing, word-processing, etc., in KNOPPIX -- but without the incessant spyware and virus problems and subtle "dues to Microsoft" -- their interest is piqued. In one case where the visiting neighborhood kids were trashing the Windows installation on a monthly basis, LILO defaults to KNOPPIX, and the family only boots to windows to run educational software they bought for their own kids! (Hey, I tried getting wine to run 'em).

Anyway, here is what I have so-far, more-or-less formatted. If there are any glaring errors (like in my GRUB invocation) or clearly unneeded steps, feel free to respond to this thread.

============================


Dual Booting Win2k and "KNOPPIX tohd=" installation (aka "Poor Man's Install") using GRUB:


Introduction
For me, GRUB has significant advantages over LILO for a Poor Man’s install, because GRUB allows the user to change boot options merely by editing a text file, without LILO’s requirement to rewrite the MBR each time a change is made. GRUB also allows you to experiment with different options at boot time, and helps debug a configuration that isn’t working.

Below are the steps I took to make a Poor Man’s installation of KNOPPIX dual-bootable with a pre-existing Win2k installation. The instructions assume thatyour computer has one hard drive setup as one big partition formatted in FAT32, with Win2k installed. If that isn't the case with your computer, you'll need to improvise. I know the below works because I did my computer as I typed the draft of this document.
Know that GRUB (like LILO) will be installed on the MBR of your hard drive, so if you are afraid of losing whatever is on there now, you might want to back-up the MBR (google "dd if=/dev/hda of=/dev/fd0 bs=512 count=1"). And I'd also strongly suggest backing up anything else in your Win2k installation you can't live without.

Overview
To do a "Poor Man's Install" of KNOPPIX on a computer with Win2k installed, I chose to divide my hard drive in to 4 partitions, like this:

hda1 -- FAT32, ~8 gig. This will hold the Win2k installation and also the KNOPPIX image. Know that you will need at least an extra gig over your Win2k needs to hold the KNOPPIX image; beyond that, I generally want this to be "the big partition", since ultimately it can be storage for both Win2k and Linux.
hda2 -- ext2, ~1 gig. This will hold the KNOPPIX persistent home directory (a gig or so is fine for me)
hda3 -- ext2, ~32 meg. This will hold the KNOPPIX and GRUB boot files, plus the KNOPPIX config file (if you want one).
hda4 -- Linux swap, ~500 meg. will be my Linux swap file. It should be at least 256 meg, IMO


Since the Win2k installation was on one partition that filled the entire drive, I needed to repartition the drive to make room for the other 3 partitions. [NOTE: if you won't be having a second OS on the drive, then just use cfdisk to delete all partitions, the set them to the above partition and formatting specs, and ignore parts below pertaining to Windows]

Procedure (or "How I Did It"):
- The goal for me was to squeeze the FAT32 partition (hda1) with Windows on it in order to fit three more partitions on my drive. To squeeze hda1, I used the linux tool QTParted. Just boot the KNOPPIX CD and type "sudo qtparted &" at a terminal window. With QTParted open, simply slide the right-edge of the Windows partition to give the one or two gigs needed for hda2, hda3, hda4. Remember to leave enough room on hda1 (about 1 gig) for your KNOPPIX image.

- After you press “Commit”, you must completely shut down the computer - type “sudo shutdown -h now" in the term.
- Boot the computer from KNOPPIX CD, at KNOPPIX splash screen prompt type:
knoppix 2 noswap [and anything else you need to get your particular computer booted, like "nodma", etc.]

- Once booted to the command prompt ("root@tty1[/]#"), type "cfdisk"

- From within cfdisk: create 3 partitions out of the free space in accordance with the guidelines in "Overview." For the last partition (hda4), select type "Linux swap" (type 82). The other two should already be type "Linux" by default. Be sure not to alter the first partition. If you make any mistakes in cfdisk, press "Q" to quit without making changes. When you are sure everything is as-you-want-it, use the arrow keys to select "Write" to finalize the partitions, then quit cfdisk and completely shut down the computer ("shutdown -h now" at the root prompt).

- Boot again from the KNOPPIX CD, but this time with the options "knoppix 2 tohd=/dev/hda1"

- Once booted to the root prompt (which will take a while as the CD is copied to hda1), type the following commands:


mkfs /dev/hda2
mkfs /dev/hda3
mount /dev/hda3 /mnt/hda3
cd /mnt/hda3
cp /boot/* .
cp /mnt/cdrom/boot/isolinux/minirt24.gz .
mkdir grub
mount /dev/hda3 /boot
cd /boot/grub
emacs menu.lst


- In emacs, enter these lines:


default=1
timeout=20
#splashimage=(hd0,2)/grub/hello.xpm.gz

title Win
rootnoverify (hd0,0)
chainloader +1

title Knoppix
kernel (hd0,2)/vmlinuz fromhd=/dev/hda1 lang=en apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi
initrd (hd0,2)/minirt24.gz
boot


- Save the file (Ctrl-x Ctrl-s) and exit (Ctrl-x Ctrl-c). At the prompt type:

grub-install hd0

Grub will probably spit-out a lot of non-critical errors (at least I see them - should I do something different?), and it might take a few seconds (looking like it is frozen). But importantly, at the end of all the all the messages you should see "Installation finished. No error reported."

- Now type

shutdown -r now

- Remember to eject the KNOPPIX CD, then hit Enter to let the computer reboot from the new installation. BTW, running "grub-install hd0" was the point where overwrote your old MBR. And while it probably spit-out a lot of non-critical errors, don't worry. Mine did that to, but worked just fine.

- If you did everything according to the steps, KNOPPIX should boot completely. Once booted, set-up your network info, printers, desktop, screensaver, and anything else you might want, then save your KNOPPIX configuration to /dev/hda3. Next create a persistent home directory in /dev/hda2. Both of the latter steps can be done under the KNOPPIX menu entry “Configure”

- Next you need to edit menu.lst to tell the KNOPPIX kernel about your new persistent home directory and saved configuration. My way: open a term and type:

su
mount /dev/hda3 /mnt/hda3
emacs /mnt/hda3/grub/menu.lst &


- In emacs, add "home=/dev/hda2" and "myconfig=/dev/hda3" to the kernel line. And if you want WIndows to be the default boot, change the "default=1" to "default=0"

Here is my entire menu.lst file as an example:


default=0
timeout=20
#splashimage=(hd0,2)/grub/hello.xpm.gz

title Win
rootnoverify (hd0,0)
chainloader +1

title Knoppix
kernel (hd0,2)/vmlinuz fromhd=/dev/hda1 home=/dev/hda2 config=/dev/hda3 \
lang=en apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi \
hdf=scsi hdg=scsi hdh=scsi
initrd (hd0,2)/minirt24.gz
boot


- Save the file and exit emacs and reboot. You are done.

Jansi
02-03-2005, 08:31 PM
After some experimentation on a couple more computers, I think these are better instructions because they use fewer partitions, don't mix KNOPPIX with the Windows partition at all, and can live happily alongside NTFS. But I'll leave the others just in case...

=======================================

Making your Windows installation dual-bootable with a "KNOPPIX tohd=" installation (aka "Poor Man's Install") using GRUB:


Introduction
Below are the steps I took to make several Windows computers (Win2k on NTFS, Win98 and WinME on FAT32) dual-bootable with a Poor Man's installation of KNOPPIX. These instructions assume that your hard drive is setup as one big partition with Windows already installed.

Do be aware that GRUB (like LILO) will be erase whatever you currently have installed on your hard drive's MBR, so if you are afraid of losing whatever is on there now, you might want to back-up the MBR (google "dd if=/dev/hda of=/dev/fd0 bs=512 count=1"). And I'd also strongly suggest backing up anything else in your Windows installation you can't live without.

Procedure:

The biggest job is shrinking the size of the Windows FAT32 partition (hda1) in order to make room for the two new partitions that KNOPPIX will need.

These are the guidelines I used for setting up the partitions:


hda1 -- Format: FAT32 Size: This will hold your entire Win2k installation, so keep it as big as you need for Windows. Remember: it can hold your Linux data too. So keep it "the big partition."
hda2 -- Format: ext2, Size >=1.2 gig. This will hold the KNOPPIX boot image, KNOPPIX boot file, GRUB files, persistent home directory, and the KNOPPIX saved configuration file if you want one.
hda3 -- Linux swap, >256 meg. No mystery there.



To get my drive to look like that, I used the linux tool QTParted, following these steps:

- Boot your computer from the KNOPPIX CD (preferably with the "noswap" option)

- Open a terminal window and type "sudo qtparted &"

- When QTParted opens, select /dev/hda in the upper-left pane. In a little while, the upper-right pane with a diagram of hda1 should appear.

- In the upper-right pane, right-click hda1 and select "Resize." Then slide the right-edge of the hda1 partition to the left just enough to get the >=1.2 gigs needed to make hda2 and hda3.

- When the free space (gray area) shows up in the right-pane, right-click in it and select "Create." Set the type to "ext2" and the size to >= 950 meg.

- Next right-click in the last remaining free space in the pane, and set all of it to type "Linux Swap."

- Select "Commit" from the Device menu.

- Completely shut down the computer ("sudo shutdown -h now"), leaving the disk in the computer.

- When the computer has completely shutdown, restart the computer and boot normally from the KNOPPIX CD.

- Once fully booted, go under the KNOPPIX menu "Configure" entry and select "Create a persistent KNOPPIX home directory." When prompted, select "/dev/hda2", whole partition, no encryption.

- Open a terminal and type the following:

su
mount /dev/hda2 /mnt/hda2
cd /mnt/hda2/
mkdir boot
cd boot
cp /boot/* .
cp /mnt/cdrom/boot/isolinux/minirt24.gz .
cd ..
mkdir grub
mount /dev/hda2 /boot
cd /boot/grub
emacs menu.lst &


- In emacs, enter these lines:


default=1
timeout=20
#splashimage=(hd0,1)/grub/hello.xpm.gz

title Win
rootnoverify (hd0,0)
chainloader +1

title Knoppix
kernel (hd0,1)/boot/vmlinuz fromhd=/dev/hda2 home=/dev/hda2 myconfig=/dev/hda2 lang=en apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi
initrd (hd0,1)/boot/minirt24.gz
boot


- Save the file (Ctrl-x Ctrl-s) and exit (Ctrl-x Ctrl-c). At the prompt type:

grub-install hd0

Grub sometimes spits-out a lot of non-critical errors (at least I sometimes see them with certain machines), and it might act frozen for a spell. But it has always worked so far for me. Importantly, at the end of all the all the messages you should see "Installation finished. No error reported."

- Now type

shutdown -r now

- Boot again from the KNOPPIX CD, but this time type with this option at the splashscreen to copy the KNOPPIX image to hda2:

knoppix tohd=/dev/hda2

- When KNOPPIX is completely booted, set-up your network card, printers, desktop, screensaver, passwords, clock, .kde/Autostart scripts, and anything else you might want persistent, then save your KNOPPIX configuration to /dev/hda2 via "Configure" under the KNOPPIX menu.

- Take the CD out. You are done.