Difference between revisions of "Basic Poor Mans"


From Knoppix Documentation Wiki
Jump to: navigation, search
(removed spam)
(Replacing page with '{{delete|out of date}}--~~~~')
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==== The Basic "poor man's installation" of Knoppix 3.4 (and Later) ====
+
{{delete|out of date}}--[[User:Werner P. Schulz|Werner P. Schulz]] 05:24, 22 February 2012 (MST)
 
+
==== 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.
+
 
+
==== The tools: ====
+
 
+
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]].
+
 
+
==== Steps: ====
+
 
+
* 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.
+
 
+
----
+
 
+
==== User Comments ====
+
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.
+
 
+
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)
+
 
+
 
+
Some notes:
+
 
+
* 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.<br>
+
The internal wireless 802.11 would not be detected.  I think the problems were related to the pcmcia detection happening twice.<br>
+
I now start knoppix with '''knoppix  fromhd=/dev/hda6 home=/dev/hda2/knoppix.img myconfig=/dev/hda2 nopcmcia nodhcp ...'''<br>
+
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)
+
 
+
 
+
-----
+
I wrote this script last week.  It assumes that the ENTIRE first hard drive detected at boot time will be dedicated to Knoppix, so USE AT YOUR OWN RISK.  It creates 3 partitions: a 10GB ext3 for holding the KNOPPIX directory, a 2GB swap, and an ext3 covering the rest of the drive.  It also uses GRUB as the boot loader.  If you copy it to the KNOPPIX directory as knoppix.sh, and remaster, you will have a handy installation CD.  If you take out the y/n confirmation, you could probably train your cat to do a PMI!  FWIW, I've tested this on an IDE system with 1 drive, and a SATA system with two drives.  There may be other drive combinations that break it, though. -- Richard Ray
+
<pre>
+
# How to set up a "Poor Man's Install" so that the machine boots from a CD
+
# image that's been copied to the hard disk.  GRUB is used as the boot loader.
+
# It is assumed that you are booted to Knoppix CD 5.1.1, and ALL HARD DISK
+
# CONTENTS WILL BE ERASED!!!
+
 
+
#  0.  Switch to root with su -
+
 
+
#  1.  Partition the hard disk as follows (minimum 20GB hard disk recommended)
+
#      10GB /dev/hda1, type 83
+
#      2GB /dev/hda2, type 82
+
#      (the rest of the disk) /dev/hda3, type 83
+
#
+
 
+
# determine the disk device name, which is usually /dev/hda for IDE and
+
# /dev/sda for SATA
+
 
+
DEVICE=`fdisk -l 2>/dev/null | head -2 | tail -1 | awk '{print $2}' | sed 's/\:$//'`
+
 
+
# print warning and confirmation
+
clear
+
echo "This CD will install Knoppix 5.1 on your hard disk."
+
echo "The system will then boot from the hard disk as if you had booted from"
+
echo "the Knoppix CD, also known as a Poor Man's Install."
+
echo
+
echo "WARNING:"
+
echo "ALL EXISTING DATA ON THE HARD DISK $DEVICE WILL BE ERASED BY THIS PROCESS!!!"
+
echo
+
echo -n "Do you wish to continue? (y/n): "
+
read ANSWER
+
if [ "$ANSWER" = "y" -o "$ANSWER" = "Y" ]
+
then
+
:
+
else
+
  echo "Installation aborted!"
+
  sleep 3
+
  exit
+
fi
+
 
+
 
+
# clear the old partition table
+
dd if=/dev/zero of=$DEVICE bs=512 count=1
+
 
+
# determine the cylinder size
+
CYL_SIZE=`fdisk -l $DEVICE 2>/dev/null | grep "Units = cylinders" | awk '{print $9}'`
+
 
+
# determine the number of cylinders in 10GB
+
SIZE1=`echo "1073741824 * 10 / $CYL_SIZE" | bc`
+
 
+
# determine the number of cylinders in 2GB
+
SIZE2=`echo "1073741824 * 2 / $CYL_SIZE" | bc`
+
 
+
# partition the disk
+
sfdisk -f $DEVICE <<EOF
+
,$SIZE1,L
+
,$SIZE2,S
+
,,L
+
EOF
+
 
+
 
+
#  2.  Create an ext3 filesystem on the first and third partitions
+
mke2fs -j -m0 ${DEVICE}1
+
mke2fs -j -m0 ${DEVICE}3
+
 
+
 
+
#  3.  Create a swap area on the second partition
+
mkswap ${DEVICE}2
+
 
+
 
+
#  4.  Mount first partition on /media/p1
+
mkdir /media/p1
+
mount ${DEVICE}1 /media/p1
+
 
+
 
+
#  5.  Copy the contents of the Knoppix CD to /media/p1
+
echo
+
echo "Copying CD contents to hard drive.  This will take a few minutes."
+
/bin/cp -af /cdrom/KNOPPIX /media/p1
+
 
+
# remove /media/p1/KNOPPIX/knoppix.sh
+
/bin/rm -f /media/p1/KNOPPIX/knoppix.sh
+
 
+
 
+
#  6.  Create a boot directory on /media/p1 and copy the kernel and initrd
+
#      there
+
mkdir /media/p1/boot
+
/bin/cp -af /boot/vmlinuz-2.6.19 /media/p1/boot
+
/bin/cp -af /cdrom/boot/isolinux/minirt.gz /media/p1/boot
+
 
+
 
+
#  7.  Create a directory for GRUB
+
mkdir /media/p1/boot/grub
+
 
+
 
+
#  8.  Populate the GRUB config file.  If you require different default boot
+
#      options, include them in the kernel line.
+
cat <<EOF > /media/p1/boot/grub/menu.lst
+
default=0
+
timeout=10
+
 
+
title Knoppix 5.1 (Poor Man's HD install)
+
        root (hd0,0)
+
        kernel /boot/vmlinuz-2.6.19 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=normal initrd=minirt.gz nomce loglevel=0 quiet BOOT_IMAGE=knoppix BOOT_IMAGE=linux lang=us fromhd=${DEVICE}1 noeject noprompt
+
        initrd /boot/minirt.gz
+
EOF
+
cd /media/p1/boot/grub
+
ln -s menu.lst grub.conf
+
 
+
 
+
#  9.  Install GRUB
+
cd /media/p1
+
grub-install --root-directory=/media/p1 --no-floppy $DEVICE
+
 
+
 
+
#  10.  Reboot (and remove CD)
+
reboot
+
</pre>
+
[[Category:Hard drive Installation]]
+

Latest revision as of 12:24, 22 February 2012

Template:Delete--Werner P. Schulz 05:24, 22 February 2012 (MST)