About News Download Docs Bugs Contact

Install/Chroot

Information

Tools

Resources

Chroot Install Guide

Here's a complete guide to install Source Mage GNU/Linux using chroot tarballs.


What?

Chroot image is a compressed archive of a live system. It contains everything you need to extract on your disk and start using Source Mage.

Here we have a few official images to start with, which contain all the essential programs and libraries to boot from any modern hardware and specific networking setup (PPPoE, Wi-Fi, etc.).

It is usually based on the specific grimoire release, and inside our project is used for testing purposes and grimoire release process.


How?

Chroot image is just an archive, so to make your system up and running, you need to boot from some LiveCD/LiveUSB/LiveLAN Linux-based media to partition your drive, extract the image, install a bootloader and configure some basic stuff like network interface, hostname, etc.

These steps will help you to do so in a proper order:

1. Get some bootable media

It can be our installation ISO, any compact (I hope so) Linux media distribution image, or even the ISO of the operating system Mathieu prefers.

Personally I recommend SLAX, CRUX or Alpine Linux. They support all modern hardware, and it's easy to find the nearest mirror to you and get them pretty quickly. Also Archboot is perfect for booting via network (PXE).

But, as told above, it can be any Linux boot media you'd like to use.

2. Boot it

Burn the ISO image or dd a prepared boot image to your USB-key, or set up a TFTP-server to boot via network, and boot into its minimal environment.

3. Get the chroot image

Almost all modern Linux distributions support network configuration and have download tools available when boot process is complete.

So it's usually not a problem. Though if you don't have (or you know that you won't have Internet-connection inplace for some reason) such ability, you can put the desired chroot image on your USB-key or CD/DVD disc.

You can download the appropriate chroot image from our downloads page; and we will use the one based on 0.60-stable grimoire in the example below.

Let's imagine there's no trouble with our Ethernet adapter, and we know how networking works in Linux on a very basic level:

# ifconfig eth0 1.2.3.4 netmask 255.255.255.0
# route add default gw 5.6.7.8
# echo "nameserver 9.10.11.12" > /etc/resolv.conf
# wget "http://download.sourcemage.org/image/official/smgl-stable-0.60-basesystem-x86_64.tar.bz2"

4. Partition your drive

This is done mostly with "fdisk" and/or "parted". Disk drives (SATA) are usually /dev/sda, /dev/sdb, etc., but that completely depends on hardware (for example it could be /dev/cciss/c0d0 if you know what SMART RAID Controller is).

More complex disk setup (RAID/LVM) is also fine, but out of the topic.

Here we start:

# parted /dev/sda
> mklabel gpt
> unit mb
> mkpart primary 0g 128
> mkpart primary 128 2048
> mkpart primary 2048 4096
> mkpart primary 4096 6000
> mkpart primary 6000 8000
> mkpart primary 8000 20000
> mkpart primary 20000 -1
> name 1 boot
> toggle 1 boot
> name 2 swap
> name 3 root
> name 4 home
> name 5 temp
> name 6 usr
> name 7 var

look at them:

> p free

and quit "parted":

> quit
#

then create filesystems on these partitions (in example below we use XFS for /):

# mkfs.xfs -l internal,size=64m -d agcount=8 /dev/sda3

swap is organized with mkswap command:

# mkswap /dev/sda2

5. Mount partitions

Now you're almost ready to extract Source Mage from the chroot image. The last step before it is to mount partitions you've made in the previous step:

# mkdir /mnt/drive
# mount /dev/sda3 /mnt/drive
# mkdir /mnt/drive/{boot,home,tmp,usr,var}
# mount /dev/sda1 /mnt/drive/boot
# swapon /dev/sda2
# mount /dev/sda4 /mnt/drive/home
# mount /dev/sda5 /mnt/drive/tmp
# mount /dev/sda6 /mnt/drive/usr
# mount /dev/sda7 /mnt/drive/var

6. Extract from chroot

Finally, assuming you've downloaded x86_64 chroot image to the writable /root directory, extract it to your forthcoming mainspace:

# cd /mnt/drive
# tar xvjf /root/smgl-stable-0.60-basesystem-x86_64.tar.bz2

Done!

7. Finalize installation

Here are few final steps that were mentioned at the beginning of this guide.

# mount --bind /dev /mnt/drive/dev
# mount --bind /sys /mnt/drive/sys
# mount -t proc none /mnt/drive/proc
# mount -t devpts none /mnt/drive/dev/pts
# chroot /mnt/drive
# passwd root

NOTE: don't skip this substep. Root password in the chroot images isn't installed. No, it doesn't mean you can login with an empty password, it means you won't be able to login at all.

This is usually done with editing /etc/network/interfaces file. For more info see interfaces(5). For simple setups there's already a template where you only need to replace X-values with real IPs of the machine's primary address, netmask and default route. Do not forget to uncomment (remove preceding # symbols) the actual interface configuration lines.

To set your hostname type this:

# echo "yourhostname.yourdomain.tld" > /etc/hostname
# echo "yourdomain.tld" > /etc/defaultdomain

DNS servers are located in /etc/resolv.conf file.

Recent chroot images use Neustar's DNS Advantage (until 0.61-stable it was Comodo's Secure DNS) as primary and Google's as secondary DNS server. Feel free to use desired/own ones.

Edit /etc/fstab file according to your disk setup in step №4:

# nano /etc/fstab

If you prefer to keep your system minimal, you might want to compile your own kernel with only needed hardware support and/or to include some advanced settings. You can do that just inside the chroot.

There are 2 ways:

  1. includes getting any desired image from http://www.kernel.org, extracting it to /usr/src (e.g.) and doing that by hand (via make menuconfig, make, make modules, copying bzImage, etc.)
  2. includes typing:
# cast -r linux

and following instructions in the menus.

Chroot images come with 2 bootloaders: LILO and GRUB2. Feel free to use any. For example there's ready /etc/lilo.conf, where you only need to check for root= and boot= values and install it to your HDD:

# nano /etc/lilo.conf
# lilo -A /dev/sda 1
# lilo

Chroot images come with only one locale – en_US, and use UTF-8 version of it by default. If you need to change it, type:

# cast -r locale

select those you want, and then – change LANG variable in /etc/sysconfig/locale file to the one you'd like to use.

By default timezone is set to UTC. To change it, you need to choose timezone file and symlink it with /etc/localtime. For example to set GMT-4 timezone:

# ln -sf /usr/share/zoneinfo/Etc/GMT-4 /etc/localtime

All timezone files are located in /usr/share/zoneinfo directory.

This is usually done with Ctrl+D or by typing:

# exit

8. Reboot

Now you're ready to boot into Source Mage GNU/Linux system, so type:

# reboot

Note: don't forget to set HDD as a primary media in the boot priority list of BIOS.

9. Continue on

Follow the post-installation steps in our ISO install guide to update and optimize the system for your hardware.

10. Report

Feel free to report back, comment and yell on this guide by dropping me a mail to stealth@sourcemage.org or notifying me on IRC.