[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Linux to Linux install works... mostly.



Last night I wanted to install Potato on a machine with no CD-ROM
and no floppy disk, running Linux.  A Linux-to-Linux install,
downloading from the net.  Should be easy.  I mean, DOS-to-Linux
is easy, so why not Linux-to-Linux?  Well, it's not (unless I'm
missing something big).  But I found that it IS possible.

Here's how I installed 2.2 over an older, non-Debian Linux dist.
This procedure has some wrinkles, but they don't appear to be too
difficult.  If there's interest and a little expert help, I could
iron them all out.  It would be nice to make it so Debian can be
installed from a running Linux system.

This is my very first experience with Debian, so if you see
me doing anything stupid below, um, this may be why.

Here we go...

----------

Your current Linux installation is running on one or more partitions.
(the mount command with no arguments will list currently mounted
partitions and their mount points).  The steps below will show
how, unning Linux on the current partition (the root partition), you
can install a new distribution on a different partition (the target
partition).

1.0) Create a directory in the root partition to hold the install files.
I called mine "/install".

2.0) Download the base and driver archives, put them in /install
	http://ftp.us.debian.org/debian/dists/frozen/main/disks-i386/2.2.8-2000-03-09/base2_2.tgz
	http://ftp.us.debian.org/debian/dists/frozen/main/disks-i386/2.2.8-2000-03-09/drivers.tgz
2.1) Download the 1.44 rescue.bin disk image, and put it in a directory
	named "images-1.44" in /install.
	http://ftp.us.debian.org/debian/dists/frozen/main/disks-i386/2.2.8-2000-03-09/images-1.44/rescue.bin
2.2) Put the corresponding version of dbootstrap in /install.
	The dbootstrap source code is found in the boot-floppies package.
	http://ftp.us.debian.org/debian/dists/frozen/main/binary-i386/admin/boot-floppies_2.2.8.deb
		(compiling it is a nightmare if you don't have a running Debian
		system--take it from me.  E-mail me if you want the binaries.
		It would be nice to have the binary on the Debian FTP site...)
2.3) Copy the boot-floppies/utilities/dbootstrap/po/C.trm file
	into /install/po/C.trm.  dbootstrap needs this file to run.
2.4) OK, when you're done preparing your install directory, it
	should look like this:
	    /deb/base2_2.tgz
	    /deb/dbootstrap
	    /deb/po/C.trm     (comes from dbootstrap source)
	    /deb/drivers.tgz
	    /deb/images-1.44/rescue.bin

3) Reboot your computer in single-user mode.  (If you're using Lilo,
	you probably type "Linux single" at the LILO: prompt.)
	Single user mode is an extraordinarially limited way of running
	Linux, but it's sufficient for our needs.
3.1) Mount the /proc device -- dbootstrap needs it.  Do this:
		% mount -t proc proc /proc
3.2) If you need to adjust stuff on the root partition, you will need to
	mount it read/write (where hdXX is the device for the root partiton):
		% mount -o remount,rw /dev/hdXX /
	You can set it back to read-only with this command:
		% mount -o remount,ro /dev/hdXX /
	Note that you should NOT need to do this.

4) If it doesn't already exist, create the target partition.  You can
	run dbootstrap out of the /install directory, or use fdisk or
	whatever you want.  Write the partition map.  If the partitioning
	tool complains that it can't reload the map, this is no big deal.
	It just means that there are partitions in the map that are currently
	mounted, and you need to re-start the computer in single user mode
	(steps 3 and 3.1) to see the changes you made.
4.1) If dbootstrap complains that "I had trouble checking the choice of
	root device.  I don't know what to use as the root fs.", don't worry
	about it.

5) Initialize the target partition using dbootstrap as normal.

6) "Mount a Previously-Initialized Partition": Unfortunately, dboostrap
	will not be able to perform this step itself, so we must do it by
	hand.  Launch a shell (near the bottom of dbootstrap's steps), then
	enter these two commands:
		% mkdir /target
		% mount /dev/hdXX /target
6.1) Happily, this step gets rid of the error message that's been
	hounding us since step 4.1.

7) Install Operating System Kernel and Modules:
	- choose "mounted" (you're going to load the files from a mounted
	  partition.
	- Enter "/install" or wherever you put the installation files
	  in step 2.
	- At this next dialog, choose "existing" (not "manual").
	- Then choose "/install" from the list ("/install" should be the
	  only item in the list).
7.1) The first time you try this step, you may get an "ioctl:
	LOOP_SET_FD: Bad File Descriptor" error.  I'm not sure why.
	Don't quit dbootstrap -- just try step 7 again.  It should work this
	time.

8) Now you must modify a file on the target partition by hand.
	So, fire up a shell, then edit the /target/usr/share/modconf file.
	You need to change the following line:
		KernelVersion=$(uname -r)
	to
		KernelVersion=2.2.14
	(or whatever the version of the kernel that you're installing is).
8.1) The problem is that /usr/sbin/modconf discovers the modules
	directory that it should use with "uname -r".  However, uname -r
	returns the version of the currently running system -- NOT the
	version of the system we're installing.  So, of course, you can skip
	this step if the kernel version you're installing is exactly the
	same as the currently running kernel version.
8.2) You don't need to worry about changing this file back to its
	original form.  Installing the base system in step 12 writes
	a new version of this file, wiping out our changes.

9) When you first boot the new install, boot into single user AGAIN.
	Mount the root fs read-write (step 3.2), then enter the following
	two commands:
		% cp /etc/inittab.real /etc/inittab
		% cp /etc/modules.bak /etc/modules
	(I'm not sure -- it looks like there's some final step that was
	forgotten?)

10) Configure Device Driver Modules.  This should work as normal.

11) Configure the Network.  This should work as normal.

12) Hit return to configure the base system.  Specify /install
	(or whatever), just like in step 7.

You now have a very incomplete Debian install.  It should not be too
hard to bring it up to speed: dselect is your friend.  You will probably
have to tweak some modules files by hand--my install is incorrectly
trying to load a whole bunch of them but I haven't figured out why yet.

-------

The reason for the message in 4.1 is that dbootstrap discovers the rdev
number for the root partition ("/"), then walks through /dev looking for
the associated device (i.e. /dev/hda1 if /dev/hda1 is mounted on /).
I'm not sure why the rdev numbers don't match up, but it's not a
show-stopper problem.

Right now we do most of the install in single-user mode.  Technically,
there should be no need for this.  I should be able to prepare a
partition and run LILO on the MBR, then reboot my computer, all from
regular runlevels (from within X even!).  It works MUCH better from
single-user mode, though, so that's what to get working first.
Particularly step 9 above.  Once THAT works, it should be fairly easy
to make it happy running as a regular user.

Well, that's it.  If you have any questions or comments, mail me:
bronson@trestle.com

	- Scott


P.S. The steps above are a compilation of my experiences.  They should
work, but if not, you may find more information in my notes that I've
included--unedited--below.

How I installed Debian on a system that was already running Linux.

Here's the catch: the machine had a net connection, but no floppy
or CD-ROM drive.

First, try as a full user.

1) Create a partition to hold the new Debian install
	Because I wanted to install Debian over the currently running
	Linux, I needed to create a small partition to hold a minimal
	Debian install, boot the minimal system, erase the original
	partition, THEN install Debian for real.
	- use fdisk or whatever you want.
	- I just ran dbootstrap and used its partitioning utility.
2) Reboot to make the new partition table take hold
	(you can't re-load the partition table while the computer is
	running ... or something close to that)
3) Download 3 files into some directory (N) on the local filesystem
	- base2_2.tgz
	- drivers.tgz
	and create a subdirectory to put rescue.bin in...
	- images-1.44/rescue.bin
4) Run the dbootstrap utility.
	(UM, I needed to d/l the source and compile the new version.
	This will, of course, take a LOT more time to explain how to do.
	I think dbootstrap should be included with the corresponding release disks.)
4.1) Choose: Initialize a Linux Partition
	- format the partition you created in step 1
4.2) Choose: Mount a Previously-Initialized Partition
	- mount the partition you created in step 1
	- the partition will be mounted on /target
4.1) Choose: Install Operating System Kernel and Modules
	- choose: Mounted (you're going to use files on a mounted partition)
	- Enter the directory N containing the base.tgz you downloaded in step 3
	- choose: manually
	- Enter the same directory N as before
	ISSUE:
	The first time you try this step, you will probably get a
		ioctl: LOOP_SET_FD: Bad file descriptor
	error.  I'm not sure why.  Don't quit dbootstrap -- simply try
	again.  This time it will work.
5) Unfortunately, you must now modify a file on the target by hand.
	The problem is that /usr/sbin/modconf gets the modules directory
	using uname -r.  HOWEVER, uname -r returns the version of the
	currently running system -- NOT the version of the system we're
	installing.  So, if the version of the system you're installing
	is different than the system you're running (quite liekey),
	you need to change the line in /target/usr/share/modconf
		KernelVersion=$(uname -r)
	to
		KernelVersion=2.2.14 
	(or whatever the version of the kernel you're installing is).
	NOTE: you don't need to worry about chainging this file back to its
	original form.  Installing the base system in step 7 writes a new
	version of this file, wiping these changes out!
5.1) Hit return to Configure Device Driver Modules.
	The screen goes black.  If you did the previous step, there will
	be no errors, but the screen will remain black until you hit
	return.  I don't know why -- what does this step normally look like?

	AH! now I see.  When I boot into single user mode ("Linux single"
	at the LILO prompt, then entering root passwd when prompted),
	this step works.  If you're in single-user mode, then of course
	you won't have the virtual terminals.  You will need to use
	dbootstrap's excellent "Launch a Shell" command.

	DANGIT!  This doesn't work either.
	"Can't open dependencies file /lib/modules/2.2.14-compact/modules.dep"
	Oh well, I can probe these modules later.

6) Hit return to configure the network.  Proceed as usual.
7) Hit return to install the base system.  Choose mounted and enter
	directory N, just like in step 4.
	- When in single-user mode, this step kept crashing on me if I
	  chose "manual".  However, if I chose "mounted", then existing,
	  then selected my /deb directory, it worked fine.


It looks like to get the Configure Device Driver Modules step to work,
you really need to be in single-user mode.  This is too bad: it's
not specifically necessary for this step...

Hm, that didn't work.  Try in single user mode.

- Create a directory in a "permanent" partition.
  	/deb
- Fill this directory with the good files:
	/deb/base2_2.tgz
	/deb/dbootstrap
	/deb/po/C.trm     (comes from dbootstrap source)
	/deb/drivers.tgz
	/deb/images-1.44/rescue.bin
- Reboot in single-user mode (not strictly necessary, but good to be safe)
- Partition your hard drive
- Reboot in single-user mode again to be sure your changes took hold
	If you need to mount the root partition r/w (this should NOT be necessary
	during a normal install, but you may need to fiddle with some things):
		mount -o remount,rw /dev/hdXX /
	and then to set back to read-only before you run dbootstrap:
		mount -o remount,ro /dev/hdXX /
- Before you run dbootstrap, you do need to mount proc
	mount -t proc proc /proc
- Now, run /deb/dbootstrap
	An error occured while loading application messages from /etc/messages.trm
- Click OK at the "I had trouble checking the choice of root device.  I
  don't know what to use as the root fs." dialog.  I don't know what
  this is saying, but things appear to work in spite of it.
  - it warns me REPEATEDLY
- The utility won't tbe able to "Mount a Previously-Initialized
  Partition" itself -- something about not being able to match up
  the rdev of / with any device in /dev/*.  So, when it comes to
  this step, you need to fire up a shell, make / rw
  		mkdir /target
  		mount /dev/hdXX /target
  And then everything will be OK.
- Cool!  Module support appears to work when booted in single-user mode. 
  In fact, everything else seems to work.

NO!  Install appears OK but something is still fucked.
Ah!  There's no inittab!?
OK, so I copied /etc/inittab.real to /etc/inittab
and also /etc/modules.bak to /etc/modules

And NOW it WORKS!   ?   Yes, excellent, I'm going to bed.

problem: a whole bunch of modules appear to be incorrectly trying to load.
problem: /etc/fstab has weird stuff in it.

It appears some sort of post-install script wasn't run.
These appear to be easy-to-fix problems, tho.


Reply to: