PDA

View Full Version : loadlin-like loading of knoppix from a win2k/NT/XP session



mack
07-09-2003, 06:11 PM
Hi,

I'm using knoppix on some weird hardwares. Customized the kernel and miniroot.gz (linuxrc) to work with them - should be ok. However, the boxes can't boot off their CDROM or FLOPPY (which are USB).

In the days of DOS-based windows versions, I'd have just remastered knoppix to include loadlin and a script that loads the kernel and initrd. However, as far as I can tell, loadlin doesn't work from NT-based kernels such as Win2k.

:idea: I'd like to include some program in my knoppix CD, which can be executed from windows, kick windows out of memory (like loadlin does for dos), and bootstrap a kernel/initrd set.

Anyone knows a method to achieve that ?

Mack

oscar
07-09-2003, 10:46 PM
The solution here is to have a DOS partition in order to run loadlin.
You may repartition your hd or you may reinstall w2k over a DOS partion (win98 DOS 6.22) fox example. Then you wil be able to boot into DOS or Windows.

your boot.ini file must be something like this

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows " /fastdetect
C:\="DOS 6.22"

mack
07-10-2003, 01:00 AM
The solution here is to have a DOS partition in order to run loadlin.
You may repartition your hd or you may reinstall w2k over a DOS partion (win98 DOS 6.22) fox example. Then you wil be able to boot into DOS or Windows.


Thanks. Thats the solution I was first going for, but unfortunately, repartitioning of the local disks is not an option. Even if I do get away with it in this case, I'd like to find a general solution that doesn't require local modifications (after all, thats what knoppix is about :wink: ) and add this solution to knoppix.

I'm sure other users have also ran into situations where booting knoppix from a windows session would've helped. For example, when knoppix is on a USB device and the bios doesn't support booting from USB. (Unfortunately, a lot of bioses don't). If there is already a running linux on the system, one can use kexec() to load a new kernel, thus switching to knoppix. I'd like to achieve the same from a (more common) windows session.

Ideally, the Knoppix CD will have a .BAT which, when clicked on (in windows), will do a loadlin-like trick and load knoppix instead of the running windows. Thats how it used to be with some Linux CDs before NT became a standard for windows boxes.

oscar
07-10-2003, 03:25 AM
"mack

Ideally, the Knoppix CD will have a .BAT which, when clicked on (in windows), will do a loadlin-like trick and load knoppix instead of the running windows. Thats how it used to be with some Linux CDs before NT became a standard for windows boxes.

Forget this. Loadlin must be clicked on in DOS.
Now and then.
Old linux (win98,95,me) boots DOS just after booting linux. Loadlin must be clicked on just after booting windows enviroment.
There must be something capable of booting DOS or Linux (lilo). If you have not a booting cdrom, a booting floppy or a HD booting DOS or linux it is not possible. You have to many restrictions.

garyng
07-10-2003, 11:14 AM
I believe it would work given :

1. there is a FAT/FAT32 partition(without that, everything is off)
2. install a copy of freedos/opendos(?) on it
3. change the boot.ini(XP/NT) to add an item to boot DOS(I don't know how to grab the boot record of freedos, may be a generic one from an old DOS machine would work)
4. loadlin in the DOS autoexec.bat

mack
07-10-2003, 03:00 PM
I believe it would work given :

1. there is a FAT/FAT32 partition(without that, everything is off)
2. install a copy of freedos/opendos(?) on it
3. change the boot.ini(XP/NT) to add an item to boot DOS(I don't know how to grab the boot record of freedos, may be a generic one from an old DOS machine would work)
4. loadlin in the DOS autoexec.bat

Thanks. That sounds like a good way that covers at least the cases where a FAT-based partition exists. I'll try it.

I guess the only way in case of an NTFS system would be to somehow install grub on it from inside windows (if thats even possible) and use it to boot linux.

garyng
07-10-2003, 11:03 PM
I guess the only way in case of an NTFS system would be to somehow install grub on it from inside windows (if thats even possible) and use it to boot linux.

I doubt grub support NTFS partition. I have thought about this 'linux in a XP environment' for some time and come to the conclusion that if there is no FAT, floppy/cd-rom boot is the only option as no linux boot loader can handle NTFS as far as I know.

mack
07-10-2003, 11:42 PM
I guess the only way in case of an NTFS system would be to somehow install grub on it from inside windows (if thats even possible) and use it to boot linux.

I doubt grub support NTFS partition. I have thought about this 'linux in a XP environment' for some time and come to the conclusion that if there is no FAT, floppy/cd-rom boot is the only option as no linux boot loader can handle NTFS as far as I know.

Yes, seems like the only other option is to write a "driver" for win2k/xp, which works in kernel space and does the loadlin magic. Probably not too complicated once in ring0, but admin privs must be grabbed in the windows session in order to load that driver. There's always some M$ bug which allows that, but the loader will need to keep track of new local-exploits for windows. A bit of a pain for non-windows people. Maybe someone from ntbugtraq willing to maintain this part of the "loader" ? :lol:

garyng
07-11-2003, 07:12 AM
And I was wrong. someone wrote a ntfs driver for grub around April, another person made use of it and build a 'grub under win32' utility about two weeks ago.

So it is now possible to use grub in an NTFS only environment. I am building it and will test it when I have the time. It would be something like the following :

(all under win32)
1. copy stage1, stage2(with ntfs support) and menu.lst to c:\(assume this is the boot drive, NTFS)
2. run the ntfsinsall utility to embedded the stage2 geometry in both stage1 and stage2(the same as the grub-install under linux), this would also insert the menu.lst name in stage2
3. add c:\stage1="linux" to boot.ini

viola, it is now possible to chain boot from NT loader to grub and move on to linux.

caveat, the above has not been tested yet as I don't have a NTFS only system at the moment but do briefly test the ntfs support in stage2 which can read NTFS files.

If I have time, I may modify the win32 program to handle FAT/FAT32/NTFS and it would be possible to install a copy of KNOPPIX, all from win32, no matter what FS is used when NT/XP is installed.

==============
I am using lilo to achive the above as I happened to have the C:\ as FAT32. However, this requires me to first boot into KNOPPIX to run the lilo command, doesn't work for your described scenario.

mack
07-11-2003, 11:41 AM
And I was wrong. someone wrote a ntfs driver for grub around April, another person made use of it and build a 'grub under win32' utility about two weeks ago.

Cool! So now it should be possible to install grub and boot linux (assuming the user has admin rights on windows, to install grub). It will make Knoppix usable on many (currently unusable) systems. :D


caveat, the above has not been tested yet as I don't have a NTFS only system at the moment but do briefly test the ntfs support in stage2 which can read NTFS files.

I don't have a live system to safely test it on, but I do have VMWare (which I usually use to make changes in knoppix). I'm not familiar with all the above (since I usually use lilo) but will give it a try. Will install an NTFS-only system inside a VM and try to start Knoppix off grub instead of boot from CD. If there's anything you want me to test while doing that, let me know.


If I have time, I may modify the win32 program to handle FAT/FAT32/NTFS and it would be possible to install a copy of KNOPPIX, all from win32, no matter what FS is used when NT/XP is installed.

Great. I'll set up a vmware environment to test it. Once you have the modified win32 program, I can test it for ya (or you can ssh into it if you want to play with it yourself) :)


I am using lilo to achive the above as I happened to have the C:\ as FAT32. However, this requires me to first boot into KNOPPIX to run the lilo command, doesn't work for your described scenario.

Right. Once I'm inside linux I no longer care what the system looks like. The problem is just the first bootstrap. I want Knoppix to be able to boot on as many systems as possible.

garyng
07-11-2003, 05:50 PM
I did a partial test of the NTFS capable grub(well I just installed it on a floppy) and it seems to be working as I can boot load a kernel/initrd pair stored on NTFS partition which then do the usual search(KNOPPIX way) of the real root system just fine.

The win32 installation part seems to have some problems but I cannot test as I don't have a C:\ with NTFS. NT's boot loader does not honour the chain boot to a boot sector on file trick if I stored the 512 byte file on D:\. NT thought I want it to load NT/XP and bark about missing hal.dll :cry:

If you want to try, I can find a way to send you the 3 files(one win32, and two grub image stage1 and stage2). All that is needed is a c:\ with NTFS. The process itself is non-intrusive as the win32 program just modify the regular file stage1/stage2 under NT/XP and won't touch the boot record etc.

mack
07-11-2003, 07:24 PM
If you want to try, I can find a way to send you the 3 files(one win32, and two grub image stage1 and stage2). All that is needed is a c:\ with NTFS. The process itself is non-intrusive as the win32 program just modify the regular file stage1/stage2 under NT/XP and won't touch the boot record etc.

I'll install the above in vmware. Just send me the files and tell me how to install them from win2k. I'll post the results here.

I see we can't PM here for some reason so I'll have to publish an email address here. Excuse my ugly way of doing so. Your shell will handle it :)

Mail `host -t TXT knoppix.unpatched.org|sed -n 's/.*"\(.*\)"/\1/gp'`

Hopefully, spambots don't execute shell commands yet. (As a matter of fact, I can't wait for them to start doing that. :wink:

garyng
07-14-2003, 09:49 AM
I spent the weekend to fix this XP patch and now can install GRUB on either FAT or NTFS under XP. Should also work under W2K/NT but definitely not 95/98/ME(they are cripped win32 that the program will not run) where I believe loadlin is a better solution.

GRUB now gives me more flexibility to test out linux on my 'Microsoft' controlled HD, comparing with LILO which requires me to rerun under linux whenever I want to add a new kernel/initrd combination.

I would mail you the files after I clean them up a bit. Too bad I can't find a place where I can setup a website so people can download from there as I believe it would be quite useful for situation where booting from floppy/cd-rom is disable. A KNOPPIX like system can slip into an XP machine by :

xcopy stage1 c:\boot\stage1
xcopy stage2 c:\boot\stage2
xcopy xpgrub.exe c:\boot\grub\
xcopy menu.lst c:\boot\grub\
c:\boot\grub\xpgrub
echo 'c:\boot\stage1="linux"' >> c:\boot.ini

and on the next boot up, KNOPPIX can take over.

Of course, the menu.lst must be prepared.

In fact, I learnt a neat trick on GRUB mailing list that I can boot a CD-ROM from GRUB through Smart Boot Manager for those non-IDE CD-ROMs like PCMCIA connected one(that is the feature of SBM), or as mentioned a machine with CD-ROM booting disabled. So it is possible to just have grub(and friends installed) and boot KNOPPIX CD from there. Of course, for odd CD-ROMs, the initrd in the KNOPPIX CD needs to be changed to load the proper drivers before it start the search of itself :wink:

mack
07-14-2003, 12:39 PM
I spent the weekend to fix this XP patch and now can install GRUB on either FAT or NTFS under XP. Should also work under W2K/NT but definitely not 95/98/ME(they are cripped win32 that the program will not run) where I believe loadlin is a better solution.

Great. I also had a knoppix weekend - was debugging what seems to be an evil race bug in the xsession-knoppix package. Will post on that in a new thread.

Do you need a test environment for testing it with win2k (C:\ = NTFS) ?

When xpgrub fails (on 95/98/ME), does it do any damage or does it just exit with some error code ? If it fails gracefully, the script can detect it and assume 95/98/ME (or maybe there's a better way to detect windows version. I'm not familiar with windows but I'm sure it has something equiv to uname(1)). Once the script figures a dos-based version of windows is in place, it will add a boot option with loadlin.


I would mail you the files after I clean them up a bit. Too bad I can't find a place where I can setup a website so people can download from there as I believe it would be quite useful for situation where booting from floppy/cd-rom is disable. A KNOPPIX like system can slip into an XP machine by :

Cool! I think knoppix (and other systems) will benefit from that.
Re website for it, I'll create a dir for it on a server here. Mail me the content you want there.


In fact, I learnt a neat trick on GRUB mailing list that I can boot a CD-ROM from GRUB through Smart Boot Manager for those non-IDE CD-ROMs like PCMCIA connected one(that is the feature of SBM), or as mentioned a machine with CD-ROM booting disabled. So it is possible to just have grub(and friends installed) and boot KNOPPIX CD from there. Of course, for odd CD-ROMs, the initrd in the KNOPPIX CD needs to be changed to load the proper drivers before it start the search of itself :wink:

yes, Smart Boot Manager looks cool. 8) However, as far as I can tell it has no USB support yet. I already modified the initrd to support the USB cdrom, but since Smart Boot Manager won't be able to handle it by itself, I'll just use the above script to load vmlinuz+initrd from C:\boot\ and have them handle the USB stuff.

garyng
07-14-2003, 05:59 PM
When xpgrub fails (on 95/98/ME), does it do any damage or does it just exit with some error code ? If it fails gracefully, the script can detect it and assume 95/98/ME (or maybe there's a better way to detect windows version. I'm not familiar with windows but I'm sure it has something equiv to uname(1)). Once the script figures a dos-based version of windows is in place, it will add a boot option with loadlin.
unfortunately, it would popup a window system message saying certain function linked in the EXE is not available. it would not do any harm to the system but it can't be a automated operation. If the code is compiled under Microsoft VC environment, I know how to make it more 'installation' friendly but since it is someone else work using cygnus C which I don't know too well, it would be too much effort to change it, for the moment. Of course, if Installshield is being used, it can by itself detect the kind of running OS.


yes, Smart Boot Manager looks cool. 8) However, as far as I can tell it has no USB support yet. I already modified the initrd to support the USB cdrom, but since Smart Boot Manager won't be able to handle it by itself, I'll just use the above script to load vmlinuz+initrd from C:\boot\ and have them handle the USB stuff.
good point. a rescue diskette/CD with the proper driver is better, for booting linux. Though if one wants to boot something off the CD like a XP installation CD still need SBM but then who need that :wink: [/quote]

mack
07-15-2003, 03:12 AM
unfortunately, it would popup a window system message saying certain function linked in the EXE is not available. it would not do any harm to the system but it can't be a automated operation. If the code is compiled under Microsoft VC environment, I know how to make it more 'installation' friendly but since it is someone else work using cygnus C which I don't know too well, it would be too much effort to change it, for the moment. Of course, if Installshield is being used, it can by itself detect the kind of running OS.

This shouldn't pose a problem. I'm sure there are ways for a .BAT script to detect OS type. Worst case, it can check for existence of command.com or something. :twisted:


good point. a rescue diskette/CD with the proper driver is better, for booting linux. Though if one wants to boot something off the CD like a XP installation CD still need SBM but then who need that :wink:

I see your point, and I feel lucky to be using a flexible OS. :wink:

Anyway, I have set up an NTFS-based VM here, ready for testing. Vanilla Win2k (NTFS), nothing else on disk. Will try to use grub and have it load a kernel+initrd from C:\boot\ and hopefully use it to load knoppix from the attached USB CDROM. Just email me once you have something testable and I'll give it a try. (And its ok if it screws things up at first. Thats what vmware's non-persistent mode is for). 8)

A. Jorge Garcia
07-17-2003, 05:31 PM
I'm getting an XP lab at school next year. I'd really like to have a desktop icon in XP that does the loadlin thing! Is this possible? I used to have this setup in WIN95 and it worked great!

TIA,

garyng
07-18-2003, 05:06 AM
Without VMWARE, you cannot have loadlin equivalent on XP desktop(someone may have the solution but that means a VMWARE GNU equivalent). However, what I am working on allows you to have Linux as a boot option when the machine initially boot up.

This may not sound interesting(one can always boot KNOPPX from CD and do the GRUB/LILO install there) but it does give you the option of installing KNOPPIX on a machine, all from within WIN32 environment. So for labs that have floppy/cd-rom booting disabled, you can still install KNOPPIX on it.

gabriel_fin
08-08-2003, 01:24 PM
Due my Laptop bios Admin password is missing and and the HD is encripted with pointsec I cant repartition so I need to recurr to this trick I have winxp pro but cant make a repartition can you give some hints how i can work around , also the files you mention would be great to have them.

Br
Gabriel Vergara


If you want to try, I can find a way to send you the 3 files(one win32, and two grub image stage1 and stage2). All that is needed is a c:\ with NTFS. The process itself is non-intrusive as the win32 program just modify the regular file stage1/stage2 under NT/XP and won't touch the boot record etc.

I'll install the above in vmware. Just send me the files and tell me how to install them from win2k. I'll post the results here.

I see we can't PM here for some reason so I'll have to publish an email address here. Excuse my ugly way of doing so. Your shell will handle it :)

Mail `host -t TXT knoppix.unpatched.org|sed -n 's/.*"\(.*\)"/\1/gp'`

Hopefully, spambots don't execute shell commands yet. (As a matter of fact, I can't wait for them to start doing that. :wink:

garyng
08-09-2003, 01:11 AM
Go to here http://www.skyjammer.com/files/knoppix/ to get the w32grub and follow the instruction and see if you can get GRUB working.

Pointsec you mentioned seems like an encryption mechanism that may not be compatible with GRUB and if that is the case, everything is off. If GRUB work, we can come back and move on to the next stage.


Due my Laptop bios Admin password is missing and and the HD is encripted with pointsec I cant repartition so I need to recurr to this trick I have winxp pro but cant make a repartition can you give some hints how i can work around , also the files you mention would be great to have them.

Br
Gabriel Vergara


If you want to try, I can find a way to send you the 3 files(one win32, and two grub image stage1 and stage2). All that is needed is a c:\ with NTFS. The process itself is non-intrusive as the win32 program just modify the regular file stage1/stage2 under NT/XP and won't touch the boot record etc.

I'll install the above in vmware. Just send me the files and tell me how to install them from win2k. I'll post the results here.

I see we can't PM here for some reason so I'll have to publish an email address here. Excuse my ugly way of doing so. Your shell will handle it :)

Mail `host -t TXT knoppix.unpatched.org|sed -n 's/.*"\(.*\)"/\1/gp'`

Hopefully, spambots don't execute shell commands yet. (As a matter of fact, I can't wait for them to start doing that. :wink: