PDA

View Full Version : setup lilo to boot from hd



sunpascal
01-13-2005, 07:09 AM
Hi,

Is it possible to setup lilo to boot from hard disk with Knoppix installed as image (using knoppix tohd at the bootprompt) ?
I do not want to install it using knoppix-installer.
I am new to linux and I have no idea of this...
I have only linux on my hard disk, so the configuration shouldn't be complicated, right?

Pascal

bfree
01-13-2005, 10:38 AM
Is it possible to setup lilo to boot from hard disk with Knoppix installed as image (using knoppix tohd at the bootprompt) ?

Maybe, you can certainly do this with grub and I would suspect with lilo also, but I would suggest grub rather then lilo. It doesn't make much difference though.


I have only linux on my hard disk, so the configuration shouldn't be complicated, right?

I don't think it is too complicated but I don't know for sure how to do it and can't test it out here and now. Between what I know and am reading ...

Boot into Knoppix and make a boot/grub directory on the partition you are using. You may need to copy the files stage* from /usr/share/grub/i386-pc (they could be somewhere else in which case locate stage might help) and put them in the boot/grub directory but I think grub-install will take care of this.

Next create a menu.lst for grub in the boot/grub directory. You could probably steal and modify one from the last page of the thread on iso booting with grub and ntfs if you needed to but there's plenty of examples around. Here's an example from my menu.lst ,slightly modified to try and strip some of my unusual cheatcodes and make it suit you a bit better (if you have everything in the first partition of your first hard disk).



title Knoppix 3.7 kernel 2.6
kernel (hd0,0)/boot/linux26 ramdisk_size=100000 init=/etc/init lang=ie apm=power-off vga=791 nomce quiet noprompt splash dma fromhd=/dev/hda1
initrd (hd0,0)/boot/minirt26.gz
boot


You'll probably need to get the linux26 and minirt26.gz from the cd.

Finally run "grub-install --recheck --root-directory=/mnt/hda1 /dev/hda" again assuming you are just on the first partition of the first hard disk, and that you mount it as /mnt/hda1. I'm not certain recheck is neccessary, it may not be. Recheck checks the device mappings so as long as Klaus hasn't left some trace of his system behind, which I doubt, it probably generates it anyway. I'm also not sure if --root-directory is required, if grub needs to know about your menu.lst at this stage.

If you try this and it works let everyone know! If you aren't brave enough say so also though and perhaps someone else will test it out or tell you for sure just how you should do this!

CrashedAgain
01-14-2005, 03:04 AM
Here is a (slightly edited) except from a how-to (not currently available since the docs are down).


Step 1: Partition the HD and install Knoppix

Partition the HD as above and install Knoppix as a 'Knoppix style' HD install. With Knoppix 3.3 & 3.4 the install command is 'sudo knoppix-installer', this may change for later versions of Knoppix. Put the bootloader lilo on the MBR, it will be used to boot the 'toHD' install as well.

Step 2: Install the 'toHD' system on hda1 & set up to boot from lilo

To install, just boot Knoppix with the boot code 'knoppix tohd=/dev/hda1' at the boot prompt.

In order to boot the 'toHD' install without requiring a boot disk, a directory /boot containing at least the minimum required files to boot Knoppix must be installed on hda1. First create the directory then as root do the following:

For Knoppix 3.3:
The minimum files are vmlinuz and miniroot.gz which can not be directly copied from the CD, they are buried in /boot.img. To extract the files, the boot.img must first be mounted on a loop device then on an intermediate mount point (use the existing directory /mnt/floppy) from which they can be copied to hda1. For simplicity we are just going to copy all the files in the boot.img.

/sbin/losetup /dev/loop0 /mnt/cdrom/KNOPPIX/boot.img
mount /dev/loop0 /mnt/floppy/
cp /mnt/floppy/* /mnt/hda1/boot

Then edit /etc/lilo.conf adding the following:

image=/mnt/hda1/boot/vmlinuz
label="toHDKnoppix"
append="lang=us fromhd=/dev/hda1 home=scan myconfig=scan apm=power-off"
initrd=/mnt/hda1/boot/miniroot.gz
read-only
(Change "lang=" as appropriate, only include the home=scan & myconfig=scan if you are using 'persistent home')

For Knoppix 3.4 & up:

The required files are linux24, linux26, minirt24.gz & minirt26.gz. These are located in the directory /boot/isolinux on the CD and can be directly copied to hda1 from there. The easiest way is to just use konqueror and drag-drop the entire directory '/mnt/cdrom/isolinux' to /mnt/hda1/boot/.

Then add the following to lilo.conf:

boot=/dev/hda

image=/mnt/hda1/boot/isolinux/linux24
label="Knoppix3.4-24"
append="lang=us fromhd=/dev/hda1 home=scan myconfig=scan apm=power-off"
initrd=/mnt/hda1/boot/isolinux/minirt24.gz
read-only

image=/mnt/hda1/boot/isolinux/linux26
label="Knoppix3.4-26"
append="lang=us fromhd=/dev/hda1 home=scan myconfig=scan apm=power-off"
initrd=/mnt/hda1/boot/isolinux/minirt26.gz
read-only

# Boot Windows on hda1
other=/dev/hda1
label="Windows"
table=/dev/hda


You should be able to install lilo from the toHD install but you will have to copy /etc/lilo.conf to /home first as you cannot edit in the /etc directory & then run lilo with 'lilo -C /home/etc/lilo.conf'.

sunpascal
01-14-2005, 12:59 PM
ok, i tried both.
However I can not write to / , not even from the root console. I had also trouble getting write acess to hda1 on which I have the knoppix image. It said Writable: Yes when I pointed on the icon on the desktop, but I could only copy the linux26 and minirt.gz from the command line.
I now put my configuration files on my hda3 partition and specified that when I ran lilo and grub. Here's what I get when I do that:

root@ttyp2[knoppix]# lilo -C /mnt/hda3/lilo.conf
Warning: /mnt/hda3/lilo.conf should be owned by root
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
Incompatible libdevmapper 1.00.19-ioctl (2004-07-03)(compat) and kernel driver
Fatal: creat /boot/map~: Read-only file system

root@ttyp2[knoppix]# grub-install /dev/hda
mkdir: cannot create directory `/boot/grub': Read-only file system

I don't quite get that...
What am I doing wrong?[/url][/list][/list][/code][/quote]

CrashedAgain
01-14-2005, 04:41 PM
ok, i tried both.
However I can not write to / , not even from the root console. I had also trouble getting write acess to hda1 on which I have the knoppix image. It said Writable: Yes when I pointed on the icon on the desktop, but I could only copy the linux26 and minirt.gz from the command line.
I now put my configuration files on my hda3 partition and specified that when I ran lilo and grub. Here's what I get when I do that:

root@ttyp2[knoppix]# lilo -C /mnt/hda3/lilo.conf
Warning: /mnt/hda3/lilo.conf should be owned by root
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
Incompatible libdevmapper 1.00.19-ioctl (2004-07-03)(compat) and kernel driver
Fatal: creat /boot/map~: Read-only file system

root@ttyp2[knoppix]# grub-install /dev/hda
mkdir: cannot create directory `/boot/grub': Read-only file system

I don't quite get that...
What am I doing wrong?[/url][/list][/list][/code][/quote]

The problem is that Knoppix locks the partition on which the toHD installed is installed so your 'save config file' and your 'persistent home' must be on a different partition. When it's running, /home/knoppix (your home directory as user knoppix) is in memory unless you have created a persistent home. You will have to create the directory /mnt/hda1/boot using either windows or running from CD if your toHD is on hda1.
Note: If hda1 is an NTFS filesystem, don NOT write to is from Linux unless you use 'captive NTFS', if it's fat32 you are OK.
I'm not sure what is causing the /dev/mapper error, to be honest I have not installed lilo from a toHD installation, the how-to was written intending it to be installed from a full HD installation as part of a remastering setup. There is a way, it's in the docs but the docs are still down. Maybe try installing lilo using the CD instead of from the toHD.

sunpascal
01-14-2005, 05:27 PM
Even from the CD I can only create files from the root shell. No, I do not have windows and not a NTFS drive, this caused me already problems. The persisten home and config ARE ALREADY on a separate partition. I did create a boot/ directory and I copied the linux24 and minirt.gz to my ext3 filesystem. I just can't get the configuration files in the /etc directiory. And when I run grub or lilo a specify where my configuration file is, it just gives the errors I mentioned above.

Thanks for your help anyway... :wink:

CrashedAgain
01-15-2005, 05:23 AM
Why don't you want to do a full HD install?

sunpascal
01-15-2005, 06:00 AM
I had an HD install already, but I wasn't happy with the hardware detection.
And some programs didn't work, for example nothig happened when I clicked Samba Server.

By now I chose to install it as Knoppix Style. I'll see how it goes.

I am just wondering: How can I change the permissions for the existing samba.conf? How can I edit it as knoppix? Isn't there a graphical way? I cannot log on as root using KDE from a Knoppix-CD-like install, right?

CrashedAgain
01-15-2005, 03:47 PM
I had an HD install already, but I wasn't happy with the hardware detection.
And some programs didn't work, for example nothig happened when I clicked Samba Server.

By now I chose to install it as Knoppix Style. I'll see how it goes.

I am just wondering: How can I change the permissions for the existing samba.conf? How can I edit it as knoppix? Isn't there a graphical way? I cannot log on as root using KDE from a Knoppix-CD-like install, right?

I have run Knoppix style HD install for about a year, just recently changed to Debian sytle when I switched my Knoppix 3.4 install to Kanotix BH9. Just don't try to do an 'apt-get upgrade' on it, it survived one but I think I killed it with a second attempt.

Not exactly true, see this: http://www.knoppix.net/forum/viewtopic.php?t=16319

But there are several ways to work as root in a knoppix style install. There is the root shell entry on the start menu (although it is just as easy to open a normal terminal & type 'su'). If you first type 'xhost localhost' as user, you will be able to open X applications from root terminal eg 'konqueror' will open konqueror. You can also use kdesu from a terminal (logged in as user): eg 'kdesu konqueror' will start konqueror as root. To use kdesu you must first set a password for root, 'sudo passwd' will do that. I have desktop start icons for konqueror-as-root & kate-as-root. These I just drag'n'drop copied the icons from the start menu to the desktop then edited the application to run to be 'kdesu kate' instead of just 'kate'.

sunpascal
01-15-2005, 04:19 PM
thanks!
this helps a lot!

I think I'm getting there! :D

Jansi
01-21-2005, 03:28 PM
Why don't you want to do a full HD install?

I too am interested in doing the HD based CD-image installation, and my answer to your question: I have found that the CD-Image installation makes for a great public-use kiosk computer, as in a school setting or house with lots of users. Why? Because with this setup people are discouraged enerally can't mess with the OS, basically all garbage (cookies, cache, spyware, viruses, etc.) dissapear with every reboot, and even if users do figure out how to wreck it, it takes only about 30 minutes to set the whole thing up again!

The instructions here were *great* (thanks Markus!) for Knoppix 3.4 (I'd maybe only suggest chaning the 800MB min. to 900MB for the CD-image partition, since for some reason, more than once an 800MB partition in ext2 formatting proved not-enough):

http://www.knoppix.net/wiki/Hd_Based_HowTo#1.2.1._Knoppix_3.4_version_only

BUT these instructions (as they correctly indicate) only work with 3.4. What is frustrating is that the only reason they don't seem to work with more recent Knoppix releases is the very last step: specfically, "sudo lilo -C /mnt/hda6/lilo.conf" fails with the here-familiar "/dev/mapper/control:open failed: No such device\Is device-mapper driver missing from kernel?" error.

After setting the whole thing up with Markus' instructions on a friend's family computer (they were tired of visitors -- kids primarily -- abusing it and making windows unbootable), but by using 3.7 because 3.4 wasn't available, I had to finally give-up after several hours because I couldn't get past the last step (lilo). So I gave up and just ran knoppix-installer. What interested me is that the knoppix-installer ran lilo just-fine. So what is going on? I've read this thread and a few others on this topic... and while for many I'm sure it is enough info to solve the problem, I still don't understand neither the problem nor how to get around it. And anyway, it seems like this is a bug that came up in 3.6.

My instinct is to set it up with 3.7 and then just do the final step while booted from a 3.4 CD... I may try this on that friend's computer if I can get a hold of a 3.4 CD...

Jansi
01-23-2005, 03:47 PM
My instinct is to set it up with 3.7 and then just do the final step while booted from a 3.4 CD... I may try this on that friend's computer if I can get a hold of a 3.4 CD...

OK, tried that last night, just wanted to report that it worked great --

That is, I use Markus's instructions all the way up to the last step ("Let lilo write the boot loader to the master boot record (sudo lilo -C /mnt/hda6/lilo.conf)"), at which point I shutdown, boot off a Knoppix 3.4 CD, an type (in keeping with Markus' example):

sudo mount /dev/hda6 /mnt/hda6
sudo mount /dev/hda6 /boot
sudo lilo -C /mnt/hda6/lilo.conf

And it works fine.

Markus
01-23-2005, 06:58 PM
Umm, I didn't write the howto, just checked the wiki syntax due to conversion to mediawiki.
If you want to edit the howto or add to it, please do.

Jansi
01-24-2005, 10:44 PM
Umm, I didn't write the howto, just checked the wiki syntax due to conversion to mediawiki.
If you want to edit the howto or add to it, please do.

Oops! OK, I see how it works now. :-)

Thanks for the tip about editing -- I went ahead and added my bit about getting lilo to boot a copy of Knoppix 3.7 installed with the "tohd=" option (I believe that is called the "Poor Man's Installation", but correct me if I'm wrong).

Also, I see that someone else already corrected /mnt/hda6 to /dev/hda6
;-)

Markus
01-25-2005, 11:05 AM
Yeah, I edited the /mnt/hda6 -> /dev/hda6 although I must say I'm not sure if it was wise.
The point being that the device is mounted on all occasions, but the mountpoint is changed temporarily from /mnt/hda6 to /boot and then back to /mnt/hda6.
You'll notice that I just changed it back to what the original author meant as he's talking about a partition, not a device. It's debatable which is the correct syntax here, so I'll just go with the authors version here. You can of course change it again ;)

markcomp77
01-31-2005, 01:29 PM
root@ttyp2[knoppix]# lilo -C /mnt/hda3/lilo.conf

Warning: /mnt/hda3/lilo.conf should be owned by root
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
/dev/mapper/control: open failed: No such device
Is device-mapper driver missing from kernel?
Incompatible libdevmapper 1.00.19-ioctl (2004-07-03)(compat) and kernel driver
Fatal: creat /boot/map~: Read-only file system


write:
modprobe dm-mod <enter>
and lilo will work... without error


put dm-mod to /etc/modules & /etc/modules-2.6.9

> You need to have dm-mod loaded in your kernel
from http://groups.google.com/groups?hl=pl&lr=&threadm=1RPJV-5Sm-7%40gated-at.bofh.it&rnum=2&prev=/groups%3Fq%3Dlilo%2B%2Bdriver%2Bmissing%2Bfrom%2Bk ernel%2B%2522device%2Bmapper%2B%2522%26hl%3Dpl%26l r%3D%26as_qdr%3Dall%26selm%3D1RPJV-5Sm-7%2540gated-at.bofh.it%26rnum%3D2