LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to boot linux from linux? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-boot-linux-from-linux-673712/)

proNick 10-02-2008 06:04 AM

how to boot linux from linux?
 
hi all!

i have installed fedora on external hard drive, but i can not boot it because my notebook have no support for booting from external hdd.

but i already have one distribution of linux (gentoo) on my internal hard drive.

so, if you can help me how can i boot fedora from gentoo? can i do that? because i can see and mount my extrernal hdd from gentoo.


please if you can help me with that.

thank you in advance!

elprawn 10-02-2008 06:05 AM

Add the following to your grub.conf (gentoo)...

Code:

title Fedora
      kernel (hd1,0)/vmlinuz-on-fedora-boot ro root=/dev/VolGroup00/LogVol00 rhgb quiet
      initrd (hd1,0)/initrd-on-fedora-boot.img

If (hd1,0) isn't it, try changing to (hd1,1), (hd2,0) etc.

proNick 10-02-2008 06:36 AM

well, that's the problem, i tryed that earlier, because i'm recieving error message that selected disk does not exist.

on my machine, i have two internal hdd's and one external.

on that external is fedora i want to boot, on it's second partition - hd(2,1)


but, as i said, it can not recognize external hdd. that's why i asked if i can boot linux on external hdd from linux installed on internal hdd.

any ideas that may help?

tnx in adv!

Agrouf 10-02-2008 06:53 AM

You should try copying the fedora /boot partition to your gentoo drive in a specific partition and edit the initrd file to make sure the drivers for the USB drive are present and edit the fstab to point to the USB drive. Then add this partition to grub.

elprawn 10-02-2008 06:56 AM

Look in your /boot/grub/device.map (on gentoo) and find the entry for the USB HDD, if there isn't one, add one.

Nocore Ho 10-02-2008 07:14 AM

editing~~~

proNick 10-02-2008 07:29 AM

still same error.

my /boot/grub/device.map looks like this (i added last line manually):

(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc


and part of grub.conf:

title Fedora2
kernel (hd2,1)/boot/vmlinuz ro root=/dev/sdc2
initrd (hd2,1)/boot/initrd


vmlinuz and initrd are proper links to proper files on fedora partition.

again, i have two internal hdd's and one external.


any help?

elprawn 10-02-2008 07:43 AM

So, the boot partition is the second partition on sdc and sdc is the usb hard drive?

It also says that the root is /dev/sdc2? Isn't your root partition on a Linux LVM?

Agrouf 10-02-2008 07:46 AM

type 'find /boot/vmlinuz' at grub command prompt please and show me the result.

proNick 10-02-2008 07:48 AM

Quote:

Originally Posted by elprawn (Post 3297948)
So, the boot partition is the second partition on sdc and sdc is the usb hard drive?

It also says that the root is /dev/sdc2? Isn't your root partition on a Linux LVM?

hm... i'm not getting you well..

can it help if i post result of fdisk -l command:

Code:

localhost grub # fdisk -l

Disk /dev/sda: 95.0 GB, 95034885120 bytes
255 heads, 63 sectors/track, 11554 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        5777    46403721    7  HPFS/NTFS
/dev/sda2            5778      11553    46395720    f  W95 Ext'd (LBA)
/dev/sda5            5778      11553    46395688+  7  HPFS/NTFS

Disk /dev/sdb: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1        6081    48845601    7  HPFS/NTFS
/dev/sdb2            6082      12161    48837600    f  W95 Ext'd (LBA)
/dev/sdb5            6082        6343    2104483+  82  Linux swap / Solaris
/dev/sdb6            6344        8893    20482843+  83  Linux
/dev/sdb7            8894      10808    15382206  83  Linux
/dev/sdb8  *      10809      12161    10867941  af  Unknown

Disk /dev/sdc: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdc1              1      12749  102400000    7  HPFS/NTFS
/dev/sdc2  *      12750      17847    40949685  83  Linux
/dev/sdc3          17848      20397    20482875  83  Linux
/dev/sdc4          20398      24321    31519530    5  Extended
/dev/sdc5          20398      20652    2048256  82  Linux swap / Solaris
/dev/sdc6          20653      24321    29471211  83  Linux
localhost grub #


pinniped 10-02-2008 07:54 AM

Since the BIOS does not support booting from USB, you need to copy the kernel and initrd image from the external HD to an internal HD - perhaps in a subdirectory of /boot - call it 'ext', so you have /boot/ext/vmlinuz... and same with the initrd. Set up Grub's menu.lst to use that copy of the kernel and initrd to boot. The kernel should boot, but it might get stuck at attempting to mount the root filesystem - if that happens then you need to alter the initrd file so that it loads all drivers, waits until the system recognizes the external HD, then proceeds with switching from the initrd to the final filesystem.

proNick 10-02-2008 08:16 AM

Quote:

Originally Posted by pinniped (Post 3297955)
Since the BIOS does not support booting from USB, you need to copy the kernel and initrd image from the external HD to an internal HD - perhaps in a subdirectory of /boot - call it 'ext', so you have /boot/ext/vmlinuz... and same with the initrd. Set up Grub's menu.lst to use that copy of the kernel and initrd to boot. The kernel should boot, but it might get stuck at attempting to mount the root filesystem - if that happens then you need to alter the initrd file so that it loads all drivers, waits until the system recognizes the external HD, then proceeds with switching from the initrd to the final filesystem.


pinniped, you're right - i did as you wrote, kernel boots, but it can't mount any of the system directories.

how can i alter the initrd to load all the drivers? do i need to recompile the kernel?

monsm 10-02-2008 09:37 AM

Quote:

Originally Posted by proNick (Post 3297974)
pinniped, you're right - i did as you wrote, kernel boots, but it can't mount any of the system directories.

how can i alter the initrd to load all the drivers? do i need to recompile the kernel?

Yes, check out genkernel in Gentoo, it will allow you to compile a kernel and create the initrd file at the same time.

As I guess you have worked out by now, the external drive is probably not known at boot time by grub (it can't see it until after some of the drivers are loaded).

If you have a separate boot partition on one of the internal drives you can use that and set the real_root parameter in the grub.conf file to point to your /dev/sdc2 (or sdc3).


Mons

pinniped 10-02-2008 04:35 PM

Quote:

Originally Posted by proNick (Post 3297974)
pinniped, you're right - i did as you wrote, kernel boots, but it can't mount any of the system directories.

how can i alter the initrd to load all the drivers? do i need to recompile the kernel?

You need to boot into your usable system, then:

1. unpack the initrd:
mkdir tmp && cd tmp
cp /path/to/initrd initrd.gz
mkdir image && cd image
cpio -i < ../initrd

2. make changes as appropriate - sometimes it's just a matter of finding out what file determines what modules are loaded. You start reading through the 'init' script and see what it does. Somewhere there will be a file with a list of modules to load. You also need to check the lib/modules/... directory to make sure the modules you need are in the image; if they're not, mount your external HD and copy the necessary modules.

3. pack up the initrd again:
find . | cpio -o -H newc | gzip > ../your_initrd_name

Of course your new initrd doesn't have to have the same name as the original - in fact, don't name it like the original or you're screwed if it doesn't work. Just edit grub's menu.lst to use the new initrd.

When you get that working, look at customizing the mkinitramfs scripts on your new system so that the necessary modules are added and loaded; that would make updates much easier. Be careful tweaking the mkinitramfs scripts; some files are not meant to be touched because they will be replaced if the scripts are upgraded - however, there is usually some provision to allow the user to make lasting changes even when the scripts are upgraded.

proNick 10-08-2008 04:40 AM

hi all!

just to inform you that i did solve this thanks to your advices. solution was very much line in post #11, by pinniped.

in gentoo file system dir, i created new dir named /boot/ext/, and placed there vmlinuz and initrd files from fedora installation.

also, i have added next lines in grub.conf :

Title Fedora
kernel=(hd1,5)/boot/ext/vmlinuz
initrd=(hd1,5)/boot/ext/initrd


that's it, no root definition in grub.conf or anything else.

thank you all on your help!


All times are GMT -5. The time now is 05:54 PM.