PDA

View Full Version : How to start HD knoppix with just CD?



lynnwgnr
11-29-2003, 07:22 PM
How do I start a harddisk-installed Knoppix using just the Knoppix CD? That is, boot off CD, but run off hard disk?

I installed Knoppix 3.3 onto my laptop's hard disk (hda4) using knx-hdinstall. I did not make a boot floppy as I do not have a floppy drive. I did not specify LILO as I did not want to mess up my finicky WinXP partitions. I thought I could specify at the Knoppix CD boot prompt, something to boot off hda4, using "knoppix fromhd=/dev/hda4", but that did not work. I then tried downloading loadlin.exe and used the hda4's vmlinuz, but I get a message that the WinXP command prompt is not really DOS. I tried (as root in CD Knoppix) mounting /mnt/hda4 and then doing a chroot, but it still ran off the CD.

Can someone help? I want to boot off the Knoppix CD and somehow get the hard disk Knoppix to then take over.

Thanks in advance!
Lynn

baldyeti
11-29-2003, 07:50 PM
I don't think what you want to do is possible. It should be possible to boot off
the CD then direct it to find the big KNOPPIX file on the HD - but that's the so-
called poor man's install, which does not work from an NTFS unit and you've
done the full install anyway. loadlin needs fat and cannot handle NTFS either.
So you should install lilo, really. If you absolutely do not want to allow it to
control your MBR, install it to the start of your root partition (apparently hda4).
Then you can copy the boot sector (a smallish 512 byte file) to your C: drive
but that's gonna be complicated if you have no floppy and C: is NTFS. Well
provided you find a way (hint: explore2fs), then you can create an entry for
linux in the XP boot loader (boot.ini). Frankly that's a lot of trouble to avoid
letting lilo do its job!

tinker
11-30-2003, 04:03 PM
Lynn,
I think this may help you - I use this to run knoppix from my external firewire drive. Which shows just another usage of knoppix - I can hijack about any computer I want and run my complete (adapted) Knoppix environment directly from this computer without installing any single byte on the other computers harddrive ...

What I normally do:

put in the knoppix CD
in the F2 screen (sheatcodes) type
"knoppix single"

which will make knoppix start up in single user mode.

type
sudo su
mkdir /mnt/new_root
to create a mountpoint for your new root.

Then I normally mount my external firewire disk, by first loading the firewire subsystems (you can skip this - I just include it in case someone else wants to run Knoppix from an external firewire or USB drive):

----------------------------------
for firewire:

modprobe ieee1394
modprobe ohci1394
modprobe sbp2

in case your external firewire or USB2 drive is not automatically detected: run the script "rescan-scsi-bus.sh" you find at http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh )
----------------------------------


Here you will have to continue:

mount /dev/hda2 /mnt/new_root (use the partition your knoppix is on - I took /dev/hda2 as an example)
mkdir /mnt/new_root/mnt/old_root (make place to put your current root ...)
cd /mnt/new_root (go to your /dev/hda2 disk)
pivot_root . /mnt/new_root/mnt/old_root (and make it your new root ...)
mount /proc /proc -t proc (Don't know anymore why I added this, but I know I needed it)

which basically remaps your running "root" - the running root becomes /mnt/old_root, and the /mnt/new_root (your knoppix partition) becomes your running root - just as you want.

Then type

init 5

to continue the rest of your startup process from your harddisk partition.
I don't know if this is technically the correct way to do it, but I sure was very glad to find out that it just works ...
In case someone of the more technical people on the board know of a better way to boot firewire (or got any suggestion to improve the above script), I'd like to find out.


Baldyeti,
don't be to quick to say something is impossible with linux :D

baldyeti
11-30-2003, 08:06 PM
Sure. I probably could have come up with something even more contorted to astonish the newbies out there.
Your inventive solution is certainly fine for a portable drive you want to hook to different systems,
...but in the case of a single machine, lilo _is_ a proven boot-loader.
Besides as I originally suggested, the NT/XP bootloader can be used as well.
IMHO, the aim should _not_ be to make linux look complicated.

lynnwgnr
12-01-2003, 10:43 PM
Tinker
You are a genius, it works perfectly! I had a feeling there was a way to do it in Linux without having to use LILO. After all this must be what initrd/ramdisk essentially does to use the file system on the CD? LILO is a great boot manager, but in this case I simply did NOT want a hard disk based boot manager. I learned something new today, and am glad that with Linux I am not a sandboxed and patronized lemming end user that some large OS companies would like us to be :)
Thanks for all your help--your constructive and detailed advice is greatly appreciated!
Lynn

knoppix single (at boot prompt)
sudo su
mkdir /mnt/new_root
mount /dev/hda4 /mnt/new_root
mkdir /mnt/new_root/mnt/old_root
cd /mnt/new_root
pivot_root . /mnt/new_root/mnt/old_root
mount /proc /proc -t proc
init 5

c123
12-05-2003, 07:18 PM
My heroes.

I've been trying to do something like this (on and off) for months. I've got an old laptop that has no internal HDD but which has access to a firewire drive via a PC Card. I tried building a custom kernel and creating an initrd (via pcinitrd), but it's just too advanced for me. Got a friend to have a go for me, but he too could not manage it.

So I'll test this out this weekend (should work, although I have to make sure pcmcia drivers are loaded as well). If all goes well I'll revisit various threads I've added to/read that discuss this tricky config (booting, or more accurately putting the root on an external USB or 1394 drive) and point them to this thread.

@Baldyeti - I agree that linux should be made easier for the average person, but at the same time it should not be dumbed down. One thing I like about Linux is that if something does not work, I can have a go at understanding and ultimately solving the problem as things are so open. Try doing that under Windows. Also these forums are for discussing advanced topics, learning, leaving linux-newbie-land etc. Anyway if this thing works for my old laptop I'll be very happy :))

garyng
12-05-2003, 10:38 PM
This pivot root then init trick works provided that the target root has the same kernel modules as the boot up one(meaning /lib/modules'`uname -r` exists on target). Otherwise, expect troubles.

Win_A_New_Head
12-22-2003, 08:26 PM
I was just on the Forum looking for exactly this solution. Baldyeti, when I test this, I'll write a script and post it here so that the next person won't need to experience quite as much complexity when doing this maneuver.

c123
01-26-2004, 12:55 AM
Finally got round to trying this. Works as advertised with Koppix 3.2, will try with latest 3.3 (from 19th November 2003?) soon.

Great, will finally be able to use my old laptop with the dead HDD :)

Win_A_New_Head, if you did write a script that automates this process, I'm interested ;)

Thanks everyone.

c123
01-28-2004, 12:00 AM
I tried automating the process, but my 'script' does not work. I start off as normal:

knoppix single (at boot prompt)
sudo su
lsmod (tells me firewire modules are loaded)

Then I goto floppy to run two scripts:

cd /mnt/floppy
ls
./rescan-scsi-bus.sh (first one, works fine)
./start.sh

But that gives me an ":bad interpreter : No such file or directory" error. I don't understand, when I type these commands, all goes well. Anything wrong with the script below? (I have no experience in shell scripting).



#!/bin/bash
mkdir /mnt/new_root
mount /dev/sda5 /mnt/new_root
mkdir /mnt/new_root/mnt/old_root
cd /mnt/new_root
pivot_root . /mnt/new_root/mnt/old_root
mount /proc /proc -t proc

c123
02-02-2004, 11:12 AM
Couple of observations on the problems I had above:

1. I wrote/edited the above script in Windows, hence the error ":bad interpreter : No such file or directory". Solution is to write it in Linux/Knoppix, or find a way of converting Windows carriage returns to *nix carriage returns.

2. "mkdir /mnt/new_root/mnt/old_root" is needed the first time only; after that (i.e. in a script) the dir exists so so cannot be created.

3. "pivot_root . /mnt/new_root/mnt/old_root" does not work as the working directory when the command is issued is not "/mnt/new_root" :( I don't know how to fix this.

Durand Hicks
02-03-2004, 07:40 AM
I tried these commands on my computer, and when I entered: mkdir /mnt/new_root/mnt/old_root, it fails saying directory or file doesn't exist. However, when I enter mkdir /mnt/old_root, it works. What's up with that? Also, I'm attempting this in script as well, and so far no go as of yet. I do have one question: what's the period after pivot_root for?

c123
02-03-2004, 04:43 PM
I tried these commands on my computer, and when I entered: mkdir /mnt/new_root/mnt/old_root, it fails saying directory or file doesn't exist. However, when I enter mkdir /mnt/old_root, it works.
On what sort of a device are you trying to use for your root? I'm using an external HDD, and before I can 'mkdir /mnt/new_root/mnt/old_root' I have to mount my external HDD (for me this is 'mount /dev/sda5 /mnt/new_root'). And before I can mount my external HDD, I have to run the "rescan-scsi-bus.sh" script... Are you sure you external HDD is recognised and then mounted by Knoppix?


I do have one question: what's the period after pivot_root for?
Not sure what the . (dot, full stop, period, whatever you want to call it) means :( These two man pages should reveal all though, when I get time to read them:

http://www.die.net/doc/linux/man/man2/pivot_root.2.html
http://www.die.net/doc/linux/man/man8/pivot_root.8.html

OK, time for me to get back to work...

Durand Hicks
02-04-2004, 06:53 AM
I didn't have an external device, just a wicked multi-boot layout. I.e. hda1 is dos 6.22 (FAT16), hda5 is winxp (NTFS), hda6 is apps(NTFS), hda7 is data(NTFS), hda8 is games(NTFS) also 2nd xp (now deleted to make room for-->), hda9 was knoppix hdbased on FAT32. I gave up the ghost and reformatted hda9 to ext3 and did a full hd install of knoppix. After the install, it took me another 3 hrs to figure out what I needed to get LILO installed into NT's bootloader on hda1. For a newbie, I pretty much fried my brain doing this but man, I'm glad I sorted this out.

iron hat
02-12-2004, 06:57 PM
has anyone gotten this to work on a USB HD? It worked fine for me up until entering the "init 5" command which caused error message relating to reading off of the hard drive. I have a USB 2.0 Datastor with a Knoppix distribution on a ext2 partition

Kriton
02-12-2004, 07:40 PM
Hi all,
i'm trying to boot knoppix from an external Iomega CD-RW usb, but it doesn't seem to work can someone help me?
I tried to modify the miniroot.gz as explained here (http://rz-obrian.rz.uni-karlsruhe.de/knoppix-usb) but it can't find the root filesystem and drops me to a (very limited) shell. I also tried the RUNT boot floppy and after it loads usb modules it detects the external cd, but then says that can't mount /dev/sda1 or something like that, what am I wrong?
Is there any way to make it mount the root on the usb cdrom?
Thanks for any help!

beichhor
03-01-2004, 01:44 PM
Couple of observations on the problems I had above:

1. I wrote/edited the above script in Windows, hence the error ":bad interpreter : No such file or directory". Solution is to write it in Linux/Knoppix, or find a way of converting Windows carriage returns to *nix carriage returns.

2. "mkdir /mnt/new_root/mnt/old_root" is needed the first time only; after that (i.e. in a script) the dir exists so so cannot be created.

3. "pivot_root . /mnt/new_root/mnt/old_root" does not work as the working directory when the command is issued is not "/mnt/new_root" :( I don't know how to fix this.

I tried these commands on my computer, and when I entered: mkdir /mnt/new_root/mnt/old_root, it fails saying directory or file doesn't exist. However, when I enter mkdir /mnt/old_root, it works. What's up with that? Also, I'm attempting this in script as well, and so far no go as of yet. I do have one question: what's the period after pivot_root for?

Common guys, use your brains!! :


pivot_root /mnt/new_root /mnt/new_root/mnt/old_root
Try thinking about the code/commands you are typing and you may really learn about what you are doing!

BTW:
Good work tinker... I'd been looking for this pivot technique.

testuser
09-13-2004, 02:18 AM
Thanks, this works great. It lets me use Linux on my laptop using an external drive. Unlike the poormansinstall, I was able to use apt-get to install gnome and mono and update the whole system.

The only change I needed to the above instructions was to type knoppix26 single on boot instead of just knoppix single, because otherwise my ethernet wasn't working (eepro100 issue perhaps). One other issue is that shutting down hangs at the very end, but I can live with that.

Now, I'd like to have it so I don't have to manually type in all the commands each time I boot. I'm not sure if this can be accomplished via a custom knoppix.sh file (and use the myconfig cheatcode or else burn a new CD with knoppix.sh), or if I need to modify the linuxrc file in the initrd boot image used by the CD, similar to what this article describes doing: http://www-106.ibm.com/developerworks/linux/library/l-fireboot.html?ca=dgr-lnxw16FireBoot.

c123
09-19-2004, 11:12 AM
Apparently as from 3.4, the bootfrom cheatcode will now work with firewire (and usb) drives as well, but I still (after more than two minths or so) have to try this.

I'm not sure if you have to point to the partition or to the actual kernel... Anway a bit of trial and error should tell you pretty quickly.

Please post back with your results.

BTW the IBM article is a a good read :)

daneel101
12-05-2004, 09:52 AM
Hi,

Hope that this forum is still being monitored...

I downloaded knoppix 3.6 and installed it into a (non-bootable) external USB-HDD as a Debian Distribution with Hardware Auto detection. I then booted into the cd in single user mode and used the "pivot_root" command to transfer to the Hard Drive as detailed in the how-to at

http://www.knoppix.net/docs/index.php/PivotRootInstall
Everything worked fine and I thought I had a fully operational Mobile Debian installation. I used apt-get to update all packages and installed some new ones and everything was okay across several reboots. However, when I connected my HD to another machine and tried to do pivot_root from it's CD-ROM drive, disaster struck. The CD booted correctly and dropped me into a shell. The pivot_root command worked and everything, but the minute I switched to runlevel 5, my X Server Crashed, claiming that the config of xf86Config file was wrong. Apparently, the X server config from my original machine persisted in the HD!!!

I have included the log file below. Is this supposed to happen? Why is it that all the other hardware parameters did not stay persistent (as is required for a mobile HD installation that will be connected to different computers) and were autodetected but the X-Server config was not? How do I make sure that the X-Server and display manager are automatically configged in all computers to which I connect the HD (Bear in mind that the knoppix cd itself boots fine all the way to X, so detection is not the problem)>

If I have to manually config X each time I put it in a different machine, then is there a good non-graphical tool in Debian that I can use?

Please let me know.

Thanks,
AR


Log File:

This is a pre-release version of XFree86, and is not supported in any
way. Bugs may be reported to XFree86@XFree86.Org and patches submitted
to fixes@XFree86.Org. Before reporting bugs in pre-release versions,
please check the latest version in the XFree86 CVS repository
(http://www.XFree86.Org/cvs).

XFree86 Version 4.3.0.1 (Debian 4.3.0.dfsg.1-6 20040707142024 fabbione@fabbione.net)
Release Date: 15 August 2003
X Protocol Version 11, Revision 0, Release 6.6
Build Operating System: Linux 2.4.23 i686 [ELF]
Build Date: 07 July 2004
Before reporting problems, check http://www.XFree86.Org/
to make sure that you have the latest version.
Module Loader present
OS Kernel: Linux version 2.6.7 (root@Knoppix) (gcc-Version 3.3.4 (Debian 1:3.3.4-3)) #2 SMP Wed Jul 28 04:25:36 CEST 2004
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/XFree86.0.log", Time: Sun Nov 28 17:44:43 2004
(EE) Unable to locate/open config file
(EE) Error from xf86HandleConfigFile()

Fatal server error:
no screens found

When reporting a problem related to a server crash, please send
the full server output, not just the last messages.
This can be found in the log file "/var/log/XFree86.0.log".
Please report problems to submit@bugs.debian.org.

CrashedAgain
12-11-2004, 04:50 PM
Hi,

Hope that this forum is still being monitored...

I downloaded knoppix 3.6 and installed it into a (non-bootable) external USB-HDD as a Debian Distribution with Hardware Auto detection. I then booted into the cd in single user mode and used the "pivot_root" command to transfer to the Hard Drive as detailed in the how-to at

http://www.knoppix.net/docs/index.php/PivotRootInstall
Everything worked fine and I thought I had a fully operational Mobile Debian installation. I used apt-get to update all packages and installed some new ones and everything was okay across several reboots. However, when I connected my HD to another machine and tried to do pivot_root from it's CD-ROM drive, disaster struck. The CD booted correctly and dropped me into a shell. The pivot_root command worked and everything, but the minute I switched to runlevel 5, my X Server Crashed, claiming that the config of xf86Config file was wrong. Apparently, the X server config from my original machine persisted in the HD!!!

I have included the log file below. Is this supposed to happen? Why is it that all the other hardware parameters did not stay persistent (as is required for a mobile HD installation that will be connected to different computers) and were autodetected but the X-Server config was not? How do I make sure that the X-Server and display manager are automatically configged in all computers to which I connect the HD (Bear in mind that the knoppix cd itself boots fine all the way to X, so detection is not the problem)>

If I have to manually config X each time I put it in a different machine, then is there a good non-graphical tool in Debian that I can use?

Please let me know.

Thanks,
AR


Log File:

This is a pre-release version of XFree86, and is not supported in any
way. Bugs may be reported to XFree86@XFree86.Org and patches submitted
to fixes@XFree86.Org. Before reporting bugs in pre-release versions,
please check the latest version in the XFree86 CVS repository
(http://www.XFree86.Org/cvs).

XFree86 Version 4.3.0.1 (Debian 4.3.0.dfsg.1-6 20040707142024 fabbione@fabbione.net)
Release Date: 15 August 2003
X Protocol Version 11, Revision 0, Release 6.6
Build Operating System: Linux 2.4.23 i686 [ELF]
Build Date: 07 July 2004
Before reporting problems, check http://www.XFree86.Org/
to make sure that you have the latest version.
Module Loader present
OS Kernel: Linux version 2.6.7 (root@Knoppix) (gcc-Version 3.3.4 (Debian 1:3.3.4-3)) #2 SMP Wed Jul 28 04:25:36 CEST 2004
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/XFree86.0.log", Time: Sun Nov 28 17:44:43 2004
(EE) Unable to locate/open config file
(EE) Error from xf86HandleConfigFile()

Fatal server error:
no screens found

When reporting a problem related to a server crash, please send
the full server output, not just the last messages.
This can be found in the log file "/var/log/XFree86.0.log".
Please report problems to submit@bugs.debian.org.

Yes, the X configuration will remain the same on the HD install.
What you have to do is delete /etc/X11/XF86config-4 then run mkxf86config to create a new one based on the hardware the system detects. Must be done before starting X, of course. mkxf86config does run as part of the autoconfig startup but it will only create a new xf86config file if there is none existing.

c123
12-22-2004, 09:46 AM
Does anyone have a copy of http://www.knoppix.net/docs/index.php/PivotRootInstall -- can't currently get to that page as the wiki software is still being upgraded...

alandrokalimera
03-21-2005, 03:31 PM
Thank you very much. It works fine.
there is only one problem: When the system shuts down I get a bunch of hd errors. I think it's because the system unmounts the usb hdd before it completely shuts down. Is there any way to fix this?

cyberoidx
03-30-2005, 08:32 AM
I suppose there is a simpler soultion to botting knoppix from CD.

In this case i had Rh7.2 installed first, and didn't want to spoil my MBR, like you.
So i did the following:
1) Make lilo boot floppy (which u couldn't)
2) Turned it into a CD. I dont really trust floppies......
3) whenever i boot, even if i have removed Rh 7.2 from the hdd, and put DamnSmallLinux, whcih i have done now..... Lilo still loads DSl if i type "Linux" at boot........... Isn't that a simpler way to do that?
Install your linux on a removable drive, and then mklilo from the same thing........ That worked for me. I guess linux acutally means to experiment for yourself.....

CrashedAgain
04-01-2005, 04:24 AM
To boot a Knoppix HD install from the CD boot the CD with the cheatcode:
knoppix root=/dev/hda5 noinitrd ro (replace hda5 with the correct partition for your HD install) but I don't know if it will work with a usbdrive.

jacks
07-02-2005, 11:13 PM
Using Knoppix CD 3.8.2 I've made a begginer install to a USBEHD partition /dev/uba4 (not bootable with my BIOS) and everything except read access to the initiating cdrom works fine.
I have a cdrom and a cdrw on the second IDE channel and they are correctly recognized by knoppix as /dev/hd[c,d]. With autofs active cdrom1 = /dev/hdd works fine. cdrom = /dev/hdc gives blank reads and the physical eject button on the drive is locked.

As root 'eject' will open the cdrom tray (actually it's the -s option that works not the -r option) but read and button lock problems persist.

'fuser -v /mnt/cdrom' shows there is a kernel process keeping the "device is busy" from /mnt/old_root/cdrom
This persists even after the bood cd is ejected and removed. I presume the mount /proc /proc -t proc command is responsible for reintroducing this "busy cdrom" from the RAM based root to the uba4 based root following the pivot_root exchange.

I've tried to discover a pid for this process to try to kill it, but with no success. I've also tried the option 'mount /proc /proc -t proc,noisso9660 to avoid mounting the above access.

Anyhelp would be appreciated. This problem should be addressed in the pivot_root instructions.

jacks
07-31-2005, 03:18 PM
See Woes Using CDs

http://www.knoppix.net/forum/viewtopic.php?t=17177&postdays=0&postorder=asc&start=10

sakiZ
08-01-2005, 09:56 PM
CrashedAgain,

FYI, You might be interested to know your excellent method of:

knoppix root=/dev/hda5 noinitrd ro

to boot to a full HD install also works with Loadlin.exe in a DOS batch file.
Loadlin is nice because it is very easy to use.

Use the same method of booting as with a Poor Man's Install with appropriate copying of Knoppix image files to the HD using whatever kernel you want (2.4 or 2.6) etc.

They uncompress and with your method, the full HD install boots up.

See docs on Poor Man's Install for full what to copy to a HD partition.

This is how I'm booting my setup now. First up comes the menu from Boot.ini. (I use XP on a FAT32 partition)

I select the line: "Boot to DOS or Linux." This starts a batch file that asks, "Do you wish to boot to Linux?"

If I press "Y" this calls another batch file to start Loadlin which starts uncompressing files from the CD, my Knoppix setup (with cheatcodes in place) starts up.

If I press "N", the computer goes to DOS.

So, you can skip the CD if you want as long the appropriate files are copied to a partition to your HD and Loadlin activates them.

As I said, see Poor Man's Install Docs for anyone who wants to try this. Similar method, but for a true full HD as well with your tip.

sakiZ

sakiZ
09-19-2005, 07:02 PM
Variations of Poor Mans Pivot Root Methods:

I've been thinking about this method

knoppix root=/dev/hda5 noinitrd ro

using Loadlin.exe. to either boot to a CD or my own HD.

This is how I boot to my HD now and to the original CD if I want.

If I can boot to my own HD installation, why couldn't I also boot to a DVD with my uncompressed partition copied to it?

The same DVD could also have the c:\Knoppix directory copied to the DVD, to be put on the target computer to boot the DVD. The batch file Loadlin runs would be modified if necessary to make everything work on the target computer.

Since I really don't want to remaster CDs to distribute them, and just want to run my own installation on another computer that I have in mind, (which happens to have a DVD player in it) why wouldn't this work?

sakiZ