Knoppix Hacks

Introduction to Knoppix

What is Knoppix?

A complete Linux distribution that runs directly from a bootable CD-ROM, Knoppix has many uses:

Demonstrate Linux to newcomers

Make Linux easier to install

Tools for system administration

Rescue disc (for Linux and Windows)

Make your own live CD

Many other uses

Demonstrate Linux

Why Knoppix is great for demos:

No need to install

Fast

Great hardware autodetection

Includes lots of software

Non-intrusive

Cheat Codes

Cheat codes let you tweak boot behavior:

Change screen resolution settings

Change desktops

Change kernels

Bypass mistakes in hardware detection

Free up the CD-ROM

Expert and others

Persistent Settings -
/usr/sbin/saveconfig

saveconfig can save a number of settings

Desktop

home directory “dotfiles”

network and display settings

printers and other settings in /etc

Doesn't auto-update

“myconf=scan” restores settings

Tweak without remastering

Persistent Settings -
mkpersistenthome

Creates a filesystem image of /home

usb key/floppy drive

hard drive partition

Always current settings

“home=scan” restores settings

Knoppix the Linux installer

Copies full CD to disk (requires 2GB)

GUI and text-based

Knoppix 3.4 and greater has 3 installation types:

Debian

Knoppix

Beginner

Not exactly pure Debian

Knoppix the Admin Toolbox

Backup filesystems

Image disks

Emergency services

Apache

Samba

NFS, FTP, MySQL, BIND, etc

Forensics

Knoppix the Rescue Disk

Excellent hardware detection

Safe for the underlying system

Comes with useful rescue tools: lilo, grub, dd, gpart, dpkg, rpm, etc.

Full Internet access for troubleshooting

Games!Productivity Applications

Knoppix the Windows Recovery Disk

Write to the full disk (even NTFS)

Fix boot.ini

Scan for viruses

Install files from .cabs

Blank passwords

Edit the registry

Make Your Own Live CD

Check other Knoppix derivatives

Copy Knoppix structure to a hard drive

chroot

Make changes

Recreate compressed filesystem

Recreate .iso

Test with bootfrom

Burn to CD

Catastrophic Screw-ups?

root@ttyp0[/]# rm -rf .

C:\ fdisk /mbr (or installing Windows)

root@ttyp0[/]# dd \ if=/lib/grub/i386-pc/stage1 \ of=/dev/hda bs=512 count=1

Death-(well MBR-)defying Live Demo!

Delete the complete Master Boot Record and restore it and grub using Knoppix

I Like My Laptop

Fujitsu P2110 (867Mhz Crusoe, portable, 10.6” 16:9 display, excellent battery life)

Dual-boots Debian (95%) and Windows 2000 (5%)

New 5400RPM 16MB cache hard drive

Lots of custom scripts and tweaks (http://greenfly.org/fujitsu)

How to Erase Your MBR

<insert disclaimer>

root@ttyp0[/]# dd if=/dev/zero \ of=/dev/hda bs=512 count=1

Boot Knoppix

Use console mode (boot with knoppix 2)

Not necessary, but saves time since all the recovery tools are command line based

Gpart

gpart (short for “Guess Partition”) scans a drive for anything that looks like the beginning and end of a partition, then creates a MBR based on it

works best with primary partitions

not perfect (double check results)

Run Gpart

First run gpart without the -W option to test

root@ttyp0[/]# gpart /dev/hda

Then use -W to actually write the changes

root@ttyp0[/]# gpart -W /dev/hda /mnt/hda

Tweak the Results

gpart might not correctly find the end of all of your partitions. Use a tool like fdisk or cfdisk to recreate the partition to fill up its space in this case.

Fix Grub

Mount the Linux partition that contains your /boot directory read-write

root@ttyp0[/]# mount -o rw

/dev/hda3 /mnt/hda3

Run grub-install to restore grub to the boot sector

root@ttyp0[/]# grub-install --root-directory=/mnt/hda3

/dev/hda

Reboot

Questions?

Other Resources

Official Knoppix Website:

http://www.knoppix.org

Unofficial Knoppix Forum (English):

http://www.knoppix.net

2004-08-02T22:15:28