Debootstrapping

If you are unable to get your hand on a CD and you can't boot from a USB, or if you cannot boot from the installation CD, but really want to install the latest and greatest of gNewSense, then this guide is for you. It presupposes some knowledge of the terminal and GRUB configuration, but should mostly be covered by this how-to.

What you will need

In this guide I will assume gNewSense 2.3, but it should work for most Debian based systems. To install debootstrap, simply type:

$ sudo apt-get install debootstrap

The basic installation

Partitioning the disk

Depending on how your current setup looks like, you may want to modify your partition table accordingly. If you have a secondary /home partition, I recommend that you keep using it for your gNewSense 3.0 installation. For a graphical partitioning tool, I recommend gparted, which can be found in the repositories; alternatively, there are many tools for creating partitions from the terminal. I leave it up to the reader to find out how to modify and create a new partition, I will however recommend the new partition be no larger than 5 GiB, unless you plan to have a large amount of installed programs.

Getting the debootstrap script for parkes

The debootstrap script can be acquired several ways.

You can simply download the deb package and install it.

$ wget http://archive.gnewsense.org/gnewsense-three/gnewsense/pool/main/d/debootstrap/debootstrap_1.0.26+squeeze1gnewsense2_all.deb
$ sudo dpkg -i debootstrap_1.0.26+squeeze1+gnewsense1_all.deb

Or you can download the source and copy the script from there.

$ dget http://archive.gnewsense.org/gnewsense-three/gnewsense/pool/main/d/debootstrap/debootstrap_1.0.26+squeeze1gnewsense2.dsc
$ tar -xf debootstrap*tar.gz
$ sudo cp debootstrap-*/scripts/parkes /usr/share/debootstrap/scripts

Debootstrapping parkes

Debootstrapping parkes will install a barebone gNewSense installation, from which we will build onto.

To debootstrap parkes, first mount your new partition, in this example sda10. In your case the number may be different. If you're not using gNewSense 2.3, then the partition might be called something like /dev/hda10 (notice h instead of s).

$ sudo mkdir /mnt/gns3
$ sudo mount /dev/sda10 /mnt/gns3

And then we debootstrap:

$ sudo debootstrap parkes /mnt/gns3

If you're not on gNewSense 2.3, you should run debootstrap like this:

$ sudo debootstrap parkes /mnt/gns3 http://archive.gnewsense.org/gnewsense-three/gnewsense/

Chrooting and setting up the system

Next, mount the necessary file systems.

$ sudo mount -t proc proc /mnt/gns3/proc
$ sudo mount -t sysfs sysfs /mnt/gns3/sys
$ sudo mount --bind /dev /mnt/gns3/dev

We use the chroot command to enter the newly installed system. It runs a shell having access only to files in the specified directory, treating it as the root directory.

$ sudo chroot /mnt/gns3
# apt-get update

For your convenience, I would advise you to install bash-completion, which gives you auto-completion for apt-get, etc. in bash.

# apt-get install bash-completion

If you're installing on a Lemote Yeeloong then you should install some more to complete the minimal system. For further information, see the MIPS port page.

# apt-get install yeeloong-base

Getting the network to work

You should make sure you have an internet connection in your gNewSense 3.0 installation, before you boot into it and configure it from the inside. Modify /mnt/gns3/etc/network/interfaces to suit your needs. Look at your current /etc/network/interfaces if you have doubt on how to configure it.

An example of a typical /etc/network/interfaces is as follow.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Next up, we'd like to set the hostname of the system, and make localhost loopback to us (where BOXNAME is your desired hostname):

 # echo BOXNAME > /etc/hostname
 # echo "127.0.0.1 localhost" > /etc/hosts
 # echo "127.0.0.1 BOXNAME" >> /etc/hosts

Adding a user, enabling sudo and setting the root password

First up, add YOURNAME as a user to the system:

# adduser YOURNAME

It will prompt you for a password.

Let's give you super powers. First install sudo:

# apt-get install sudo

Then edit the configuration:

# visudo

Below the line that reads:

# User privilege specification
root    ALL=(ALL) ALL

Append

YOURNAME        ALL=(ALL) ALL

Configuring the console and time

This is a quite useful step to have done, before you boot up your system, as you may end up with a keyboard layout you don't like or with a confusing system time.

 # apt-get install console-setup
 # dpkg-reconfigure tzdata

Configuring locales

Locales are a framework to switch between multiple languages and allow users to use their language, country, characters, collation order, etc. To support i18n, you may want to properly set up the locale data according to your language. Only generate the locales you needed. UTF-8 locales should be chosen by default, particularly for new installations.

 # apt-get install locales
 # dpkg-reconfigure locales

Install Linux Kernel

Depending on your machine type, most people will install linux-image-2.6-686 for a x86 machine. Install it with:

 # apt-get install linux-image-2.6-686

For Loongson 2F users:

 # apt-get install linux-image-3.5.3-gnu-loongson-2f

Configuring GRUB

We are almost ready to boot into our new system. First we must however configure GRUB. If you are installing from a LiveCD, this task may be a little easier, as you will install a new version of GRUB.

Add to existing GRUB

If you are on an existing installation, you may want to configure GRUB instead of installing a new version. First exit the chroot:

# exit

We must know the UUID of our disk (again, I assume /dev/sda10 for convenience):

$ sudo vol_id /dev/sda10

And add it to the GRUB configuration.

In gNewSense 2.3, the entry you would have to add would look like this (where the number 10 in (hd0,10) corresponds to number 10 in /dev/sda10 and MY_UUID is the UUID of the disk):

title           gNewSense GNU/Linux 3.0 (parkes), kernel 2.6.30.7-libre-fshoppe1
root            (hd0,10)
kernel          /boot/vmlinuz-2.6.30.7-libre-fshoppe1 root=UUID=MY_UUID ro quiet splash
initrd          /boot/initrd.img-2.6.30.7-libre-fshoppe1
quiet

Install new GRUB

Install and configure GRUB:

# apt-get install grub
# cp /usr/lib/grub/* /boot/grub -a
# update-grub

Then exit the chroot:

# exit

And install GRUB as a bootloader:

$ sudo grub-install --no-floppy --root-directory=/mnt/gns3 /dev/sda

Modifying the fstab

Last thing we have to do, before we can boot up into our new system, is editing the fstab file. If you have a working installation, simply copy it and modify it on your new system:

$ sudo cp /etc/fstab /mnt/gns3/etc/fstab

You will most likely only have to change the lines where it says /dev/sda1 (assuming that is your current root directory) to /dev/sda10.

Example of typical /etc/fstab:

/dev/sda10 / ext3 errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0

Booting into the system

You can now reboot your system, and select your new gNewSense 3.0 installation from the GRUB menu.

Happy Hacking!

Documentation/3/InstallationManual/Debootstrapping (last edited 2014-01-12 15:54:34 by FelipeLopez)