Search My Blog

Friday, May 4, 2012

Grub2 - I want to make a Multi Boot Linux ISO Testing Setup and I want to be able to Boot my ISO Files into Live Systems.

I'm trying to install Grub2 on a SATA Hard Drive that is plugged into a USB Adapter. The drive has Win7 on the Second Partition with a hidden First Partition called, “System Reserved” (since it came out of a Laptop). There is a Third Partition with Data on it and that is the Partition that I want to make a Multi Boot Linux ISO Testing Setup on. I want to be able to Boot my ISO Files into Live Systems, like you can do with USB Stick Drives... I want to install Gru2 on the MBR, since it seems like an easy Boot Loader to use for this purpose. I am doing this in ArtistX Linux, since it has Grub2 installed as it's default Boot Loader. I already tried in Fedora 14. But, just ended up with Grub2 installed on my Hard Drive, as a Second Boot Loader.



How To Re-install GRUB
The following two commands will work from withing a running Ubuntu operating system
grub-setup /dev/sdb
- this example installs the IPL for GRUB to the second hard disk's MBR  


How To Install GRUB to a Partition Boot Sector
grub-setup --force /dev/sda2
  • this example installs /boot/grub/boot.img  to the boot sector of /dev/sda2
    (The GRUB from the operating system you're working in will be installed to /dev/sda2).
    NOTE: GRUB 1.96 didn't seem to like having it's IPL installed to a partition boot sector, it complained and required the use of --force to get it to work.

    TIP: If you can't boot Ubuntu in the normal way you can  use your GRUB2RESCUE CD and see the following link,  GRUB2 How To Boot From CLI Mode -  NEW!  Rescue your System.
    Alternatively, you could  use your Ubuntu Live CD and mount the operating system concerned and chroot into it to run these commands.
I'm running from Krusader root mode Konsole, opened from Krusader...
grub-setup /dev/sdc

root@artistxbluefic:/media# grub-setup /dev/sdc
root@artistxbluefic:/media#

May have worked... It put “boot/grub” on C drive of the Win7 Partition on my USB HD. No grub.cfg file though....

But it has no grub.cfg

7. Run grub-mkconfig
sudo grub-mkconfig -o /media/Verbatim/boot/grub/grub.cfg

8. Relax the file permissions to make it easily editable from GUI mode, (user freindly).
Let's make it editable so we can play with it.
sudo chmod 777 -R /media/verbatim /boot

Now we can open it in GUI mode even if we want and edit the grub.cfg file to our heart's content.
From... http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html#GRUB_USB



I'm running from Krusader root mode Konsole, opened from Krusader...
grub-mkconfig -o /media/2CB2E613B2E5E176/boot/grub/grub.cfg



root@artistxbluefic:/# grub-mkconfig -o /media/2CB2E613B2E5E176/boot/grub/grub.cfg
Generating grub.cfg ...
Found background image: moreblue-orbit-grub.png
Found linux image: /boot/vmlinuz-2.6.32-36-generic
Found initrd image: /boot/initrd.img-2.6.32-36-generic
Found linux image: /boot/vmlinuz-2.6.32-35-generic
Found initrd image: /boot/initrd.img-2.6.32-35-generic
Found linux image: /boot/vmlinuz-2.6.32-28-generic
Found initrd image: /boot/initrd.img-2.6.32-28-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Professional on /dev/sda1
Found Windows 7 (loader) on /dev/sdc1
done
root@artistxbluefic:/#



It worked and found every OS on this System, including the USB HD that I am installing Grub2 on to... Time for Testing...
Don



Update:
I have since learned how to Add Other operating systems to the GRUB 2 menu. If you have other operating systems installed and wish to boot them via GRUB 2. So, I'm going to try it again with Fedora 16 LXDE, since is uses less resources and I like Fedora better. 
Here's what I have found on doing this...
Grub-1-and-2-grub-setup-dev-sdc-from-fedoraproject-org-and-how-to-install-grub-page.html
Don



Contents
[hide]
Introduction
GRUB 2 is the latest version of GNU GRUB, the Grand Unified Bootloader. A bootloader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to the operating system kernel, (Linux, in the case of Fedora). The kernel, in turn, initializes the rest of the operating system.
GRUB 2 has replaced what was formerly known as GRUB (i.e. version 0.9x), which has, in turn, become GRUB Legacy.
Starting with Fedora 16, GRUB 2 is the default bootloader on x86 BIOS systems. For upgrades of BIOS systems the default is also to install GRUB 2, but you can opt to skip bootloader configuration entirely.
Tasks / Common issues
Adding Other operating systems to the GRUB 2 menu
If you have other operating systems installed and wish to boot them via GRUB 2:
# yum install os-prober

# grub2-mkconfig -o /boot/grub2/grub.cfg
Note
As of the F16 Beta, os-prober should get pulled in automatically during install and used to auto-generate entries for your other installed operating systems.
Setting default entry
Due to grub2-mkconfig (and os-prober) we cannot predict the order of the entries in /boot/grub2/grub.cfg, so we set the default by name/title instead. To do this, first, we set
GRUB_DEFAULT=saved
in /etc/default/grub, and run
grub2-mkconfig -o /boot/grub2/grub.cfg
to update grub.cfg. Then we call
grub2-set-default <title or number>
with the title of the newly installed Fedora's entry. From that point on you can change the default by calling
grub2-set-default <title or number>
or view it by running
grub2-editenv list
To do that, you'll need the list of possible menu entries, which you can find with
grep menuentry /boot/grub2/grub.cfg
(Surely there's a better way?)
Note
There are other, simpler, ways of setting the default entry, but they are prone to error if/when grub2-mkconfig is re-run. These include directly setting the default in /boot/grub2/grub.cfg or setting GRUB_DEFAULT to either a number or an entry title in /etc/default/grub. Neither of these methods is recommended.
If you understand the risks involved and still want to directly modify /boot/grub2/grub.cfg, here's how you can do it:
Edit /boot/grub2/grub.cfg, and change the line
This is not the recommended method
This will not survive grub2-mkconfig. It might not even survive a kernel update.
set default="0"
to
set default="5"
Updating GRUB 2 configuration
It is safe to directly edit /boot/grub2/grub.cfg in Fedora. Grubby in Fedora modifies the configuration when a kernel update is performed but does so in a safe manner. Other distributions, in particular Debian and Debian-derived distributions provide a software patch that adds an update-grub command which is neither included nor needed in Fedora.
Encountering the dreaded GRUB 2 boot prompt
If improperly configured, GRUB 2 may fail to load and subsequently drop to a boot prompt. To address this issue, proceed as follows:
1. List the drives which GRUB 2 sees:
grub2> ls
2. The output for a dos partition table /dev/sda with three partitons will look something like this:
(hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)
3. While the output for a gpt partition table /dev/sda with four partitions will look something like this:
(hd0) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)
4. With this information you can now probe each partition of the drive and locate your vmlinuz and initramfs files:
ls (hd0,1)/
Will list the files on /dev/sda1. If this partition contains /boot, the output will show the full name of vmlinuz and initramfs.
5. Armed with the location and full name of vmlinuz and initramfs you can now boot your system.
5a. Declare your root partition:
grub> set root=(hd0,3)
5b. Declare the kernel you wish to use:
grub> linux (hd0,1)/vmlinuz-3.0.0-1.fc16.i686 root=/dev/sda3 rhgb quiet selinux=0
# NOTE : add other kernel args if you have need of them
# NOTE : change the numbers to match your system
5c. Declare the initrd to use:
grub> initrd (hd0,1)/initramfs-3.0.0-1.fc16.i686.img
# NOTE : change the numbers to match your system
5d. Instruct GRUB 2 to boot the chosen files:
grub> boot
6. After boot, open a terminal.
7. Issue the grub2-mkconfig command to re-create the grub.cfg file grub2 needed to boot your system:
grub2-mkconfig -o /boot/grub2/grub.cfg
8. Issue the grub2-install command to install grub2 to your hard drive and make use of your config:
grub2-install --boot-directory=/boot /dev/sda
# Note: your drive may have another device name. Check for it with mount command output.
Other GRUB 2 issues
Absent Floppy Disk : It has been reported by some users that GRUB 2 may fail to install on a partition's boot sector if the computer floppy controller is activated in BIOS without an actual floppy disk drive being present. A possible workaround is to run (post OS install) from rescue mode:
grub2-install <target device> --no-floppy
Further Reading


Don

GRUB 2 info
fedora grub2 - Google Search
Features/Grub2 - FedoraProject
GRUB 2 - FedoraProject
GRUB2 Linux bash Commands
DonsDeals: Automatically adding other distributions to Fedora Grub using os-prober « Hedayat’s Blog
DonsDeals: My brand new Debian 6 grub menu had no mention of WinXP:O
DonsDeals: GNU GRUB Boot loader both grub v1 and v2
Grub2
Configuring Grub 2 | Linux Journal
Mastering Grub 2 The Easy Way
GRUB2 Linux bash Commands
GRUB2 Linux bash Commands
GRUB2 Linux bash Commands
How to I make a bootable CD that contains grub2?
Mastering Grub 2 The Easy Way
Super Grub(2) Disk (English)
Configuring Grub 2 | Linux Journal
install grub2 into folder with space in name - Google Search
How to install and boot 145 operating systems in a PC - JustLinux Forums
DonsDeals: How to install and boot 145 operating systems in a PC - JustLinux Forums
How to install and boot 145 operating systems in a PC - JustLinux Forums
Fun with GPT partitioning - JustLinux Forums
Grub Boot Loader Changing Run Levels in Fedora at Boot Time
grub run level 3 - Google Search
DonsDeals: Changing Run Levels in Fedora at Boot Time...
Grub boot runlevel 3
Grub 1 and 2 Boot Loader
fedora grub2 on DonsDeals Blog
DonsDeals: Clonezilla How Too&apos;s
update-grub
Grub2 info
artistx boot windows xp grub 2 commands - Google Search
How to I make a bootable CD that contains grub2?
Debian User Forums • View topic - Windows XP won&apos;t boot from GRUB2
How to add XP / Vista / Windows install iso to GRUB2 multiboot? - Hak5 Forums
Mastering Grub 2 The Easy Way
supergrub disk 2 - Google Search
Super Grub(2) Disk (English)
Super Grub Disk Webpage
Grub - Boot gru2 from grub1
boot gru2 from grub1 - Google Search
GNU GRUB - Wikipedia, the free encyclopedia
Grub - Debian Wiki
boot - Entry for Grub1 on sda3 into the main Grub2 on sda - Ask Ubuntu - Stack Exchange
Anaconda (installer) - Wikipedia, the free encyclopedia
Modifying Solaris Boot Behavior on x86 Based Systems (Task Map) - System Administration Guide: Basic Administration
GRUB2 Bootloader Editor KDE-Apps.org
Booting linux on x86 with grub2
Grub2 and os-prober
DonsDeals: My brand new Debian 6 grub menu had no mention of WinXP:O
os-prober - Google Search
DonsDeals: Automatically adding other distributions to Fedora Grub using os-prober « Hedayat’s Blog
os-prober

No comments: