Rescue FAQ

From Knoppix Documentation Wiki
Jump to: navigation, search

Return to Knoppix FAQ

Knoppix is a great rescue disc too. You can repair Linux or any other OS, backup data, recover passwords, etc. The following solutions assume that you have booted Knoppix on the machine that needs to be repaired.

Q: I need to get into my Debian system to update some packages as my system is unable to boot! How do I do that?

A: Boot with the Knoppix CD and mount that partition using the Knoppix root shell. For example:

  • mount /dev/hda1 /mnt/hda1
  • chroot /mnt/hda1

Gives you a root shell back in your old system! Now get the resolved and updated packages [1] and dpkg -install them to fix the previous show stopping packages.

Q: My other Linux install is broken and I want to reinstall LILO.

A: Mount that partition and run LILO as root:

  • e.g. mount -o dev /mnt/hda1, if its already mounted, you'll have to clear the "nodev" flag: sudo mount -o remount,dev /mnt/hda1.
  • Enter that directory as root and run lilo: chroot /mnt/hda1 lilo.

Q: Ok, I've booted Knoppix, now how do I rescue the data?

A1: See Computer First Aid Using Knoppix, System Recovery and OSCON 2005-08-04 System Rescue with Knoppix.

A2: One of the best ways to recover your files is to plug in a USB drive of some sort.

  • When the desktop loads, you will see at least two hard drive icons on the desktop (one for your hard drive and one for the USB drive).
  • Click on the hard drive icons to open them up and figure out which drive is which.
  • Right-click the USB drive icon and choose "Actions > Change read/write mode" so you can write to the drive (it's read-only by default for security reasons).
  • Now find the files you want to back up and drag and drop them to the USB drive. When you are finished, shut down the system and remove the USB drive.

A3: If you have a CD burner installed (in addition to the drive that you booted Knoppix from), use one of the various tools on Knoppix to create a CD. If you have 1 gig of memory you can use the toram "cheat code" so that you will not need to keep the CD in the drive if you only have one CD drive. See the wiki section on Cheat Codes for more details on how to use toram and other cheat codes.

A4: If you want to backup over the network, you can use NFS, Samba (windows share), scp (ssh copy), FTP, email or more. One method, using two networked machines on knoppix is as follows: boot knoppix on both machines (the "broken" machine and the target machine), start ssh server on the target machine, "kmenu->KNOPPIX->Servers->SSH Server", mount a device with sufficient space in read/write mode (note: NTFS does not currently support read/write). Then you can use scp to move the data from the broken machine to the target machine (in this example, the target machine has an IP address of On the "broken" box (get a root shell) issue a command scp -r /mnt/hda1/importantdata/ knoppix@ this will copy an entire directory (recursively) to the target machine.

A5: If you don't have a USB device that you can use or another local system to transfer files to, you can send the files to an Internet site (although your Internet connection will be slower than a local transfer). You may be able to e-mail them to yourself. You may be able to save them on FTP or web space that your ISP provides. Or you can use any of a number of Internet sites that offer Free temporary storage of large files. One such site it, although there are others. Also, Google allows over 2 gigs of storage for Gmail users (although the size of a single file is somewhat limited).

A6: For some users the most simple solution is to stick another disk drive in the case and format it with a FAT32 partition. Or add a second CD or DVD drive.

Q: I'd like to backup/restore the MBR.


  • To backup use:
    • sudo dd if=/dev/hda of=mbr.backup bs=512 count=1
  • To restore use:
    • sudo dd of=/dev/hda if=mbr.backup bs=512 count=1

Caution the MBR contains the partition table (the first four primary entries) it will break things if you changed the partition since the backup.

If you do not want to restore the partition table you should use sudo dd of=/dev/hda if=mbr.backup bs=1 count=448 instead. This will write only the first 448 bytes of the MBR leaving the last 64 bytes intact (4 partition table entries * 16 bytes/entry).

Be warned that you may not be able to boot from this disk if you changed the partition table after the backup of the MBR, depending on the actual boot loader .

Q: I forgot my password for an installed Windows/Linux!?

Linux A1: You can change password by chrooting into installed linux and running passwd. You may need to mount your linux read-write:

  • mount -o remount,rw /dev/hd.. /mnt/hd..
  • chroot /mnt/hd..
  • passwd root

Linux A2: Delete the password hash from shadow:

  • edit the /etc/shadow file on your drive with any text editor (e.g. vi /mnt/hd../etc/shadow)
  • remove the password hash (contents of the second field) for root; e.g.

Windows: use the Offline NT Password & Registry Editor instead to reset it.

Q: The other Linux/*nix box does not work correctly, but im sure the network is functional.

A: try "ssh" and/or "telnet" to log in on that remote box. you'll need to know a password, but after that you can use the shell to repair the box.

Q: Rescuing knoppix with knoppix :-) "I am a new user to linux and i just installed KNOPPIX on one partition, but then i installed windows 98 on another partition and now i can't get lilo to come back.... how do i make it so lilo will come back"


  • boot from floppy
    • You can boot the system with the boot floppy you got when you installed Knoppix on HDD.
    • Then edit the file /etc/lilo.conf . After that start "lilo" as root.
  • boot from CD
    • Boot the CD and type "knoppix 2" (see Cheat Codes). This will start knoppix into the shell/commandline.
    • Mount your root partition mount /dev/hda1 /mnt, edit /mnt/etc/lilo.conf (insert your windows partition),
    • Change root to your hd install: chroot /mnt/hda1 (substitute hda1 for your hd install partition)
  • and execute lilo: lilo -v

Q: Are there any utilities on the knoppix disk to conveniently manage partitions, e.g. Disk Drake?

A: Tried parted ? [2] [3]

A2: For resizing Windows XP/W2K/W2K3/NT4/Longhorn NTFS, Solution 2 in the ntfsresize FAQ (Frequently Asked Questions) at [4] works well. Ntfsresize version 1.9.0 can even cope with fragmented partitions successfully. For backup of a partition, Partition Image and ntfsclone are great! [5]

A3: Knoppix also includes a graphical partition utility, QTParted, which is compatible with ntfsresize.

Q: How do I setup swap?

A: On machines with small RAM you would want to have a swap file when running Knoppix from CD. You can create a swap file on your partition, register it in /etc/fstab and turn swap on. Choose a mounted partition which has enough free space, for the purpose of this example let it be /mnt/hda1

  • Create a linear file: dd if=/dev/zero of=/mnt/hda1/swapfile bs=1024 count=65536 for a 64Mb swap file
  • Add the swap partition tables: mkswap /mnt/hda1/swapfile
  • Register the file in /etc/fstab: as root add a line /mnt/hda1/swapfile swap swap defaults 0 0
  • Turn swapping on: run swapon -a as root
  • Check that the swap file appears in /proc/swaps

A2: To have Knoppix use an existing linux swap partition, ...??

Return to Knoppix FAQ .