Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Description of GRUB 2

942 views

Published on

Describes features of grub followed by installation,exploration, customizing , error recovery and password hacking grub.

Published in: Technology
  • Be the first to comment

Description of GRUB 2

  1. 1. GNU-GRUB GNU'S Not Unix- GRand Unified Bootloader...
  2. 2. What will we be covering? ● Introduction to GRUB ● Installing GRUB ● Exploring GRUB ● Customizing GRUB ● GRUB Error Recovery
  3. 3. Introduction...err...Features ➔ Many features and lot of flexibility ➔ Supports booting multiple operating systems ➔ Support for many boot devices ➢ ➔ Hard disk (of course), cd-rom(El-Torito), network(tftp) Support for many file systems (ext2/3, xfs, jfs,reiserfs, dos, fat16, fat32...) ➔ Configuration File
  4. 4. Features (continued) ➔ ➔ Support for network cards (etherboot) Menu Interfaces for regular and command interface for advanced users ➔ Remote control from serial console. ➔ Supports multiple executable formats ➔ Can uncompress compressed files.
  5. 5. Installing GRUB From Scratch (i.e. on a blank disk) ➔ Do it from a host with GNU/GRUB installed. ➔ Create a partition on disk fdisk /dev/sda ➔ Format and mount this partition: mkfs.ext3 /dev/sda1 sudo mount /dev/sda1 /mnt/sda1
  6. 6. Installation....(Continued) ➔ Download grub tarball ftp://ftp.gnu.org/gnu/grub ➔ Compiling :) ➔ Install grub: grub-install –root-directory=/mnt/sda1 /dev/sda grub-mkconfig -o /boot/grub/grub.cfg A secret: The grub-install (Just a shell script !!! :-O) The real heroes are : ➔ 'grub-mkimage' and ➔ 'grub-setup'
  7. 7. Exploring(The quest to learn GRUB-fu) ➔ Changes??? ➔ /boot/grub ➔ /etc/grub.d ➔ /etc/default/grub ➔ Other places: /usr/lib/grub(Modules)| /usr/bin or /bin (Binaries),Docs
  8. 8. Exploring....(Digging In) ➔ Scanning grub.cfg(/boot/grub/grub.cfg) Phew!!.....looks complicated....(actually non-editable)we'll come back later. ➔ Peeking in /etc/grub.d ➔ ➔ 10_* Native boot entries ➔ 20_* Third party apps ➔ 30_osprobe :Scans for other O.S. ➔ ➔ 00_* contains header info 40_custom : Custom templates for additional entries Looking at /etc/default/grub.... Hmmm....looks interesting.!!! :)
  9. 9. Customizing GRUB ➔ Some Theory: Custom Settings /etc/default/grub /etc/grub.d/ /boot/grub/grub.cfg Custom Scripts
  10. 10. What can we do?
  11. 11. Making Custom Settings ➔ We change the /etc/default/grub file. ➔ Some of the configurations are: ➔ GRUB_DEFAULT, ➔ GRUB_TIMEOUT, ➔ GRUB_HIDDEN_TIMEOUT, ➔ GRUB_DISABLE_RECOVERY, ➔ GRUB_BACKGROUND, ➔ GRUB_THEME, ➔ .....AND MANY MORE.
  12. 12. Making Custom Scripts ➔ Can be done by adding scripts in ➔ Sample: echo "Some string" – cat << EOF – menuentry "Something" { – set root=(hdX,Y) – -- boot parameters -- – }EOF /etc/default/grub
  13. 13. .....digging deeper ➔ Boot parameters ➔ Linux: linux /boot/vmlinuz initrd /boot/initrd.img ➔ Windows: chainloader (hdX,Y)+1 ➔ Stuck?....... Get a peek in os-prober output!! ;-)
  14. 14. Grub Error Recovery ➔ Common Errors faced in GRUB ➔ GRUB Rescue
  15. 15. Error Recovery Contd... ➔ The Easy Way Out: A Rescue CD. ➔ The Tough Way: set prefix=(hdx,y)/boot/grub insmod (hdx,y)/boot/grub/linux.mod set root=(hdx,y) linux /boot/vmlinux-<version> root=/dev/sda5 #Change the numbers initrd /boot/initramfs-3.0.0-1.fc16.i686.img boot grub-install /dev/sda5 #After booting #Change the numbers
  16. 16. Error Recovery Contd.... ➔ Error with UEFI ➔ Try disabling Secure-Boot ➔ Install grub-efi and shim packages grub-mkconfig -o /boot/efi/EFI/$distr/grub.cfg ➔ Try using Boot-Repair ➔ Report a bug Forums to the rescue.
  17. 17. Hacking With GRUB ➔ With GRUB users can access single user mode(root) ➔ How? ➔ ➔ ➔ Booting in recovery mode and going to root Modifying kernel arguments(Press a): appending '1' at the last of arguments On root prompt type passwd to change password!!!:-D
  18. 18. Securing GRUB ➔ Setting a password for GRUB ➔ Editing /etc/grub.d/00_header cat <<EOF set superusers=”user1” password <user> <password> export superusers EOF ➔ Password protect menu entries menuentry ... --unrestricted {#all menuentry ... --users "" { #superuser menuentry ... --users Umar,hello {#superuser,umar,hello
  19. 19. Securing....Continued. ➔ Adding hashed password $ grub-mkpasswd-pbkdf2 Enter your password: Re-enter your password: Your PBKDF2 is ................................. Now adding the output to 00_header (in /etc/grub.d) ➔ set superusers=”Umar” password_pbkdf2 Umar grub.pbkdf2.sha512.10000.FC58373BCA15A797C418C1EA7FFB007BF5A5
  20. 20. What we haven't covered ➔ List of command line and menu-entry commands ➔ All the bugs/errors which you may encounter. ➔ Designing of GRUB themes. ➔ GRUB environment variables/block. ➔ Booting with GRUB on a network.
  21. 21. Where to go from here? ➔ GNU-GRUB Documentation http://www.gnu.org/software/grub/manual/ ➔ GRUB Mailing list help-grub@gnu.org ➔ bug-grub@gnu.org grub-devel@gnu.org Wiki's https://fedoraproject.org/wiki/GRUB_2 https://wiki.archlinux.org/index.php/GRUB https://help.ubuntu.com/community/Grub2
  22. 22. THAT's ALL FOLKS

×