Grub2: Difference between revisions

From Halfface
Jump to navigation Jump to search
(New page: As an example how I would use Grub to solve the OP problem as follow. ==(1) I boot up a Grub CD (or a floppy) to get a Grub prompt.== ==(2) I type== Code: As an example how I would use G...)
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
As an example how I would use Grub to solve the OP problem as follow.
==kali linux in grub2==
 
Store iso on standard partition.
==(1) I boot up a Grub CD (or a floppy) to get a Grub prompt.==
menuentry "Kali Linux" {
 
    iso="/iso/kali-linux-1.0.8-amd64.iso"
==(2) I type==
    bootoptions="findiso=$iso boot=live noconfig=sudo username=root hostname=kali quiet splash"
Code:
    search --set -f $iso
As an example how I would use Grub to solve the OP problem as follow.
    loopback loop $iso
 
    linux (loop)/live/vmlinuz $bootoptions
(1) I boot up a Grub CD (or a floppy) to get a Grub prompt.
    initrd (loop)/live/initrd.img
 
  }
(2) I type
==kali linux grub2 efi boot==
Code:
Content of /etc/grub.2/40_custom of fedora 21 machine.
 
# Install grub2-efi-modules to make loopback work.
  geometry (hd0)
  # Copy file to this location /boot/efi/EFI/fedora/x86_64-efi/loopback.mod
 
menuentry "Kali Linux" {
to see the hard disk partitions layout. Since this is a Fedora C3 it must has a Type 83 partition for /boot, a Type 8e for LVM and a Type 7 for the XP. FC3 may have several Type 83 partitions if LVM is not used but the /boot is always at the front. Say the first type 83 partition is number 2 then I can fire up Fedora by
    insmod loopback
Code:
    iso="/iso/kali-linux-1.0.8-amd64.iso"
 
    bootoptions="findiso=$iso boot=live noconfig=sudo username=root hostname=kali quiet splash"
root (hd0,2)
    search --set -f $iso
configfile /grub/grub.conf
    loopback loop $iso
 
    linuxefi (loop)/live/vmlinuz $bootoptions
--------------------------
    initrdefi (loop)/live/initrd.img
If I want to be lazy I can ask Grub to find out which partition has grub.conf by command
  }
Code:
 
  find grub.conf
 
and use that partition reference for the above "root" command.
 
I can also restore the Grub without booting up Fedora by
Code:
 
root (hd0,2)
setup (hd0)
 
the above is exactly what would be achieved by Fedora's installation CD except it is done with a Linux and Grub can do it without a boot-up Linux.
 
Also if the Fedora still doesn't boot I can ask Grub to diaplay its cconfiguration file by
Code:
 
cat (hd0,2)/grub/grub.conf
 
I can then follow line by line to type the same command at the terminal boot Fedora "manually" and vary the parameters at the same time if needed.
 
A Grub floppy or CD can fire up the XP, say if it is in the 1st partition, by
Code:
 
root (hd0,0)
  chainloader +1
boot
 
Grub counts from 0 so hda3 is (hd0,2) and so on.
 
You see one humble Grub floppy (with only 2 files inside) or Grub CD (with only one file inside) can solve your booting problems for good!

Latest revision as of 06:37, 29 October 2014

kali linux in grub2

Store iso on standard partition.

menuentry "Kali Linux" {
   iso="/iso/kali-linux-1.0.8-amd64.iso"
   bootoptions="findiso=$iso boot=live noconfig=sudo username=root hostname=kali quiet splash"
   search --set -f $iso
   loopback loop $iso
   linux (loop)/live/vmlinuz $bootoptions
   initrd (loop)/live/initrd.img
}

kali linux grub2 efi boot

Content of /etc/grub.2/40_custom of fedora 21 machine.

# Install grub2-efi-modules to make loopback work.
# Copy file to this location /boot/efi/EFI/fedora/x86_64-efi/loopback.mod
menuentry "Kali Linux" {
   insmod loopback
   iso="/iso/kali-linux-1.0.8-amd64.iso"
   bootoptions="findiso=$iso boot=live noconfig=sudo username=root hostname=kali quiet splash"
   search --set -f $iso
   loopback loop $iso
   linuxefi (loop)/live/vmlinuz $bootoptions
   initrdefi (loop)/live/initrd.img
}