Subject: Bug#3722: kernel-image uses stale LILO script, over-writes MBR

From: [email-masked] (Bruce Perens)
Date: Sun, 7 Jul 96 15:11 PDT

Package: kernel-package

I figured out what happened to Christoph Lameter's MBR:

The LILO configuration script used in the kernel-image postinst is stale.
It needs to be updated from the latest LILO postinst script. The major
change is that the new LILO script writes a partition boot record and
(if you approve) instals our "mbr" program on the MBR. The older one just
overwrites the MBR with LILO, and we should be more polite.

	Bruce
--
                       Re-Elect Clinton/Gore '96

Bruce Perens AB6YM          [email-masked]            http://www.hams.com/

---

From: Manoj Srivastava <[email-masked]>
Date: 16 Jul 1996 02:42:12 -0400

Hi,

	Hmm, I was just looking at the image postinst, and this is
 what it does.
 A)         If a /etc/lilo.conf exists, ask the user if that is to be used, 
            and run lilo, exit.  
   A1)      If user says don't use lilo.conf, ask if it is to be
            wiped, if so, mv it to lilo.conf.OLD, and proceed to B,
            else leave it in place and exit.
B)          Look through /etc/fstab, hunting for 
    1)      The partition root (/) lives on, (this is the "root"
            partition), and
    2)      A lilo "boot" partition. If none is found, then the boot
            partition is set to the "root" partition above.
C) Set up a lilo.conf using the above.

 In my case the root and boot partitions are on different drives, and
 this script takes care of that since I have an active partition that
 lilo is on already.

 It does not install the mbr (I don't think I've ever installed a mbr,
 and I started with an old SLS system way back when, I just made the
 boot partition the active partition, and lilo worked for me)). I know
 my ignorance is showing.
 
 On my system:
 root = /dev/hdb3         (/)
 boot = /dev/hda3         (/usr/local/)           active partition
 
 I think that the lilo postinst will try to write the mbr onto
 /dev/hdb (or /dev/hda, which is my dos partition with the original
 mbr, which I'd hate to loose). 

 I feel very uncomfortable dd'ing /boot/mbr onto the first few bytes of
 the drive that the root (/) is on, and only slighly less uncomfotable
 making it active. 

 what happens if my root/boot partition is /dev/hda1 (say), I guess
 lilo writes something in the first few blocks of the active/boot
 partition (I knew I should have saved a copy of the lilo manual);
 does the mbr package overwrite that? If I do use the mbr in postinst,
 should the image package pre-depend on the mbr package? 

	manoj

>>"Bruce" == Bruce Perens <[email-masked]> writes:

Package> kernel-package

Bruce> I figured out what happened to Christoph Lameter's MBR:

Bruce> The LILO configuration script used in the kernel-image postinst
Bruce> is stale. It needs to be updated from the latest LILO postinst
Bruce> script. The major change is that the new LILO script writes a
Bruce> partition boot record and (if you approve) instals our "mbr"
Bruce> program on the MBR. The older one just overwrites the MBR with
Bruce> LILO, and we should be more polite.

-- 
 In the future, etiquette will become more and more important.  That
 doesn't mean knowing which fork to pick up -- I mean basic
 consideration for the rights of other animals (human beings included)
 and the willingness, whenever practical, to tolerate the other guy's
 idiosyncrasies. Frank Zappa, _The Real Frank Zappa Book_
Manoj Srivastava               Systems Research Programmer, Project Pilgrim,
Phone: (413) 545-3918                A143B Lederle Graduate Research Center,
Fax:   (413) 545-1249         University of Massachusetts, Amherst, MA 01003
<[email-masked]> <URL:http://www.pilgrim.umass.edu/%7Esrivasta/>

---

From: [email-masked] (Bruce Perens)
Date: Tue, 16 Jul 96 11:39 PDT

I'm not sure your analysis is correct. I think that if an
/etc/lilo.conf file does not exist, the kernel-image LILO script
creates an /etc/lilo.conf that writes the LILO boot record over the
MBR, rather than on the partition.  The more up-to-date LILO postinst
now writes the LILO boot record to the partition, and writes the MBR
program to the MBR only if the user approves, so that there will be
_something_ to run the partition boot record. If the user does not
select to write the MBR, the user had better have their own MBR program
there already or be ready to use a boot floppy.

Activate could only do something bad if the disk partition table was
different from the one used by DOS, Linux, and every other PC OS. It
just sets a flag in the partition table, and this is easily reversed
using DOS fdisk, etc. In the LILO postinst we ask if we should run
activate, just as we ask if we should install the MBR.

If we wanted to be very careful about the existing MBR, we could back
up block 0 as LILO does. Our MBR program duplicates the features of the
DOS one, and adds its own features. It works just fine with other PC
operating systems, and will chain to their partition boot records
correctly if they are marked active.

The LILO postinst has not messed up anyone's disk or clobbered their
MBR without their knowledge since I modified it to use a partition boot
record and install the MBR program. As the LILO maintainer, I would
appreciate if you'd track my post-inst script exactly, and let me decide
how LILO should be installed.

	Thanks

	Bruce
--
The "Toy Story Animated Storybook" CD was the best selling software product
during the month of May, outselling the Windows '95 upgrade, Quicken, etc.
Bruce Perens AB6YM          [email-masked]            http://www.hams.com/

---

From: Ian Jackson <[email-masked]>
Date: Fri, 19 Jul 96 22:02 BST

> overwrites the MBR with LILO, and we should be more polite.

Why not provide the LILO configuration script in /usr/sbin, so that
the kernel-image package (and related ones) can just call it ?

Ian.