PDA

View Full Version : Knoppix-installer w/no bootloader???



The Fader
01-20-2004, 05:38 PM
Having successfully installed Knoppix using kpx-install, I decided to try an install with knoppix-installer.

Well, everything went well until I came to the bootloader screen. No matter what I tried, i couldn't get to allow me to simply install none and make a bootdisk.

Where am I going wrong? Last time I tried Linux, I had a lot of trouble wiht Wxx after using LILO (GRUB worked better). This time, I want *nothing* done to my Wxx drive; Linux is on a completely different HDD and I want to keep it that way until I can get rid of Redmond for good (my wife is terrified of change :-)

Any suggestions?

TIA/Fader

spamhog
01-23-2004, 01:50 PM
Do you have an expendable install on a secondary PC? There's a couple of scary things I learned by trying them slowly and carefully on actively used machines that I could have learned much faster on a test computer. Other than the usual scarecrow(d) called partitioning, also backing up and restoring the Master Boot Record is a very useful trick to learn. NOT INDISPENSIBLE, but it gives you peace of mind.

Basically,

- the info that tells the OS where and what type the partitions are and what is the "partition table", which is in bytes 447-512 of the 1st sector of a HD

- the executable code called bootloader (or boot manager, or boot selector, if designed to boot MORE THAN ONE operating system), is in the first 446 bytes of the same sector

- however, if an OS can boot from other that the 1st partition of the HD, the bootloader can be injected in the 1st sector of the partition it's intended to boot.

Debian uses lilo by default, and (normally) gives you the option to install it in the MBR or in the boot sector of the Debian partition. You say you can't do that, and also that you don't want to mess the MBR as it is now.

With Windows 9x, messing with the MBR is not usually a problem, as you can restore the original MBR by booting with a floppy, go to C:\, and issue the command

fdisk /mbr

or something similar

The alternative trick, easily done in Knoppix, is to back up the MBR.

You need to mount a floppy or your Windows partition (man mount) and use dd (man dd) and copy the MBR onto a file there. You do NOT need to mount the 1st partition to copy / restore the MBR of that HD - you only need to have the device mounted read-write IF YOU WANT TO READ THE BACKUP FILE FROM / WRITE THE BACKUP FILE ON IT.

I assume your floppy is /dev/fd0 (mounted on /mnt/floppy) and your HD is /dev/hda.
MBR-backup is the filename of the backup.

The dd commands I use are these:

to back up:
dd if=/dev/hda of=/mnt/floppy/MBR-backup bs=512 count=1

to restore:
dd if=/mnt/floppy/MBR-backup of=/dev/hda bs=512 count=1

If I want to leave the partition table alone, I use bs=446 instead, as the partiton table is in the last 66 bytes of the MBR.

I think something similar can be done with a bootloader that is in the boot sector of a single partition (/dev/hda3 for example) but I'm not so sure.

Backing up the MBR is the first thing I do BEFORE and AFTER an install. I give the various backups descriptive names, of course!

One word of caution re. Knoppix:
If you boot the live CD, you have read/write access only to a temporary file system in RAM. If you are not careful in REALLY mounting the device you want to write to in read/write mode, you risk making a nice backup into ****RAM****, and you know what will happen to it once you shutdown!

For example, if you create the directory /mnt/bogus, and you THINK you have mounted say /dev/hda1 (Windows partition) on /mnt/bogus but you have not, if you do
dd if=/dev/hda of=/mnt/bogus/MBR-backup bs=512 count=1
the data will end up in RAM, not in C:\MBR-backup. Endless fun! :-)

Once you do the dd it's a good idea to unmount /dev/hda1, check that the file has disappeared from /mnt/bogus, then (if u're anal retentive) remount and see if it has reappeared.

That's why I advocate getting a cheap PC for trying out weird stuff. Just bef. Xmas I got my self a nice 130-Euro Piii-500MHz-128MB-8GB, which is now my official guinea pig, and will become my home server one day.