Re: Mulinux trashed my root device

From: Sebastian Leske (sleske@enterprise.mathematik.uni-essen.de)
Date: Mon Aug 27 2001 - 00:09:30 CEST


Hi,

[talking about mulinux doing a mkswap automatically on bootup]
> > > > This is IMHO a critical bug. You just configure a disk on one
> > > > computer to use a swap partition, then if you ever put it into
> > > > a different computer (or repartition), the disk will
> > > > immediately & mercylessly trash whatever partition happens to
> > > > have the number of the swap partition in the original setup.
> > >
> > > True: a problem. But to save a profile with a reference to a swap
> > > partition is a very bud idea.
> >
> > Well, *you* know that, being a developer. But how should I have
> > known... ? :-| That's why I sent my report.

[...]

> In addition, the first muLinux screen reports "no guarranty" for
> incorrect usage. And because most part of this software may be also
> more dangerous of that, I suggest you to not use any script
> potentially able to format or erase your disk partitions.

I agree with what you say, and I am certainly not trying to invoke some
kind of guarantee for mulinux (and fortunately I got my data back
unharmed).
I just think that in general a program should be as robust against user
errors as possible, and that's why I proposed the (small) modifications.

Just a few comments:

> This is what the swap-panel say:
>
> =====================================================================
>=== - Swap-space setup (OPTIONAL) -
>
> [snip]
> ALERT! POTENTIAL DAMAGE! If you are a *very* newbie or your machine
> has enough RAM, skip this setup.
> =====================================================================
>===

That warning is perfectly in order, but I took it as a warning that
*setting up* the swap partition is dangerous (because of the 'mkswap').
It doesn't tell me that mulinux will do a mkswap on every boot.
This is something no other distribution I know of does; they all do a
mkswap once during (interactive) setup, afterwards they just 'swapon'
and complain if it doesn't work.

> A guy that seems to ignore that a swap-partion relay on the partition
> table and partition tables are different from a computer and another,
> has to be considered *very* newbie, in my opinion. So, I added the
> warning about "potential damage".

That's true, but again, this is only a real problem because of the
automatic mkswap. In addition, it's easy to forget that your mulinux
floppy has a profile set.

> In recent version, I added also the "euristic swap", strongly
> suggesting this for newbies: it try to determine dynamically if a
> linux swap partition is present in the machine.

Wouldn't it be possible to always use "euristic swap" on bootup with a
saved profile? That seems perfect. If you set up swap before, it will
find it, if not, it will do without.

So, just to make mulinux a bit more tolerant of user error, can you
change the bootup scripts such that they do not invoke mkswap, unless
you are in interactive setup? I made a little patch that does that.

Here the patch against /setup/fun/swap.fun (in ROOT.gz) which I think
solves the problem. Briefly, it changes two things:
1) The code that creates a swapfile and does the mkswap is only run if
we are in interactive setup ($ACTION = ask_the_user ).
Rationale: We don't want to clobber anything automatically.

2) If swapon fails, an appropriate error is reported. That way, if the
swap file / swap device needs to be re-setup, the user will be told
about it.

Just a proposal of how I think the solution could be. Always doing a
"euristic swap" setup on bootup would be another alternative, but I'll
leave the code for that up to you, I don't know mulinux well enough...

Maybe I can still convince you ... ;-).

Greetings,

Sebastian

*** swap.fun Sun Aug 26 23:54:38 2001
--- swap.fun-orig Sun Aug 26 23:38:51 2001
***************
*** 254,260 ****
  
  magic=`dd if=${source} bs=1c skip=4086 count=10 2>/dev/null`
  
! if [ "$magic" != SWAP-SPACE ] && [ "$ACTION" = ask_the_user ]
  then
  
        if [ "$SIZE" ] ; then
--- 254,260 ----
  
  magic=`dd if=${source} bs=1c skip=4086 count=10 2>/dev/null`
  
! if [ "$magic" != SWAP-SPACE ] || [ "$ACTION" = ask_the_user ]
  then
  
        if [ "$SIZE" ] ; then
***************
*** 265,279 ****
        mkswap /dev/swap $SIZE
        sync
  fi
!
! swapon /dev/swap
! if [ $? -ne 0 ]
! then
! echo
! echo "swap inconsistency: cannot activate swap space on
$source."
! echo "Run 'setup -f swap' manually."
! echo
! exit 1
! fi
  
  }
--- 265,270 ----
        mkswap /dev/swap $SIZE
        sync
  fi
! swapon /dev/swap
  
  }

---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.dk
For additional commands, e-mail: mulinux-help@sunsite.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:19 CET