Basic Poor Mans
The Basic "poor man's installation" of Knoppix 3.4 (and Later)
Using the 'tohd' and 'fromhd' cheatcodes
Original text by j.drake with input and help from countless people who are all smarter than me.
You may have read about how to dual boot Windows and Linux using a boot loader (e.g., GRUB, LILO, loadlin, etc), and may have even seen people describe these options as "easy". Easy is a relative term, and many of these solutions have merit, but this particular solution is one which will give you full functionality with the Knoppix live CD that you already have. There are no strange applications to Google for or download, you do not have to edit any scripts, and you do not have to use the console. Everything described here can be done from the graphical desktop or the boot prompt, just as with Windows. There may be fancier and more elegant ways to accomplish this, but the point here is to be basic. Having said that, don't get the impression that this isn't powerful. It is. You will be able to perform virtually any task that someone with a hard drive installation can perform, but without a lot of the hassle. Moreover, this type of installation is virtually unbreakable, because the whole system is contained in just one read-only file. So, there is no way to ruin the system configuration. Many experienced linux users use and develop powerful applications with this very setup, not because they don't know how to do it any other way, but because this method provides fewer problems.
If you can load and run the live CD, and if you have some storage option available to you that is not formatted in NTFS (preferably a hard drive partition, but could be a USB stick or some other recognized storage device), you're good to go. This how-to is for Knoppix 3.4 or later.
Be sure to read and understand the introductory information on the WIKI page Poor Mans Install.
- 1. Partition as necessary. My personal recommendation is to partition now, just as you would for a full HD install or dual boot. That way, if or when you decide to make the switch to a HD install, you're halfway there already. Reserve at least a gig for the image partition (I'll call it hdb1), but make it more like 5-10 gig if you eventually want to make it a root partition for a hd install, and if you have room. As long as you are partitioning anyway, reserve 0.5 gig or more for linux swap, and create one or more partitions for data and programs, including the persistent home, however big you need or want (we'll call that hdb5 in the example). You may also want a FAT32 partition for sharing data between linux and Windows. I recommend Qtparted for easy graphical partitioning, which is already on the Knoppix disk. With the more recent versions, you CAN safely repartition an existing NTFS partition. If you want your persistent home (PH) as a partition, the script will format it to ext2 and wipe out everything currently on that partition in the process, so plan for that in advance. You can also save the PH as a file in an existing partition if you prefer.
- 2. Boot the Knoppix CD, using the default configuration, or whatever cheatcodes you're accustomed to using. For example, you might use knoppix26 to load the 2.6 kernel. Find the storage device you want to use (not NTFS), and make it writable (see item #2 in the What You Need to Know section, above).
- 3. Create a persistent home (PH). A persistent home is a location for saving files and programs. Think of it as a combination of "My Documents" and "Program Files" in Windows (in fact, you could create subdirectories with those functions, or even those names, if you want, but let's worry about that later). If you don't want to partition, just save your PH as a file wherever you like. Click the penguin icon on the toolbar, and click Configure. From there, you can see the links to set up a persistent home, and to save your configuration. Do the PH now picking a non-NTFS location if you save it as a file, or picking a partition to be reformatted using ext3 (e.g., I used my whole hdb5 partition, but I could have saved it as a file in that partition if I had existing data, or if I didn't want it reformatted), log off and restart. From now on, you will add a cheatcode to get Knoppix to recognize that home (in my case, home=/dev/hdb5 or home=scan).
- 4. Boot the CD with whatever cheatcodes you used before, but include the following cheatcode as well - I'll use hdb1 as the example for where I want the OS folder located: tohd=/dev/hdb1/. So, if you created your persistent home at the hdb5 partition, your boot might look like this: knoppix26 home=/dev/hdb5 tohd=/dev/hdb1, or if you saved your PH as a file and didn't partition, it might be: knoppix26 home=scan tohd=/dev/hdb1. The boot process will copy the image there and continue booting off the CD. Log off and restart.
- 5. This time, you want to restart and substitute the cheatcode fromhd=/dev/hdb1 for the tohd location you specified in step 3. For example, knoppix26 home=scan fromhd=/dev/hdb1. The boot process should now be a lot faster, and you can remove the CD until the next time you boot. If you haven't already saved your configuration, you can do so now. Save it wherever you like (not NTFS) - if you want to use the same location as your persistent home, go ahead. Following the example above, your cheatcode string might now be: knoppix26 home=/dev/hdb5 myconfig=/dev/hdb5 fromhd=/dev/hdb1, or knoppix26 home=scan myconfig=scan fromhd=/dev/hdb1. Add any other cheatcodes you want or need, as long as each is separated by a space. If you aren't familiar with saving a configuration, basically it allows you to change the default Knoppix configurations that come on the CD, so you can define your printer file, or change the background on your desktop, or add icons, and Knoppix will remember these customizations with each reboot, provided that you add the myconfig cheatcode when you boot.
- 6. Now that you're all set up, you can easily find your saved documents in your home directory. You don't have to remember the details - just click the house icon in Konqueror.
- 7. The easiest way to install programs is by using Klik. Open Konqueror (not Mozilla or any other browser), and type in the following URL: http://klik.berlios.de/ then follow the instructions to install Klik. You will see a number of programs available to you for automatic installation. If you don't see the one you want listed, you can try the following command (still experimental) klik://softwarename into the address block of Konqueror.
Comments, debates, recommendations and personal preferences, can make a how-to confusing when they are inserted into the main text. I would suggest that we post such matters here, to allow for peer review and comment. As with the buglists, it might help to append initials, to prevent comments from being misattributed to others, and to facilitate debate and resolution of controversial issues.(jd)
It has been reported that "tohd" will not work for an external hard drive connected via a PCMCIA card; only via built-in firewire or USB port.flowers
Some users are insistent that you should not save your 'personal configuration' data when you also have a persistent home, and that you must deselect it every time you save. I have not found this to be an issue, but I agree that once the PH is set up and the configuration is saved, it is unnecessary to save it in the future. Rather than debate the point, I moved it to the comments. Those who wish to research the issue further can search the forum and come to their own conclusions. Nothing will "explode" if you save the configuration with a PH; so use whatever works for you.(jd)
(somebody really screwed up all the text below, they even messed up the external links for some dumb reason, so forgive me if I didn't restore it properly)
- I had some problems doing this kind of install and ultimately decided not to use it.
- For laptop users, this won't work if you want to install Knoppix to an external hard drive that you have connected using a PCMCIA card. "tohd" will fail because the partition isn't mountable early on in the boot process. It will only work if you connect the drive to a built-in firewire or USB port. Perhaps Knoppix could load a mini-Linux kernel early on so that we could have a "boot from firewire/usb2 drive" option, see: http://www-106.ibm.com/developerworks/linux/library/l-fireboot.html?ca=dgr-lnxw16FireBoot
- Even after switching to using a built-in firewire connection for my external drive, I got an error that KDE couldn't load because it couldn't write to the partition, even though I made it writeable earlier. This is probably because you can't have knoppix and your persistent home be on the same partition, like a person commented below. So I'll try again using 3 partitions (for swap, home, and knoppix root).
- That worked, but the configuration does not appear to be saved between reboots. If I change the desktop background and reboot, the default one appears again. (NOTE: I think you have to resave your knoppix configuration after changes. I believe this is the way it's meant to work. This will rewrite your knoppix.sh file, if you modified it as per comment below.)
- I tried apt-get to install GNOME and Mono, but got the error "Unable to write to /var/cache/apt/", even when using sudo. So either that is another error that wasn't supposed to happen, or using this Poor Mans Install you can only use something like Klik to install software.
- Alternative to Poor Man's Install: Pivot Root Install I found instead an alternative way to install Knoppix to an external hard drive that I will try. You do a regular hard-drive install to the external drive (see Hd Install HowTo), then boot from the CD, and use pivot_root to switch to the hard drive system. See http://www.knoppix.net/forum/viewtopic.php?t=6463 and Pivot Root Install. So the only disadvantage is that you have to type a some commands each time you boot, but the advantage is you have a full Linux system that you can update however you want. Also using this method I can really use any computer to run my linux system, just by inserting the CD and connecting the external drive.
I had problems with 'Save knoppix configuration' and persistent home directories with this method on an ibm 1300 i series laptop.
The internal wireless 802.11 would not be detected. I think the problems were related to the pcmcia detection happening twice.
I now start knoppix with knoppix fromhd=/dev/hda6 home=/dev/hda2/knoppix.img myconfig=/dev/hda2 nopcmcia nodhcp ...
AND using a slighly edited /dev/hda2/knoppix.sh file. I just changed the last lines to:
#killall pump 2>/dev/null && sleep 2 && killall -9 pump 2>/dev/null && sleep 2 #echo "ESC[[1m(Re)starting PCMCIA services.ESC[0m"; killall cardmgr 2>/dev/null && sleep 6; cardmgr && sleep 6 echo "ESC[1mStarting daemons...ESC[0m" /etc/init.d/pcmcia start; sleep 5s; for i in ifupdown networking; do [ -x /etc/init.d/$i ]] && /etc/init.d/$i start; done
A few comments: (All prefaced with 'In my limited experience' :) - the partition used for home= and myconfig= need to be different than the paritition you put the cd image on (mounts image ro?) (technically, this isn't true, but you do have to watch the order of the steps and create the PH before you load with the fromhd cheatcode)(jd) - Some of the problems occurred while figuring out how to configure lilo so I could boot this from the hd. So I wasn't always booting from the cd.
Anyhow, config and home dir on hard drive and 802.11 work solid for me now.
NOTE: Instead of: killall pump 2>/dev/null && sleep 2 && killall -9 pump 2>/dev/null && sleep 2 try using pump -k (gnarvaja)
--- Revised 9-16 to incorporate comments about separating out the partition for the program into the text. Note that a paragraph was added to sec. 1 of the What you need to Know area, and a new paragraph 1 in the steps. FWIW, I have actually gotten this to work with the program image and saved config in the same partition as the PH, but it does create more problems down the line, and I think it's actually easier to plan it out ahead of time as a separate partition.(JD)
Maybe its obvious but the partition named in tohd= must be formatted as a ext filesystem (mkfs.ext /dev/hdaX) If you don't you get a confusing error about the paritions size being too small. --Thomas Rynne
Revised 11-15-04 to move comments to comment section.(jd)