Once you are comfortable using Knoppix for your desktop, you might find yourself booting onto the CD more often. While you can create persistent settings and a portable home directory to mount, at some point you might decide you would like to use Knoppix full-time by installing it to your hard drive.
The Debian GNU/Linux distribution, on which Knoppix is based, is becoming much more popular, but the Debian installer can be daunting even for the experienced Linux user. Some of the more complicated parts of the install ask questions that the new Debian user might not know the answers to. Knoppix handles all of the hardware and network configuration for you and comes with a great selection of applications, so it wasn’t long before people began asking for a way to install Knoppix on their hard drives. As Knoppix’s harddrive installer has progressed, it has become known as the quickest and easiest way to obtain a Debian testing/unstable installation.
The Debian testing branch is a blend of the stable and unstable branches, and it consists of packages from the unstable branch that have been shown to be stable for some time. Once the packages in testing have been tested enough, Debian will declare the testing branch the new stable branch.
Some people mistakenly believe that the packages within the unstable branch are buggy. While packaging bugs and instability are more common in the unstable branch than in testing or stable branches, the packages in the unstable branch still undergo a fair amount of testing before release, particularly for large, popular packages such as desktop environments and X. It is commonly held that the packages in the unstable branch are as good as any you would find in other Linux distributions, if not more so.
You often hear Debian branches referred to as Etch, Lenny, and Sid. These nicknames refer to the stable, testing, and unstable branches, but change with each Debian release. For example, Etch is the name for the Debian 4.0 release. For as long as Debian is at 4.0, Etch will also be synonymous with the stable branch. However, with the next Debian release, Lenny (the current nickname for the testing release) will be declared stable, and will then become the nickname of the new stable branch. A new name will then be assigned to the testing branch. The advantages to this distinction are that you can choose to follow either a group of packages such as Lenny, which means you will eventually be running the stable release, or you can choose to follow a branch by its name. If you are using the testing branch, you can continue to use the testing branch even when the Lenny packages become stable.
The exception to this naming rule is the unstable branch. It will always have the nickname of Sid (after the boy in the movie Toy Story who broke all of the toys), and that name does not move up the list as packages stabilize.
This chapter discusses the state of the current Knoppix hard-drive installer, knoppix-installer, and provides a few installation scenarios that provide a complete guide to installing Knoppix on a single-boot setup and as a dual-boot setup with Windows. As you’ll soon see, installing Knoppix is easy even for new Linux users.
Learn the ins and outs of the Knoppix installer before installing.
Knoppix was originally intended to run just from the CD, but early on, users wanted to transfer the system to their hard drives once they discovered how well the CD recognized and worked with their computer. At first, this involved a complicated set of commands run from a shell to copy the CD to the hard drive and set up a boot loader. Eventually, this method was automated with a script that was created by Fabian Franz (http://www.fabian-franz.de) and was recently updated by Martin Oehler for the 5.0 release.
The latest version of the hard-drive installer is pretty sophisticated and does much more than just copy the CD to the hard drive. Start the installer from the terminal by using:
The knoppix-installer script works both in a pure console environment and in X. If you run it from the console, navigate through the options with your keyboard, and hit the spacebar to select options and Enter to confirm them. If you run the script from X, you have a GUI that you can navigate with either a keyboard or a mouse.
Before you even get to the main menu, the installer checks to see that some minimum requirements are met. The first check is for the presence of any Linux partitions (including partitions containing other distributions) that contain enough space to store all of the uncompressed files on the disk plus 18% for overhead. For the CD, this means around 2.4 Gb, and for the DVD, you need around 13 GB. For systems with less than 512 MB of RAM, it also checks for a swap partition of at least 128 MB. If either of these conditions is not met, the installer presents you with the following informational warning and the option to partition the hard disk or quit:
I’ve noticed a bug in the DVD version of the installer where it only checks that you have enough free space to accept all the files from the /KNOPPIX directory. However, the DVD also has a /KNOPPIX2 directory that it uses but does not add into the free space check. So if you do a DVD install, be sure that you have at least 13 GB of free space.
You intend to install Knoppix, so the only choice is to select the Partition option. In X, qtparted runs, a graphical partitioning program, somewhat similar to Partition Magic, which you can use to create, delete, and resize partitions on your system. If you run the installer from the console, cfdisk launches instead. In either case, the goal is to create partitions to satisfy the installer requirements. Once you finish and close qtparted or cfdisk, the installer checks again for partitions it can use; if it finds them, the main installer menu appears (see Figure 4-1).
Opens a new window that asks you which style of Knoppix install to use and where to install it.
Starts the installation process based on whichever configuration is currently loaded. If no configuration is loaded, it walks you through the configuration just as though you had selected Configure Installation.
Starts qtparted in X or cfdisk in a console so you can partition your hard drive and presents you with the option to partition the hard disk, resize drives, etc., without having to exit the installer.
Loads a configuration you have created beforehand from the home directory, floppies, USB drives, or any mountable storage device; this can be useful if you want to clone installations across multiple machines.
Saves the installation settings currently loaded (either from selecting Configure Installation or Load config) to a file on the home directory or any mountable storage device so you can load it later.
Exits the program without saving any settings.
If you are ready to install Knoppix and are familiar with the configuration options, or you have already configured the installer a previous time (if you configure and then exit the installer, Knoppix remembers the settings that you have chosen), skip right ahead and select Start Installation. If you are new to installing Knoppix on your hard drive, you should probably select Configure Installation so you can see what kind of questions the installer asks before you commit to an install. When you choose Configure Installation, you are presented with a window that asks you to choose from one of the three types of systems:
This is the default method for installing Knoppix to a hard drive. This choice offers a multiuser Debian install without any extra Knoppix hardware-detection scripts. This means that the only cheat codes that still work are those that are actually options passed to the kernel (such as
noapic, noscsi, etc.). Think of this as the beginner option without any of the hardware-detection scripts. Experienced Knoppix users may recognize this as being the same installation method provided by the old Knoppix installer scripts. Choose this option if you want to use Knoppix as an easy way to install a purer form of Debian.
With this option, Knoppix sets up a multiuser Debian system, but also leaves all of the Knoppix hardware-detection scripts behind. You can still use most of the cheat codes at boot time and still have Knoppix run some of its hardware-configuration scripts. This type of installation is a blend of the best features of the other two system types. The downside is that the hardware detection scripts can potentially overwrite any hardware settings you might have made manually the next time the system reboots.
This choice basically creates a copy of the live disk on your hard drive and allows you to boot from it. Just like the disk, this option installs only a single-user system with disabled passwords. Think of this option as running the Knoppix disk only without the disk restriction, so you can permanently install new software or updates, and permanently edit system files. Because passwords are disabled, this system type is potentially less secure than the other two.
Once you choose a system type, the installer shows you a list of potential partitions on which it can install. If you don’t want to install on any of these partitions, click Previous until you can choose the Partition option, and then create a new partition.
Once you select a partition, Knoppix asks for personal information, such as your name, your username, your user and root password, and where you want to install the boot loader. You won’t necessarily be asked all of these questions. It depends on the system type that you have chosen (for instance, the Knoppix system type uses the knoppix user just like the CD, so it won’t ask you for a username). Once you answer all the questions, the configuration is complete and Knoppix drops back to the main menu, and allows you to start the installation with the options you have just configured, or to save the options so you can use them later.
Once you are satisfied with your configuration, click “Start Installation.” A report appears and displays the different options that Knoppix can use for the install with a final prompt before proceeding. Once you click Next, Knoppix begins the install process, so be certain everything is configured how you want it.
Make sure that all of your hardware is working before proceeding with the install. If you need special cheat codes for your hardware to work properly, make sure that you use them for this boot, because these are the hardware settings Knoppix uses for the install. This is especially important if you choose the Debian system type, which does not install the Knoppix hardware-detection scripts, because any hardware that isn’t working when you install must be configured later without the benefit of Knoppix’s scripts. (It is technically possible to reuse Knoppix’s configuration scripts in this mode, but it requires a series of complicated steps.)
Now Knoppix formats the partition you chose and starts copying files to it. It does take some time to copy all of the files from the disk to the hard drive (especially with a DVD install), but unlike most other OS installers, you have a full set of applications you can use while the files are copying. Once all the files are copied, you have the option to create a boot floppy for rescue purposes in case the boot loader didn’t install properly (or you accidentally delete or break the boot loader later). After the installer is finished, continue to use Knoppix from the disk or reboot into your newly installed Knoppix system. Remember to remove the disk when you reboot, and if everything goes well, you should see a new boot logo.
Although it isn’t always possible to install Knoppix on its own empty hard drive, it certainly removes a lot of the complications that make installation tricky. These steps guide you through installing Knoppix on a drive that is unpartitioned and brand-new, or that you are willing to commit entirely to Knoppix.
From a terminal window, start the installer by typing:
Once qtparted starts, select your hard drive from the list of disks on the left side of the window (/dev/sda for our example). If you have any partitions that you need to delete before you can install Knoppix, select them and click Operations → Delete, then click on the gray free space labeled hda-1 and select Operations → Create.
The Knoppix installer requires that you create a swap partition, so select linux-swap from the Partition Type drop-down menu, and then choose a size for the swap, as shown in Figure 4-2. The current rule of thumb is to pick a swap size, ranging from your amount of RAM to twice that amount, so for a system with 256 MB of RAM, you should choose a swap size between 256 MB and 512 MB. Click OK, and qtparted shows a new swap partition at the beginning of the disk.
To create your root partition, click on the gray free space after the swap partition, and select Operations → Create again. The qtparted program defaults to creating an ext3 partition that spans the rest of the free space. Knoppix also supports installing to ReiserFS partitions. This example is for the Debian system, so click OK to create the partition. After you partition the drive (as shown in Figure 4-3), click File → Commit to save the changes to the disk. Once the changes are saved, close qtparted and the main installer menu should appear.
To start the configuration process, select Configure Installation and click OK. Select the Debian system type, and press Enter or click Next. The installer then asks you to choose the partition on which to install Knoppix. In our example, there is only one partition, so simply click Next.
At this stage of the install, set up user accounts. At the first window, enter your full name. The next window prompts you for a username; the default is your first initial and last name. If that is fine for you, then continue to the next window—otherwise, change the username. You are then asked to enter a password for your user. You can uncheck Hide typing if you’re having trouble entering your password twice.
The next window looks like the previous one, but this password is for the root account. The root account is a special account that has the ability to change and delete any file on the system, so choose a good password. You will use this account only when changing system settings, installing packages, or other potentially dangerous things.
Once your accounts are set up, it is time to enter a few system settings. The first setting is the hostname. This is the name your computer goes by on the network. You are asked to accept the default hostname or enter one of your choosing. Next, you choose where to install the boot loader. This is the only operating system on the disk, so choose MBR. This installs the boot loader on the boot sector of the Master Boot Record, the first 512 bytes on any hard drive that contains the boot code and the partition table. Now the configuration is done, and you are ready to install.
To install Knoppix on your hard drive based on this configuration, select Start Installation and click OK. Read over the list of configuration options Knoppix presents you, and make sure everything is configured to your liking. Click Next to start the installation.
Once Knoppix is finished copying files, you are prompted to create a boot floppy. Boot floppies are important in case you accidentally delete your Linux kernel or otherwise damage parts of the boot process. Insert a floppy into your drive, and click Yes to create a boot floppy or click No to skip creating it. Once the installer exits, log out and reboot the system. Be sure to remove the disk when it ejects, and at reboot, you should be presented with the boot screen for your brand new Knoppix install.
A lot of people who use Linux also dual-boot their computer to Windows. The two most worrisome parts of such a setup are partitioning the drive and configuring the boot loader. Here’s how to install Knoppix in a multiboot setup.
Installing Knoppix in a dual-boot configuration is a bit trickier than a clean install, as it requires you to resize partitions to make room for Knoppix and possibly requires you to configure your boot loader. This hack walks you through a typical Knoppix install that dual-boots with Windows. This walk-through assumes that Knoppix is being installed on a computer with a single IDE hard drive containing a single Windows partition that fills the drive.
As in the single-boot system example (“Install Knoppix as a Single-Boot System” [Install Knoppix as a Single-Boot System]), start the Knoppix installer with the following command:
You are prompted to create partitions for Knoppix to install to. The entire hard drive is filled with a single Windows partition, so you have no free space to create a partition. Luckily, you can resize your Windows partition with qtparted, which can resize both FAT32 and NTFS partitions.
Resizing a partition can be risky, and there is always a potential for data loss. Before resizing any partition, defragment the hard drive completely from within Windows; otherwise, a file fragment near the end of the partition might be deleted when the partition is resized. Of course, it is always a good idea to back up any important data.
To resize your hard drive from within qtparted, select /dev/hda from the list of disks on the left side of the qtparted window, then click on the /dev/hda1 partition listed on the right side and select Operations → Resize. In the resizing window that appears, you can decide how much free space to leave after the partition. In my experience, I’ve needed to create a root partition of 2.2 GB to have enough room for the Knoppix files, and if you install from the DVD, you will need 13 GB. In our example, resize the partition so that 2.5 GB of free space is available, so you have enough room for the 2.2 GB root partition and a swap partition. After you click OK, qtparted displays the free space you have just created in the main window. Now click on the gray free space, and create a swap partition and a 2.2 GB root partition, as covered in [Install Knoppix as a Single-Boot System]. Once you are finished resizing, click File → Commit to actually perform the resizing and partition creation. After you commit the changes, close qtparted to return to the main installer menu.
Depending on the type of system you have, your hard drive might be listed as /dev/sda instead of /dev/hda (this is often the case with SATA drives, for instance). If you only see /dev/sda and don’t see /dev/hda, chances are /dev/sda is the drive you want to configure.
The next step is to configure the installation by selecting a username, password, and so on. Once you are finished, click Start Installation to start copying the files to the partition. After this process, you are prompted to create an optional boot floppy, after which the installation is complete.
During the install process, Knoppix attempts to automatically detect any Windows partitions on the drive and will add them to the boot choices in /boot/grub/menu.lst. If you are multibooting with another Linux system, be aware that Knoppix overwrites your boot loader with its version of grub. To fix your menu.lstfile so you can boot both your new Knoppix install and your old Linux install, finish the Knoppix install, then mount the root partition for your new Knoppix install. Then edit the /boot/grub/menu.lst file and update grub,as in “Repair Grub” [Repair Grub]. Restart the computer and remove the disk from the drive, and you should see a new boot prompt with options for booting either Linux or Windows.
If you would like to change the OS from which your system boots by default, boot into your new Knoppix install and edit the /boot/grub/menu.lst file as root, changing the line that reads
default 0 to
default 2 or whatever number your Windows partition is assigned at the bottom of the file. (Keep in mind that grub starts counting from zero, not one.)
You should now be able to boot either into Knoppix or Windows. Just as when booting from the CD, the Knoppix hard-drive install has your Windows partition icons on the desktop, allowing you to access files in the same way you are accustomed to.
Even though Knoppix is based on Debian, and the installation instructions help you install Knoppix on your hard drive, what you have installed is a hybrid Debian system. Here’s how to convert a Knoppix install to as close to a standard Debian unstable branch distribution as you can get.
Knoppix is based on the Debian GNU/Linux distribution, but Knoppix uses a unique mix of packages from the stable, testing, and unstable branches, as well as from other unofficial Debian repositories. As a result, even if you select the Debian system install type, you won’t get the same system as if you had installed Debian unstable from scratch. There are some steps you can perform, however, to get closer to a Debian unstable system.
The installation process for this system is almost exactly the same as for [Install Knoppix as a Single-Boot System]. Remember, with the Debian system type, Knoppix does not include its hardware-detection scripts in the install, so make sure that you have all of your hardware detected and configured before you start the install. In order to convert the install to Debian, the real work begins after the files have been copied, and you boot into the new system.
Once you boot into your new Knoppix install, you must change your Advanced Package Tool (APT) settings. APT is a management system for software packages. Under Debian, it provides a series of tools to ease installing, removing, and updating packages. The most commonly used APT tool is apt-get, which automates downloading packages and their dependencies for installation. When you tell apt-get to install a package, it finds the newest version of the package from its list of package repositories. Then it checks its local cache of packages, and if it does not have the package you need, it downloads the package and any dependencies directly from the repository. All of the configuration files for APT are located in the /etc/apt directory. The /etc/apt/sources.list file contains a list of all the repositories the APT tool uses to look for packages. The /etc/apt/apt.conf file contains APT settings, such as which Debian branch to use by default.
The first step to convert Knoppix to Debian unstable is to edit /etc/apt/apt.conf as root, changing:
This setting controls which branch Debian defaults to when installing and upgrading packages. By changing testing to unstable, you tell Debian to upgrade any packages from the testing or stable repositories it might have installed to unstable at the next upgrade, and to default to installing from the unstable branch in the future.
The next step is to update the list of repositories APT uses by editing /etc/ apt/sources.list as root. The default Knoppix sources.list file has sources for stable, testing, unstable, experimental, and a few other repositories. Comment out all of the stable and testing repositories, which ensures that all our installs use the unstable packages. It is up to you if you wish to leave some of the other unofficial repositories in your sources.list. For a pure Debian Sid system, delete all of the lines in your sources.list file, and edit it to look like this:
# Unstable deb http://ftp.us.debian.org/debian unstable main contrib non-free # Unstable Sources deb-src http://ftp.us.debian.org/debian unstable main contrib non-free
Once you have edited your sources.list, update your system to unstable by running the following command as root:
apt-get update && apt-get dist-upgrade
This command downloads the latest list of packages from each source in your sources.list file, and then it upgrades the distribution to the very latest versions of each package. This ensures that old packages from stable or testing are replaced with packages from unstable.
As the packages install, you might be prompted that a configuration file for a package has been modified since installation. Chances are that Knoppix modified these configuration files to better suit your system, so it’s safe to go with the default and keep the current version of the configuration file. Once this update has completed, your system should be up-to-date with the current Debian unstable.
As a final note, some packages on the Knoppix system come from other unofficial or experimental repositories, so there still might be a few packages on the system that can’t be updated in this manner. Packages from the experimental repository, given time and testing, typically find their way into unstable. After using and updating your system, these packages should eventually sync up with unstable. In the case of packages from other sources, you must decide whether to keep these repositories in your sources.list file, so the packages can be updated, or you must decide whether to leave these packages at their installed version by leaving out the repository.
Installing Gentoo can be an overwhelming and uninviting task because you are limited to a shell interface, and the computer is unavailable for tasks during the installation. That is, of course, unless you use the Knoppix CD.
Gentoo is a Linux distribution that aims to create a system that is optimized for your computer. One of the ways it attempts this is by compiling each program from its source code before it installs and providing an automated means to update and install new software by downloading and compiling from the source code. Gentoo provides detailed documentation on how to install the distribution, but even then the installer can be challenging to newcomers. Knoppix makes installing Gentoo a much less painful experience. The Knoppix hardware detection seems to be more robust and is much more successful than the Gentoo system. A Gentoo install involves downloading packages from the Internet, so Knoppix provides you with much better support for your particular NIC. Furthermore, your computer is still fully functional while you compile the base Gentoo system, which provides you with some additional advantages. First, the compilation process for a Gentoo install can take hours, so with Knoppix, you can browse the Web, play games, and get work done while the system compiles in the background. Second, you can browse the Web with a graphical web browser, so if you run into a roadblock in the installation process, you can head straight to the Gentoo forums at http://forums.gentoo.org to ask a question. The installation instructions are also readily accessible (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml), so there is no need to print them out. The instructions are very thorough and explain not only what each step is, but also why it is necessary.
These two reasons are also true for installing Gentoo from a chrooted environment on an existing Linux install if you didn’t want to install via the Knoppix method. Knoppix gives you the advantage of using the entire hard disk for your Gentoo install. If you have only a single hard drive and Linux is already on it, you can’t exactly wipe it entirely clean while you are in the middle of using it.
Installing Gentoo from Knoppix requires very few additional steps. First, boot your Knoppix CD with the
noswap cheat code. This cheat code tells Knoppix not to automatically use any existing swap partitions it finds on the hard drive. This saves you extra steps of disabling the swap later if you need to delete the swap partition to create new partitions on your drive for the install. There is no need for a Gentoo Live CD, because the Knoppix CD is replacing it in your setup. When the desktop finishes loading, open a terminal window. At the prompt, type:
This switches the current user to root and reloads the shell configuration. Next, type:
While naming the mount point gentoo is not strictly necessary, it does make it easier to follow the install documentation that asks you to mount the root filesystem under /mnt/gentoo. All Knoppix-specific steps have now been completed.
The first page of the Gentoo Installation Handbook has links to each chapter of the install. You are using a Knoppix CD for the install, so the first few chapters only provide information about the install process. You won’t actually start performing any of the steps until Chapter 4.
Chapter 1 of the Gentoo Installation Handbook provides an overview of the entire installation process.
Chapter 2 describes the differences between the stages and how to boot the Gentoo CD. When you read Chapter 2, ignore the CD-booting steps, and instead focus on the differences between a Stage 1, Stage 2, and Stage 3 install. Each stage starts you at a different point in the compilation of the base system. The later the stage you choose, the less input you have into how the base system is configured. Which stage you choose is mostly a matter of personal preference and depends on the amount of time you have for this particular install.
Chapter 3 describes some additional steps that you may need if you are using the Gentoo CD, but since you are not, these steps can be safely ignored.
Once you have chosen a stage for the install, you are ready to start the Gentoo install process. First, partition and format your disk, as described in Chapter 4. Then simply follow the rest of the Gentoo Installation Handbook to complete the installation. Remember to retrieve your stage tarball from the Internet, as described in Chapter 5.b.
Now you have all the benefits of having a Gentoo system, such as the excellent portage package manager, but with a much less painful installation. If you enjoy puzzle games, I recommend playing Frozen Bubble while you wait for the system to compile.
Use the latest Knoppix release to update your current installed Knoppix system.
Knoppix has always been designed to be run directly from the CD. As this chapter has shown, this can present some challenges when you want to install Knoppix to a system and particularly when you want to upgrade it. Recently, Knoppix has added an extra feature to its install tool to make even the upgrade process simpler.
With the Knoppix upgrade feature, all you need to upgrade an old install of Knoppix is the latest Knoppix release. Boot your system from the Knoppix disk and then type:
to start the Knoppix installer. The installer will detect your installed Knoppix system, and the very first option you see will be “Update Starts the package updater.” Select that and Knoppix will prompt you for which disk to update. Choose the device that corresponds to your root partition (likely /dev/hda1 or /dev/sda1). Knoppix will set up your system behind the scenes to allow it to be updated directly from the CD and then launch the kpackage package management tool. While this program can install RPM and DEB packages as well as manage the packages that are on the system, you won’t use these options to update Knoppix; instead, click a special option: Special → Apt:Debian → Upgrade. A new window will appear and run through the full list of software that needs to be updated. You can monitor the progress of the update tool through this window, but for the most part you can sit back and let the tool update the system. The benefit to this method is that you can update directly from the disk and don’t have to download packages from the Internet. Plus if you haven’t updated your Knoppix since you installed it, this will minimize any trouble with package dependencies.