Wikula » Grub2versus
under construction
This page attempts to explain the common grub legacy commands VERSUS the grub2 way.
Terms
Grub legacy is often used to show you are not using grub2. Although grub legacy may be a patched grub including grub-gfxboot we understand its grub (1) relative to
grub2.
On this page, grub means grub legacy.
grub uses
root (hdx,y)
counting hard drives and partitions from zero
grub2 uses
set root=(hdx,y+1)
counting hard drives from zero and partitions from one.
grub2 can be used to find the correct device by
grub uses
kernel /boot/vmlinuz (where boot is a sub-folder to /)
kernel /vmlinuz (if separate boot partition)
grub2 changes those partitions to
linux /boot/vmlinuz
linux /vmlinuz
Something can be UUID=string or LABEL=string or /dev/sdxn eg /dev/sda1
There is no change to that line for either grub but grub2 may have a new line defining new pathways.
eg
search --fs-uuid --set b80526eb-79da-4f0a-886a-7354534973a2
See Grub2cfg if interested.
my LQ post is pretty good as showing what grub legacy can do at command mode
http://www.linuxquestions.org/questions/linux-software-2/discussion-new-grub-trouble-shooter-278748/∞
Similar techniques can be used with grub2 but grub2 has its own modules, that MAY need loading if they do not autoload...using command insmod (modulename without the .mod)
eg insmod usb_keyboard...(How to do this if you need it tho? ....answer..your menuenty will need it inserted at top of grub.cfg)
Lets cover the basic ones if you need to troubleshoot your grub failing to complete boot.
root (hd....and press TAB key to autocomplete hard drives/partitions grub can detect
it may become root (hd0,...tab and so on until you recognise your partition)
grub2
ls (does same thing)
cat /boot/grub/menu.lst
--> output of file
grub2
same command but different filename but same effect
You may also need to cat your /etc/fstab if you do not know your / partition.
There is a grub2 cat module but it was autoloaded when I tested. Otherwise on your system you may need to insert the cat module first?
insmod cat
cat /boot/grub/grub.cfg
grub
find /boot/vmlinuz
grub2
search -f /boot/vmlinuz
Here -f means file. grub2 search has extra options, but to boot we only need to know how to boot by setting the boot partition, setting the kernel and any initrd pathways
and the balance of the linux line.....and action it with command = boot
grub
root (hd0,0)
kernel /boot/v(tab autocompletes) root=/dev/sda1 vga=791
initrd /boot/i (tab autocompletes)
boot
grub2
set root=(hd0,1)
linux /boot/v(tab autocompletes) root=/dev/sda1 vga=791
initrd /boot/i (tab autocompletes)
boot
As you can see, not exactly the same but similar
grub
title boot another ms partition
root (hd0,5)
map (hd0,0) (hd0,5)
map (hd0,5) (hd0,0)
hide (hd0,0)
chainloader +1
grub2
menuentry" boot another ms partition"{
set root=(hd0,4)
drivemap -s (hd0,1) (hd0,4)
chainloader +1
}
Above example is for first partition is C for ms...linux is second or third partition...who cares
Another ms partition..on a logical...is grub legacy hd0,5 and needs to hide the bootloader for first c partition
grub
boot live cd which has a grub legacy
grub2
boot a live cd which has grub2
(probably a remaster sidux as there are very few real grub2 live cds atm)
Explanation, although this is normally used to overwrite grub legacy in mbr....it works fine to redo grub2 in mbr.
If you have a remastered sidux....you could chroot into the mounted partition /usr that holds /usr/sbin/upgrade-from-grub-legacy
but you can also run the script from the cd as in
./upgrade-from-grub-legacy
see Grub2slit
Back to grub2 homepage
This page attempts to explain the common grub legacy commands VERSUS the grub2 way.
Terms
Grub legacy is often used to show you are not using grub2. Although grub legacy may be a patched grub including grub-gfxboot we understand its grub (1) relative to
grub2.
On this page, grub means grub legacy.
Define pathway to /boot partition
Either /boot is a sub-folder to / or on its own partition. Either way, both grubs need to know where the balance of the booting files are located.grub uses
root (hdx,y)
counting hard drives and partitions from zero
grub2 uses
set root=(hdx,y+1)
counting hard drives from zero and partitions from one.
grub2 can be used to find the correct device by
grub-probe -t device /boot/grub --> returns (hdx,y)
Define pathway to kernel
grub uses
kernel /boot/vmlinuz (where boot is a sub-folder to /)
kernel /vmlinuz (if separate boot partition)
grub2 changes those partitions to
linux /boot/vmlinuz
linux /vmlinuz
Define root partition
On the kernel line both grubs define where root partition is with root=something.Something can be UUID=string or LABEL=string or /dev/sdxn eg /dev/sda1
There is no change to that line for either grub but grub2 may have a new line defining new pathways.
eg
search --fs-uuid --set b80526eb-79da-4f0a-886a-7354534973a2
See Grub2cfg if interested.
Troubleshooting using the command mode. This section is for only command mode
Both grubs can access grub shell (=grub command mode = command line interface) by pressing C for commands at the menuentry stage of booting.my LQ post is pretty good as showing what grub legacy can do at command mode
http://www.linuxquestions.org/questions/linux-software-2/discussion-new-grub-trouble-shooter-278748/∞
Similar techniques can be used with grub2 but grub2 has its own modules, that MAY need loading if they do not autoload...using command insmod (modulename without the .mod)
eg insmod usb_keyboard...(How to do this if you need it tho? ....answer..your menuenty will need it inserted at top of grub.cfg)
Lets cover the basic ones if you need to troubleshoot your grub failing to complete boot.
Can grubs see your hard drive(s) and partition(s)?
grubroot (hd....and press TAB key to autocomplete hard drives/partitions grub can detect
it may become root (hd0,...tab and so on until you recognise your partition)
grub2
ls (does same thing)
Can you spot an issue to config file?
grubcat /boot/grub/menu.lst
--> output of file
grub2
same command but different filename but same effect
You may also need to cat your /etc/fstab if you do not know your / partition.
There is a grub2 cat module but it was autoloaded when I tested. Otherwise on your system you may need to insert the cat module first?
insmod cat
cat /boot/grub/grub.cfg
Can grubs find your kernel?
Assuming its vmlinuz*...it could ALSO be called linux* or kernel* or bzImagegrub
find /boot/vmlinuz
grub2
search -f /boot/vmlinuz
Here -f means file. grub2 search has extra options, but to boot we only need to know how to boot by setting the boot partition, setting the kernel and any initrd pathways
and the balance of the linux line.....and action it with command = boot
UUID commands Not a grub2 command mode
grub2 can be used to detect your UUID. But this is done for a booted up system and not at the command mode.grub-probe -t fs_uuid /boot/grub --> returns UUID string
To boot my distro from commands I can do this....the TAB key can autocompete bits of it
grub
root (hd0,0)
kernel /boot/v(tab autocompletes) root=/dev/sda1 vga=791
initrd /boot/i (tab autocompletes)
boot
grub2
set root=(hd0,1)
linux /boot/v(tab autocompletes) root=/dev/sda1 vga=791
initrd /boot/i (tab autocompletes)
boot
As you can see, not exactly the same but similar
Comparing map commands
grub
title boot another ms partition
root (hd0,5)
map (hd0,0) (hd0,5)
map (hd0,5) (hd0,0)
hide (hd0,0)
chainloader +1
grub2
menuentry" boot another ms partition"{
set root=(hd0,4)
drivemap -s (hd0,1) (hd0,4)
chainloader +1
}
Above example is for first partition is C for ms...linux is second or third partition...who cares
Another ms partition..on a logical...is grub legacy hd0,5 and needs to hide the bootloader for first c partition
Installing grub(s) to MBR
grub
boot live cd which has a grub legacy
su grub root (hdx,y) setup (hd0) quit (where hdx,y counts x and y from zero to define where your boot partition is)
grub2
boot a live cd which has grub2
(probably a remaster sidux as there are very few real grub2 live cds atm)
su upgrade-from-grub-legacy
Explanation, although this is normally used to overwrite grub legacy in mbr....it works fine to redo grub2 in mbr.
If you have a remastered sidux....you could chroot into the mounted partition /usr that holds /usr/sbin/upgrade-from-grub-legacy
but you can also run the script from the cd as in
./upgrade-from-grub-legacy
see Grub2slit
Back to grub2 homepage

