[ Content | View menu ]

Howto install Debian Etch on USB-Stick

Written on 22.10.2008

This howto describes how to install debian etch on a usb-stick. The usb-stick will be bootable and your debian system runs directly on it (for example as emergency system).

Variables

/dev/sdb = usb-device
/mnt/usb = mountpoint for usb-device
_ = in the chrooted-system

Install

clean usb-device

deletes mbr, all partitons and all data:

shred -n 0 -v -z /dev/sdb

or

dd if=/dev/zero of=/dev/sdb

partition

create one primary partiton with type 83 and no swap (swap = faster dead for usb-device):

cfdisk /dev/sdb

format

format as ext2 (ext2 is like ext3, but without journaling = no faster dead for the usb-device):

mkfs.ext2 /dev/sdb1

mount

mount usb-device:

mount /dev/sdb1 /mnt/usb

debootstrap

install debian system with debootstrap:

debootstrap --arch i386 etch /mnt/usb http://ftp.us.debian.org/debian

device-uuid

get UUID from usb-device (save it for later):

blkid /dev/sdb1
Output: /dev/sdb1: UUID="e659faf9-c042-4c1b-b831-469c30392a3c" TYPE="ext2"

grub

install grub on usb-device:

grub-install --recheck --root-directory=/mnt/usb /dev/sdb

bind dev

mount --bind /dev /mnt/usb/dev

chroot

chroot into new system:

chroot /mnt/usb

_ install base packages

Notice: Do not abort the installation of the kernel!

apt-get install locales linux-image-2.6.18-6-686 grub

_ locale

set it to ‘en_US.UTF-8′:

dpkg-reconfigure locales

_ generate menu.lst

grub-install didnt create it (dont know why):

update-grub

Configure

_ network

/etc/network/interfaces

_ hostname

/etc/hostname

_ hosts

/etc/hosts

_ fstab

/etc/fstab

Use ‘UUID=“YOUR_USB_BLKID”‘ for the device (instead /dev/sdb1), cause the uuid is a permanent identifier of your usb-device and will not change.

Example:

proc            /proc           proc    defaults        0       0
UUID="e659faf9-c042-4c1b-b831-469c30392a3c"       /               ext2    defaults,errors=remount-ro 0       1

_ grub

/boot/grub/menu.lst

Go to this line: ‘# kopt=root=/dev/hda1 ro’ and change it to:

# kopt=root=UUID=YOUR_UUID_FROM_BLKID ro rootdelay=10

rootdelay = 10 waits for the usb-device to come up.

Example:

# kopt=root=UUID=e659faf9-c042-4c1b-b831-469c30392a3c ro rootdelay=10

grup update:

update-grub

_ initramfs image

update-initramfs -u all

_ exit from chroot

exit

umount

umount /mnt/usb/dev
umount /mnt/usb

Finish :-). Now you can boot your new debian system on your usb-device!

Filed in: Allgemein.

No Comments

Write comment - TrackBack - RSS Comments

Write comment