Non-standard installation (installing Linux from Linux)
- by Evan Plaice
So, here's my setup. I have one partition with the newest version installed, a second partition with an older version installed (as a backup just in case), a swap partition that both share, and a boot partition so the bootloader doesn't need to be setup after each upgrade.
Partitions:
sda1 ext3 /boot
sda2 ext4 / (current version)
sda3 ext4 / (old version)
sda4 swap /swap
sda5 ntfs (contains folders symbolically linked to /home on /)
So far it has been a very good setup. I can create new boot loaders without screwing it up and adding my personal files into a new install is as simple as creating some symbolic links (the partition is NTFS in case I need to load windows on the system again).
Here's the issue. I'd like to be able to drop the install into /distro on the current version and install a new version on / on the old version effectively replacing/upgrading it. The goal is to be able to just swap out new versions as they are released while maintaining redundancy in case I don't like th update.
So far I have:
downloaded the install.iso
created a folder in /distro
copied the install.iso into /distro
extracted vmlinuz and initrd.lz into /distro
Then I modified /boot/grub/menu.lst with the following entry:
title Install Linux
root (hd0,1)
kernel /distro/vmlinuz
initrd /distro/initrd.lz
vmlinuz loads perfectly but it says it can't find initrd.lz on boot.
I have also tried to uncompress the image with:
unlzma < initrd.lz > initrd.img
And, updating the menu.lst file to match; but that doesn't work either.
I'm assuming that vmlinuz (linux kernel) loads, fires up the virtual filesystem by creating a ramdisk (initrd), mounts the iso, and launches the installer.
Am I missing something here?
Update:
First, I wanted to say that the accepted answer would have been the best option if I was doing a normal Ubuntu install. Unfortunately, I was installing Linux Mint (which lacks the script needed to make debootstrap work.
So the problem I with the above approach was, I was missing the command that vmlinuz (linux kernel) needed to execute to start boot into LiveCD mode. By looking in the /boot/grub/grub.cfg file I found what I was missing. Although this method will work, it requires that the installation files reside on their own partition. I took the easy route and used unetbootin to drop the LiveCD on a usb drive and booted from that.
Like I said before. Debootstrap would have been the ideal solution here. Even though I couldn't use it I wrote down the steps it would've taken to use it.
Step One: Format sda3 (the partition with the old copy of linux that's being overwritten)
I used gparted to format it as ext4 from within the current linux install. How this is done varies based on what tools you prefer to use.
Step Two: Mount the newly formatted partition (we'll call the mount ubuntu for simplicity)
sudo mkdir /mnt/ubuntu
sudo mount -o -loop /dev/sda3 /mnt/ubuntu
Step Three: Get debootstrap
sudo apt-get install debootstrap
Step Four: Mount the install disk (replace ubuntu.iso with the name if your install disk)
sudo mkdir /media/cdrom
sudo mount -o loop ~/ubuntu.iso /media/cdrom
Step Five: Install the OS using debootstrap (replace fiesty with the version you're installing and amd64 with your processor's architecture)
sudo debootstrap --arch amd64 fiesty /mnt/ubuntu file:/media/cdrom
The settings here varies. While I loaded debootstrap using an install iso, you can also have debootstrap automatically download and install if with a repository link (While most of these repositories contain debian versions I'm still not clear as to whether Ubuntu has similar repositories). Here a list of the debian package repositories and their mirrors.
This is how you'd deploy debootstrap if you were doing it directly from a repository:
sudo debootstrap --arch amd64 squeeze /mnt/debian http://ftp.us.debian.org/debian
Here's the link that I primarily used to figure this out.