view · edit · history · print

Debian From Scratch install.

This a a great way to install Linux with total controll. And it is the most easy method to install Debian on an AMD64 based system at this time (October 2004). For a review go to the LNW, the DFS home is maintained by John Goerzen. Here are some usefull links...

LNW article:
DFS home:

Let's get started...

I tested and described DFS below on a i386 system. First things first, download the ISO and write it to CD.

Boot the DFS CD, configure network (see the dfshelp command), partition your drive, mkswap ..., swapon ..., mke2fs ..., mount ... /mnt

$ tune2fs -c or -i # to overwrite automatic fsck.
$ tune2fs -j /dev/hdaX # to enable journaling (ext2 to ext3)

Note: After the enabling of ext journaling, be certain to change the partition type from ext2 to ext3 in /etc/fstab!!

Once booted and logged-in, DFS shows some usefull commands. You can also launch dfshelp, the html-based documentation (which still needs some work).

Configure the network as documented in dfshelp. You brobably will need load your adapter driver before bringing it to an UP state wih the ifup - command.

$ lsmod # to list loadable modules
$ modprobe xyz # to load modules

Note: xyz will be something like eepro100, tg3, etc..

Let's continue...

$ cdebootstrap sid /mnt file:///opt/packages
$ cp /etc/resolv.conf /mnt/etc/
$ cp /etc/network/interfaces /mnt/network/
$ chroot /mnt

Read this, to use and configure your Debian install system

$ vi /etc/apt/sources.list
>deb sid main contrib non-free
>deb sid main contrib non-free
>deb-src sid main contrib non-free
>deb-src sid main contrib non-free

$ apt-get update
$ apt-get install module-init-tools grub ppp file

Do this on a un-chrooted terminal...

$ cp /boot/grub/* /mnt/boot/grub/
$ cd /mnt/root
$ dpkg-repack kernel-image-2.6.6

Back to the chrooted terminal...

$ dpkg -i /root/kernel-image-*
$ grub
>root (hd0,0)
>setup (hd0)

$ update-grub
$ vi /etc/fstab
>/dev/hda6    /                    ext2       defaults        1 1
>/dev/hda5    swap                 swap       pri=1           0 0
>proc         /proc                proc       defaults        0 0
>devpts       /dev/pts             devpts     mode=0620,gid=5 0 0
>usbfs        /proc/bus/usb        usbfs      noauto          0 0

Exit (by typing exit 1 or more times) from the schrooted environment and reboot... good luck. I go off now and install DFS on my AMD Athlon 64bit processor ;-)

AMD64 notes


Debian chroot installations

# bootstrap from CD
$ cdebootstrap -a amd64 sid /mnt file:///opt/packages

# bootstrap from the web with cdebootstrap
$ cdebootstrap --arch amd64 sid /pure64/ \

# bootstrap from the web with the older debbootstrap
$ debootstrap --arch amd64 sid /pure64/ \

$ base-config

AMD64 sources.list

deb sid main
deb-src sid main

deb sid main
deb-src sid main

deb sid main 
deb-src sid main

deb sid main
deb-src sid main

deb sid main
deb-src sid main

deb sid main
deb-src sid main

deb sid main

Note: For getting i386 binary's working you schould take a look at the chrooted or multiarch methods!


$ cd /mnt/root 
$ dpkg-repack --arch amd64 kernel-image-2.6.6-amd64

Post install: Notes


  • gcc
  • =>prereq.: cpp binutils ...
  • g++ make automake autoconf manpages-dev gdb gcc-doc
  • =>prereq.: perl m4 linux-kernel-headers ...
  • =>extra: binutils-doc cpp-doc gcc-3.3-doc
  • m4 perl linux-kernel-headers
  • perl-doc
  • libtool flex bison ncurses-base
  • indent indent-doc lsof
  • findutils mc nmap tcpdump lynx w3m wget
  • bzip2 gzip unrar
  • host dhcpcd (or dhcp-client)
  • stl-manual gnu-standards
  • =>prereq. mania.. xfree86? for groff???
  • =>use apt-cache, on: xfree (x-window-system) enlightenment
  • etc...

Kernel reconfiguration

  • apt-get install kernel-source-2.6.8
  • apt-get install kernel-package libc6-dev g++ libqt3-dev
  • cd /usr/src/kernel-source-2.6.8
  • make-kpkg clean
  • make xconfig
  • ===> Configure the kernel.
  • make-kpkg clean
  • make-kpkg kernel_image
  • cd ..
  • dpkg -i kernel-image*.deb
  • update-grub


  • create /etc/hosts
  • create loopback script
  • create network scripts (module, gateway, ip, etc...)
  • recompile kernel for current hardware

Setup X Windows in Debian

$ apt-get -m install x-window-system
$ vi $HOME/.Xsession
$ dpkg-reconfigure xserver-xfree86
$ apt-get install xfree86-driver-synaptics ???
# test X
$ apt-get install enlightenment
$ apt-get install e16keyedit
$ vi $HOME/.Xsession
$ apt-get install mozilla-firefox

Setup i386 chrooted environment for pure64

Note: "64$" means we execute this in the un-chrooted pure 64-bit environment; "32$" means we execute in the chrooted i386 environment.

64$ apt-get install debootstrap
64$ debootstrap --arch i386 sid /var/chroot/sid-ia32
64$ chroot /var/chroot/sid-ia32 

32$ vi /etc/apt/sources.list
>deb sid main contrib non-free
>deb sid main contrib non-free
>deb-src sid main contrib non-free
>deb-src sid main contrib non-free
32$ apt-get update
32$ apt-get install libx11-6

64$ vi /etc/
># chroot i386 system libs
64$ cd /lib
64$ ln -s /var/chroot/sid-ia32/lib/
64$ ldconfig -v | grep "ld-linux"
64$ vi /etc/fstab
># ia32 chroot
>/home   /var/chroot/sid-ia32/home none  bind     0 0
>/tmp    /var/chroot/sid-ia32/tmp none   bind     0 0
>proc    /var/chroot/sid-ia32/proc proc  defaults 0 0
64$ mount /var/chroot/sid-ia32/home
64$ mount /var/chroot/sid-ia32/tmp
64$ mount /var/chroot/sid-ia32/proc
64$ cd /var/chroot/sid-ia32/etc/
64$ mv passwd passwd.orig
64$ mv shadow shadow.orig
64$ mv group group.orig
64$ cd /etc
64$ ln passwd /var/chroot/sid-ia32/etc/passwd
64$ ln shadow /var/chroot/sid-ia32/etc/shadow
64$ ln group /var/chroot/sid-ia32/etc/group

Everything should work now! To use it at next reboot just to this:

$ chroot /var/chroot/sid-ia32
$ su - youruser
$ export DISPLAY=:0 
$ your_command

To make things even more simple, check out the dchroot method described in the "debian-amd64-howto". Launching an 32bit app is as simple as this:

$ dchroot -c ia32 -d openoffice

Ain't that livable? ;-)

Now you can get packages like valgrind ("apt-get install gcc g++ make valgrind") from your chroot and devellop for i386.

admin · attr · attach · edit · history · print
Page last modified on March 30, 2006, at 01:55 PM