Announcement

Collapse
No announcement yet.

HOW TO: GRUB Methods - Toolkit

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HOW TO: GRUB Methods - Toolkit

    HOW TO: GRUB Methods
    Toolkit for Installation, Rescue, Repair - Fixing Common GRUB problems

    If you have a problem or need some specific information, scan the Table of Contents, then scroll down to that SECTION, or go to the reference cited.

    TABLE OF CONTENTS

    GRUB ERRORS: See Reply #23

    REFERENCES: Listed at the end of this Table of Contents

    SECTION 1
    Basics
    --- Introduction: What is GRUB? Two key components that make GRUB work.
    --- Abbreviations
    --- Notation, GRUB devices (hdx,y), Linux devices sdxn, UUIDs
    --- Getting information about drives, GRUB files, menu.lst, fstab, UUIDs, version #'s
    --- IMPORTANT: Exploring your hard drive(s)
    fdisk, geometry, Tab-completion

    --- How to restart (reboot) or shutdown your PC at a command line (Konsole or in GRUB)

    SECTION 2
    GRUB facts
    How GRUB works, MBR, GRUB files, image directory, “first BIOS boot drive
    --- Installing GRUB, Stages, MBR, IPL, BIOS, /boot/grub/menu.lst

    SECTION 3
    Re-installing GRUB: the cure for many problems

    --- Re-installing/installing GRUB

    SECTION 4
    Menu.lst

    The boot menu: Editing/Fixing /boot/grub/menu.lst
    Accessing, backup, timeout, default
    Understanding the AUTOMAGIC KERNELS LIST
    Where to put Windows in menu.lst
    Make Kubuntu your default operating system
    Changing the order of the operating systems in the boot menu

    SECTION 5
    Dual-booting
    Installing two or more Linux operating systems
    > RECOMMENDED method

    > Problems – messing up the booting => fixing it
    > This applies to using one or more hard drives
    > If your situation involves Windows, see SECTION 6 below: “Windows topics”

    SECTION 6
    Windows topics

    --- Vista, dual-booting with XP and/or Kubuntu/Linux, see this definitive guide:
    http://apcmag.com/dualboot
    --- XP
    Installing XP & Kubuntu: How to set up dual booting
    Re-installed XP and now can't boot Kubuntu
    When XP is on a non-first hard drive
    --- Special Situations
    -- How to avoid installing GRUB to the MBR of your Windows XP drive
    -- Two drives, a Windows drive and a Kubuntu drive, GRUB is in the Windows MBR,
    but sometimes you must remove the Kubuntu drive
    and Windows won’t boot when you do.


    - - - - - - - - - - Reply #1 Topics Start Here- - - - - - - - - -

    The following topics are located in the next post -- Reply#1

    SECTION 7 (see Reply #1)
    Getting a copy of GRUB files: 4 ways to get GRUB files

    SECTION 8 (see Reply #1)
    Rescue booting or by menu.lst
    GRUB booting methods
    => booting in an emergency at grub>
    --- Configfile -- Booting
    --- Chainloading
    Booting a partition, booting a hard drive (MBR) by chainloading
    --- Booting directly using kernel & initrd; Tab-completion
    --- Boot into Kubuntu using the edit function “e” on a broken boot menu

    SECTION 9 (see Reply#1)
    Making and using a separate GRUB partition

    SECTION 10 (see Reply #1)
    Rescuing Your System, Emergencies, Fixing Boot problems
    SGD, Emergency boot methods, Working from a Live Kubuntu CD
    Options, strategies for accessing menu.lst and re-installing GRUB


    Special Topic:
    Use GRUB to Chainload LILO
    See Reply #17 of this thread


    REFERENCES
    All references for this post and for the topics under Reply #1 are included here:

    -- GRUB Manual:
    http://www.gnu.org/software/grub/manual/
    -- Super Grub Disk
    http://supergrub.forjamari.linex.org/
    -- GParted Live CD (and USB, how-to's on partitioning)
    http://gparted.sourceforge.net/
    -- Partitioning—how to, Rog131:
    http://kubuntuforums.net/forums/inde...opic=3090704.0
    => How to set up partitions for Kubuntu/Linux

    My other How-To's:
    -- Commands at Konsole: Beginners, in three parts
    http://kubuntuforums.net/forums/inde...opic=3091607.0
    -- How To Make GRUB Thumb Drive
    http://kubuntuforums.net/forums/inde...opic=3081748.0
    How to install K/Ubuntu 7.04 to an external USB hard disk drive (HDD), Reply #1
    -- Build a LIVE Kubuntu Flash Drive, How-To
    http://kubuntuforums.net/forums/inde...089474.new#new
    Step-by-step, with Persistence; usb-creator
    -- dd Command
    http://kubuntuforums.net/forums/inde...opic=3090824.0
    -- Privacy Cleanup 101
    http://kubuntuforums.net/forums/inde....msg115011#new
    Reply #8: How to Delete Data from Your Hard Drives & USB Drives
    -- RESCUE Partitions & Data; Data Rescue Links & Comments & Tips
    TestDisk -- PhotoRec -- Knoppix (or other Live CDs)
    http://kubuntuforums.net/forums/inde...opic=3091847.0
    -- Kubuntu & KDE 4 desktop interface: concepts, terms
    http://kubuntuforums.net/forums/inde...seen#msg160263


    -- Bigpond, home
    http://users.bigpond.net.au/hermanzone/
    => see the GRUB page, dual-booting
    -- Tuxfiles
    http://www.tuxfiles.org/
    -- Psychocats
    http://www.psychocats.net/ubuntu/index.php

    Windows:
    -- Dual boot Vista – The Definitive Guide:
    http://apcmag.com/dualboot
    -- How to boot Linux from Windows:
    Boot Linux from Windows
    http://www.vsubhash.com/writeups/multiboot_os.asp
    He’s a Windows guy, getting NTLDR to load Linux; if you dump Linux, easy to reverse.
    Moral Volcano: Multi-boot OSs.
    http://users.bigpond.net.au/hermanzone/p9.html
    “This webpage is to explain how I set up boot.ini in Windows and install WinGrub to boot either Windows via its own bootloader NTLDR or Linux via WinGrub, without touching the MBR.”
    Ed’s Software Guide on Linux:
    http://www.geocities.com/epark/linux...w2k-HOWTO.html
    Technique is clearly described in Chapter 4 of Linux in a Nutshell.
    Chapter 4 happens to be the freely downloadable sample chapter.
    (O'Reilly books, on-line, this Chapter was a free sample chapter--I don't know if that changed now.)

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    SECTION 1
    Introduction: What is GRUB?

    Two key components that make GRUB work (menu.lst & installation)

    GRUB is the bootloader/manager included with Kubuntu. GRUB: GRand Unified Bootloader. When you turn on your PC and see the boot menu, the menu comes from GRUB. Using GRUB is the key to dual booting/multi-booting. To work correctly, GRUB needs two things:
    (1) The boot menu, the file /boot/grub/menu.lst
    (2) A proper installation of GRUB to boot your Kubuntu/Linux
    If your PC doesn't boot into Kubuntu, fixing it may require either or both of these two steps:
    (1) Fixing the boot menu; and/or
    (2) In some cases, you may also have to re-install GRUB.

    Abbreviations
    -- HD or HDD: hard drive, hard disk drive
    -- MBR: Master Boot Record
    -- OS: operating system
    -- POST: Power On Self Test (the PC's BIOS screen/test)

    Notation: The # sign in menu.lst or used in a list of commands at Konsole
    The sign # indicates a comment line: the line is ignored by GRUB and by Konsole (BASH).
    # = Remark => Remember

    Notation: GRUB devices (hdx,y) Linux devices sdxn UUIDs

    -- GRUB device notation: (hdx,y)
    The first part, hdx refers to hard drive x, where the counting starts at zero. The first hard drive is (hd0), the second is (hd1), etc. Using the parentheses, the notation (hd0) also refers to the MBR of the first HD; (hd1) refers to the MBR of the second hard drive; etc.
    Partitions: (hdx,y) refers to hard drive x, partition y, and counting starts at zero. The first partition is partition 0 (zero); the second partition is partition 1; etc.
    Examples:
    (hd0,0) is the first hard drive, the first partition.
    (hd0,1) is the first hard drive, the second partition.
    (hd1,0) is the second hard drive, the first partition.
    (hd3,6) is the fourth hard drive, the seventh partition.

    -- Linux notation sdxn
    In Kubuntu, the first hard drive is sda, the second HD is sdb, etc. Partitions are numbered starting from 1. sda1 = the first hard drive, the first partition. sda2 = the first hard drive, the second partition. sdb1 = the second HD, the first partition. sdd7 = the fourth HD, the seventh partition.
    Older versions of Kubuntu: SATA hard drives were sdx; IDE HDs were hdx: hd1, hd2, etc.
    Newer versions of Kubuntu: All hard drives are sdx.

    -- UUID = Universally Unique Identifier
    Starting with Kubuntu version 8.10, UUIDs are used to identify partitions.
    A UUID is a 16-byte number (= 128 bits). In canonical form, a UUID consists of 32 hexidecimal digits, displayed in 5 groups separated by hyphens. You can find the UUIDs for your partitions by typing the command (in Konsole):
    blkid
    or the command
    ls /dev/disk/by-uuid/ -alh


    GETTING INFORMATION about your drives and devices

    >>> Very Important: fdisk, geometry, and Tab-completion
    Exploring your hard drive(s)
    At a terminal (Konsole)
    sudo fdisk -lu
    At a GRUB prompt,
    grub>geometry (hd0)
    grub>geometry (hd1)
    grub>geometry (hd2)
    etc.
    Tab-completion:
    grub>geometry (hd<Press the TAB key now>
    means to type geometry then a space then (hd then press the TAB key
    and when you do that, GRUB will give you a list of choices from the drives it detects on your system.

    Other useful commands to get information when you need to fix things
    --- Commands at Konsole
    Manual page for a command: man command
    Help: command --help
    Hard drives, drives, partitions, filesystems: sudo fdisk -lu
    Drive space: df -h -T
    UUIDs:
    From a live CD or HD: ls /dev/disk/by-uuid/ -alh
    From a HD: blkid
    Menu.lst, to see it: cat /boot/grub/menu.lst
    fstab (filesystem table), to see it: cat /etc/fstab
    Mounting, how filesystems are mounted: cat /etc/mtab or: mount
    Boot directory /boot, to find it: df /boot
    Kernel version and gcc version (gcc=the GNU compiler used to build the kernel):
    cat /proc/version
    Kernel version: uname -r
    Linux version/name: lsb_release -a
    (hold the Shift key and the minus sign key to get _ . LSB = Linux Standard Base)
    KDE version (KDE=K Desktop Environment)
    for KDE 3.5: kde-config –version and for KDE 4: kde4-config --version

    Opening a file manager as root:
    in 8.10: kdesudo konqueror (or dolphin)
    in 8.04: kdesu konqueror (dolphin)
    Opening a terminal as root:
    sudo –i (to get a “root” terminal)
    or:
    sudo su

    GRUB prompt
    >>> In an emergency, very important to know how to use the GRUB prompt.
    >>> To get a GRUB prompt, type at Konsole: sudo grub
    >>> To quit GRUB: grub>quit
    >>> To exit Konsole: exit
    >>> grub>help (tells you GRUB commands available)
    >>> or press the Tab key: grub> <press Tab key now>

    --- Commands at a GRUB prompt, grub>
    Hard drives:
    grub> geometry (hdx) (# x = 0,1,2 ...)
    grub> geometry (hd<Press the Tab key now> (do not type the < or >)

    GRUB files, what partitions they are in: grub>find /boot/grub/stage1

    Boot menu, what partition(s) it is in: grub>find /boot/grub/menu.lst
    Kernel, where it is: grub> find /vmlinuz
    Menu.lst, to see it: grub> cat (hdx,y)/boot/grub/menu.lst
    fstab, to see it: grub> cat (hdx,y)/etc/fstab
    Device.map, to see it: grub> cat (hdx,y)/boot/grub/device.map

    Restart (reboot), or shutdown (halt) your PC at a command line
    -- At Konsole:
    sudo shutdown -r now (re-boots the PC)
    sudo shutdown -h now (shuts down the PC)
    -- In GRUB:
    grub> reboot (re-boots the PC)
    grub> halt (shuts down the PC)


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 2
    Basic GRUB facts
    How GRUB works, MBR, GRUB files, image directory, “first BIOS boot drive”
    --- Installing GRUB, Stages, MBR, IPL, BIOS, /boot/grub/menu.lst

    A sector of a hard drive or flash drive is 512 bytes (one byte = 8 bits). Think of a byte as the space required to store a character--a number, a letter, or a symbol. The first sector, 512 bytes, of a hard drive is reserved for the Master Boot Record (MBR). The MBR is divided as follows: 446 bytes are used for the bootloader's Initial Program Loader (IPL), which is the basic “starter” code for the bootloader; then 64 bytes are set aside for the partition table (4 primary partitions, each getting 16 bytes); and finally a 2-byte signature code (hexadecimal 55 AA = end of MBR).

    When GRUB is installed, it installs its Stage_1 code into the MBR (into the 446 bytes for the IPL). It also installs its Stage_1.5 code in 16 sectors following the MBR but preceding the start of the first partition. Finally, Stage_2 of GRUB is located in the Kubuntu/Linux root partition, along with the GRUB boot menu, /boot/grub/menu.lst. In Kubuntu, you can see the GRUB files by opening (in Dolphin or Konqueror) /boot. There you can open the grub directory and you'll see the GRUB files. (The kernel and initrd files are located in the /boot directory.) The original GRUB files provided with you Kubuntu OS can be found in the “image” directory: /usr/lib/grub/i386-pc.

    BIOS is important. It is stored in the heart of your PC's motherboard and contains code required to start and run your PC. BIOS detects your hard drives, CD/DVD drive, flash drives, and other hardware. In BIOS Setup, you must indicate the order of drives you want BIOS to check when you start up the PC. The first drive you list we'll call the first BIOS boot drive. BIOS will check the drives, starting with the first BIOS boot drive until it finds a “bootable” drive to use to boot the PC. A bootable drive must be marked with a boot flag and must contain, in its MBR, some IPL bootloader code (e.g., GRUB's Stage_1 code).

    Booting your PC: When you turn on the PC, BIOS gets the IPL code from the MBR of the first BIOS boot drive, loads it into memory, and in turn the code starts the bootstrap process that loads the OS into memory, until finally, the OS has full control of the PC (and, thankfully, you may communicate with the OS to get it to do stuff for you).

    Set up BIOS boot drives
    Start you PC, enter BIOS setup, and set BIOS to boot FIRST from the CD drive; second from your first BIOS boot drive (the one you prefer to use for such).


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 3
    Re-installing GRUB
    --- Re-installing/installing GRUB

    SUMMARY—recipe:
    # (hdx,y) = the partition containing the GRUB files you wish to use.
    # (hdz) = the MBR you wish to install GRUB to.
    sudo grub
    grub>find /boot/grub/stage1
    grub>geometry (hd0)
    grub>geometry (hd1), etc.
    grub>root (hdx,y)
    grub>setup (hdz)
    grub>quit
    $exit


    Be prepared with the information you need
    You need to know two things:
    1 The Kubuntu partition from which you will install GRUB files.
    2 The MBR to which you will install GRUB.
    Thus, afterwards, the PC will boot from that MBR using GRUB files (and menu.lst) from that Kubuntu partition.

    > If you do not know what partition the GRUB files are in, you may use the GRUB command “find” to list the options in the form (hdx,y):
    grub>find /boot/grub/stage1
    If you then need more information about the drives, see SECTION 1, “ Getting information about drives...” Specifically, the geometry command is usually all you need:
    grub>geometry (hd0)
    grub>geometry (hd1)
    grub>geometry (hd2)
    etc., until you figure out which (hdx,y) to use.

    Installing/re-installing GRUB to the MBR of the first BIOS boot drive, (hd0)

    Let's suppose you wish to re-install GRUB to the MBR of the first BIOS boot drive, (hd0), using the GRUB files in your Kubuntu operating system, and assume Kubuntu is in partition (hdx,y).

    Case 1: Assume you are able to boot into a (any) Linux OS on your PC. (If you can't, see Case 2.)
    If so, do so. Open Konsole (or a terminal) get a GRUB prompt (grub>) as root by typing
    sudo grub
    grub>find /boot/grub/stage1
    # Optional: grub>geometry (hd0); grub>geometry (hd1); etc.
    # as needed to find (hdx,y), the partition containing the GRUB files you wish to use.
    grub>root (hdx,y)
    grub>setup (hd0)
    grub>quit
    $ exit

    Case 2: Assume you can't boot into any of your Linux OSs.
    First, you need to get a grub prompt (grub>) somehow. Your two choices are (1) use Super Grub Disk (see REFERENCES), or (2) use a Live Kubuntu CD (or any live Linux CD).

    (1) Use Super Grub Disk (SGD) to boot into your broken Kubuntu OS (or to get a GRUB prompt).
    In the OS, open Konsole (or a terminal) and proceed as in Case 1. Or, use SGD, and when you see a menu offering to give you a GRUB prompt, take it; or press the “c” key at a menu to get the GRUB prompt grub>, then proceed as in Case 1.
    (2) Use your Live Kubuntu CD. Put your Live CD in the CD tray, re-boot your PC, startup your Live Kubuntu session. Open Konsole (a terminal) and proceed exactly as in Case 1, starting with “sudo grub” to get a GRUB prompt.

    Installing/re-installing GRUB to a non-first BIOS drive (a HD, a flash drive, external drive)
    You may also use the exact same method to re-install/install GRUB to the MBR of a non-first BIOS drive, such as (hd1), (hd2), etc.:
    sudo grub
    grub>find /boot/grub/stage1
    # then, if necessary, use grub>geometry (hd1), grub>geometry (hd2); etc.
    grub>root (hdx,y)
    grub> setup (hd1) (or setup (hd2), etc.)
    grub>quit
    $exit
    # After doing this, you may then boot that drive using GRUB, using a chainload command
    # or by changing BIOS settings to boot from that drive.



    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 4
    Menu.lst
    Menu.lst, the boot menu: Editing, fixing /boot/grub/menu.lst
    Accessing, backup, timeout, default
    Understanding the AUTOMAGIC KERNELS LIST
    Where to put Windows in menu.lst
    Make Kubuntu your default operating system
    Changing the order of the operating systems in the boot menu

    SUMMARY--recipe:
    Access, as root, the boot menu, /boot/grub/menu.lst.
    Make a backup.
    Change the line(s)
    default 0
    timeout 10
    Or, make other edits to the menu.lst and boot stanaza entries.
    File > Save
    File > Quit

    menu.lst
    When you turn on your PC, you see the Power On Self Test (POST) from BIOS, then the boot menu. The boot menu comes from a GRUB configuration file called /boot/grub/menu.lst, which you may edit to suit your preferences. One of the operating systems on the boot menu is highlighted, and it is called the default operating system. If you don’t do anything, your PC will automatically boot into the default operating system in a number of seconds indicated by the timeout command.

    Backup: See below, How to make a backup of menu.lst before editing it.
    => CAUTION: Make a backup BEFORE doing any edits!

    How to access menu.lst, make a backup
    => If you already know how, skip below to: Editing menu.lst: default and timeout

    As root or not?
    You can access menu.lst using the command line interface (Konsole) or your file manager Konqueror/Dolphin. You can access menu.lst without using root, and you can even copy it and save it somewhere else without using root. However, if you intend to edit (modify or change) the menu.lst, you must use root to open menu.lst.

    Case 1: If you are able to boot into one of your Linux OSs to access the menu.lst.
    If so, do so. Open Konsole. Open Konqueor (Dolphin) as root:
    in 8.10: kdesudo konqueror (or dolphin)
    in 8.04: kdesu konqueror (dolphin)
    Then navigate to the /boot/grub directory (of the correct partition), open menu.lst, and when you finish your editing, File > Save, File > Quit. You can also copy text from one menu.lst to paste into another menu.lst, all from the same Konqueror session. If you can't do this because the partition you need is not automatically mounted (in your /etc/fstab file), then use a terminal to access, mount, open, and edit the menu.lst (exactly as in Case 2 below: “Live OS CD Method”).

    Another way, using Kate (text editor):
    Note: At Konsole, you can open menu.lst as root in the text editor Kate:
    in 8.10: kdesudo kate /boot/grub/menu.lst
    in 8.04: kdesu kate /boot/grub/menu.lst
    Make your edits, then File > Save, File > Quit.

    Opening a terminal as root:
    At Konsole,
    sudo –i (to get a “root” terminal)
    or:
    sudo su


    Case 2: Live OS CD method (or, use Super Grub Disk)
    Use this if you are not able to boot into any of your Linux OSs to access the menu.lst.
    >>> Use Super Grub Disk live CD to boot into Kubuntu, then proceed exactly as in Case 1 above.
    Or,
    >>> Live Kubuntu CD:
    Boot the Live Kubuntu CD, open Konsole, then as root make a directory, mount the filesystem containing the menu.lst you need to edit, open menu.lst as root, edit it, save, quit (GRUB), unmount the filesystem, exit.
    Example
    If the menu.lst you need is on sdb3 (=(hd1,2)), start a Live CD Kubuntu session, open Konsole:
    sudo fdisk -lu # to see/check your partitions, if necessary
    # make a directory called /media/sdb3:
    sudo mkdir /media/sdb3
    # mount device sdb3 on directory /media/sdb3:
    sudo mount /dev/sdb3 /media/sdb3
    # change to that directory:
    cd /media/sdb3
    Then, as in the above case, you may proceed in various ways:
    Open Konqueror/Dolphin as root, then open /boot/grub/menu.lst:
    in 8.10: kdesudo konqueror (or dolphin)
    in 8.04: kdesu konqueror (dolphin)
    Make your edits, then File > Save, File > Quit.
    Or, open menu.lst as root using Kate, then do the edits:
    in 8.10: kdesudo kate /boot/grub/menu.lst
    in 8.04: kdesu kate /boot/grub/menu.lst
    Make your edits, then File > Save, File > Quit
    # unmount the directory; note the spelling of umount:
    sudo umount /media/sdb3

    - - - - - - - - - -
    Backup menu.lst
    How to make a backup of menu.lst before editing it
    (and how to restore menu.lst if you make a mistake)
    At Konsole, make the backup to a file called menu.lst_backup_[Date]
    (If necessary, mount the partition first, as in Case 2 above)
    cp /boot/grub/menu.lst /boot/grub/menu.lst_backup_3-10-09
    To restore, reverse it:
    sudo cp/boot/grub/menu.lst_backup_3-10-09 /boot/grub/menu.lst
    (You need sudo to modify /boot/grub/menu.lst.)
    File > Save, File > Quit
    In Konqueror/Dolphin (opened as root using kdesudo or kdesu from Konsole):
    Navigate to /boot/grub, open menu.lst, File > Save As, name it menu.lst_backup_3-10-09, File > Quit.
    To restore, open: menu.lst_backup_3-10-09, then File > Save As, name it menu.lst, say Yes to overwrite, File > Quit.

    - - - - - - - - - -
    Editing menu.lst: default and timeout

    “title” lines
    Each operating system on the boot menu has its own boot stanza entry in the menu.lst, and it starts with the word “title.” The “title” lines are counted from top to bottom, starting with zero. So the first title line is at position 0, the second title line is at position 1, the third is at position 2, etc.
    NOTE: the following line toward the end of menu.lst counts as one “title” line!
    title Other operating systems:

    --- How to change the default operating system
    Access your /boot/grub/menu.lst (with root privileges, see above).
    It is good practice to make a backup copy of the menu.lst (see above).
    Locate the line that reads
    default [some integer number]
    Now simply change that number to the number that corresponds to the “title” position of the operating system you wish to be your default operating system.
    When you are done editing menu.lst, File > Save, File > Quit.
    Close all open windows, and re-boot to test it.
    Example:
    If the operating system you want to be the default corresponds to the 3rd title line, then edit the default line so it reads:
    default 2
    (counting is: 0, 1, 2 to get to the 3rd title line)

    --- How to change the timeout
    Access your /boot/grub/menu.lst (with root privileges, see above).
    It is good practice to make a backup copy of the menu.lst (see above).
    Locate the line that reads
    timeout [number of seconds]
    Change the number of seconds to suit your preference.
    When you are done editing menu.lst, File > Save, File > Quit.
    Close all open windows, and re-boot to test it.

    CAUTION: NEVER change it to zero. If you change it to zero, the PC will always boot into the default operating system, and you’ll never be able to boot into any of your other operating systems or interrupt the boot menu in an emergency (unless you access/edit your menu.lst to fix it).

    - - - - - - - - - -
    Understanding the AUTOMAGIC KERNELS LIST

    Look at your menu.lst. Notice the important section that starts with
    ### BEGIN AUTOMAGIC KERNELS LIST
    and ends with
    ### END DEBIAN AUTOMAGIC KERNELS LIST

    The kernel(s) for your main (Kubuntu) operating system are listed between the ### BEGIN and the ### END lines, each kernel having its own “title” line. For example, you might have four boot entries, each having its own title line, corresponding to Ubuntu, kernel 2.6.17-11-generic, Ubuntu, kernel 2.6.17-11-generic (recovery mode), Ubuntu, kernel 2.6.17-10-generic, and Ubuntu, kernel 2.6.17-10-generic (recovery mode).

    When you get another kernel update, it is added at the top of this list (between the ### BEGIN and ### END lines). So you can see how that would change the numbering of the title lines in your menu.lst.

    - - - - - - - - - -
    Where to put Windows in menu.lst

    Let’s say you are dual-booting with Windows, Kubuntu (and perhaps other Linux operating systems).
    And suppose you want Windows to be your default operating system. If you put it after the ### END line, then every time you get a Kubuntu kernel update, the position number of Windows “title” line will change, and thus the line “default [Windows sequence number]” will refer to the wrong operating system (it will no longer refer to Windows). To prevent this problem, put Windows where its position sequence will never change:
    Put it before the ### BEGIN line, in position zero, and set default=0.
    Example: The resulting menu.lst might then look something like the following:
    default 0
    timeout 10
    etc - etc
    title Microsoft Windows XP Home Edition
    root (hd0,0)
    chainloader +1
    ### BEGIN AUTOMAGIC KERNELS LIST
    ... all your Kubuntu kernels and their “title” lines and boot entries...
    ### END DEBIAN AUTOMAGIC KERNELS LIST
    # and then you might have other OS boot entries

    - - - - - - - - - -
    Make Kubuntu your default operating system
    Put the Windows boot entry anywhere following the ### END line. Then, using default=0, the latest Kubuntu kernel (ie, the first one listed after the ### BEGIN line) will always be highlighted as your default operating system when you boot your PC. In this case, there will be nothing between the line “# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST” and the ### BEGIN line.

    - - - - - - - - - -
    Changing the order of the operating systems in the boot menu
    Easy: Just open menu.lst (as root), make a backup, then do it using copy/paste, or drag/drop.
    Example: If you want to move the Windows boot entry, highlight everything from its title line to the line chainloader +1, then cut/paste or .drag/drop. Then File > Save, File > Quit.
    CAUTION: Don’t place anything between ### BEGIN and ### END except your main Kubuntu OS kernel entries.


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 5 Dual Booting

    Installing two or more Linux operating systems
    > Recommended method
    > Problems – messing up the booting; fixing GRUB without re-installing Kubuntu
    > This applies to using one or more hard drives
    > If your situation involves Windows, see SECTION 6 below: “Windows topics”

    An important, key fact:
    The GRUB from the last OS you install overwrites any existing GRUB you already have installed.
    =>
    When you have an existing Linux OS already installed, call it Linux1, and then install a second Linux OS, call it Linux2, the GRUB from Linux2 will overwrite the GRUB from Linux1 that is installed in the MBR of the first BIOS boot drive (hd0). If that happens, then the booting will be controlled not by the GRUB and boot menu from Linux1, but from the GRUB and boot menu (/boot/grub/menu.lst) of Linux2. Knowing this, you can decide how you want to control things. For example, you can ensure that the GRUB from Linux2 does NOT overwrite the GRUB from Linux1.

    Doing it in Kubuntu 7.10, 8.04, 8.10 using the Live Kubuntu CD installer --
    Telling the installer where to install GRUB
    You can use the Live Kubuntu CD installer to install GRUB anywhere you wish. Here's how:
    Start the installer, in Step 4, select the Manual partitioning method (the last choice listed).
    In Step 5, indicate how you want the partitions set up: at least one for the root filesystem (/) and one for swap, and (optionally) one for a separate /home partition.
    In Step 6, click the Advanced button at lower right. There you may tell the installer where to install GRUB. The default is (hd0), which means the MBR of the first BIOS boot drive. If you do not want that to happen, then have the installer install GRUB to the same partition as your root Kubuntu filesystem or to the MBR of another drive, say (hd1) or (hd2).
    To install GRUB to the Kubuntu root partition, type (hdx,y), where (hdx,y) is GRUB notation for the Kubuntu root partition. See the section above, “GRUB device notation: (hdx,y).”
    >>> Other distros may have their own facilities for installing GRUB.


    RECOMMENDED METHOD
    Recommended method: Setting up a dual boot between two Linux OSs
    I will outline one (of many) methods for setting up a dual boot between two Linux OSs, call them Linux1 and Linux2. To demonstrate Kubuntu methods, we will assume that Linux1 and Linux2 are both versions of Kubuntu; but, in general, Linux1 & Linux2 may be ANY Linux OSs (i.e., any Linux OSs having a Live CD installer and some facility for specifying the GRUB installation).

    Set up BIOS boot drives
    Start you PC, enter BIOS setup, and set BIOS to boot FIRST from the CD drive; second from your first BIOS boot drive (the one you prefer to use for such).

    Step 1 Partitioning your hard drive(s) for both OSs
    Decide how to partition your hard drive(s) for the two OSs.
    Partitioning—how to, Rog131:
    http://kubuntuforums.net/forums/inde...opic=3090704.0

    Then do the partitioning using GParted Live CD (a very handy tool):
    http://gparted.sourceforge.net/livecd.php
    Or ...
    You can do it using the Live Kubuntu CD: Run the CD as a Live CD (without installing anything yet).
    Check whether gparted is already available: K > System > Partition Editor (if so, open it).
    If not, install it in your live session using K > System > Adept Package Manager (search gparted, then click Request Install, then Apply), then open it and use it K > System > Partition Editor.

    Step 2 Explore your hard drive(s)
    Before running the installer, but while in a Live Kubuntu CD session, explore your hard drives to determine how GRUB sees the partitions you set up in Step 1.
    Open Konsole. The command
    sudo fdisk -lu
    shows your partitions in Linux notation (sda1, sda2, sdb1, etc.). Write down the key partitions that you will use for root, home, swap.
    Get a GRUB prompt:
    sudo grub
    Then explore each hard drive using the geometry command:
    grub>geometry (hd0)
    grub>geometry (hd1)
    etc.
    Write down the key partitions, (hdx,y)'s, that you will use for root, home, swap.

    => Identify in both Linux notation and GRUB notation where everything goes--the Kubuntu root filesystem (/), swap, (and /home, if you wish to have a separate partition for /home).
    Swap: You only need to reserve one partition for swap, even if you have more than one Linux OS.

    Step 3 Run the Kubuntu installer to install the first OS
    Install Linux1--its root filesystem, swap, and /home (if you use a separate /home).
    Let the installer put GRUB in (hd0) – that is usually the default location.
    Thus, your PC will boot from hd0 using GRUB from Linux1 installed to the MBR and the boot menu (/boot/grub/menu.lst) from Linux1.

    Step 4 Run the Kubuntu installer to install the second OS
    ... and Install GRUB carefully.
    Install Linux2--its root filesystem, swap, and /home (if you use a separate /home).
    But be careful where you install GRUB.
    > If you want the GRUB (and boot menu) from Linux1 to continue to control the booting, then * be careful * to NOT install GRUB to (hd0). Instead, install GRUB to the root partition of Linux2; or, to the MBR of some other drive, like (hd1) or (hd2)--assuming you feel it is safe to do so. (E.g., don't do it to (hd2) if hd2 is an external drive that already has its own bootloader set up in its MBR! That is, use common sense here).
    > If you want GRUB (and the boot menu) from Linux2 to control the booting, then install GRUB to (hd0); in that case, the GRUB from Linux2 will overwrite GRUB from Linux1 in the MBR.

    Step 5 Configure GRUB
    > If the Linux1 GRUB is to control the booting (and so you did NOT have the Linux2 installer put GRUB in (hd0)), then you must edit the boot menu (/boot/grub/menu.lst) in Linux1 to include a boot stanza entry for Linux2. How to: See the Technical Note that follows (below).
    > If the Linux2 GRUB is to control the booting (and so you DID have the Linux2 installer put GRUB in (hd0)), then you should not have to do any further configuring of GRUB--the new Linux2 boot menu (/boot/grub/menu.lst in Linux2) should already have an entry in it for booting Linux1. If not, see PROBLEMS--fixing GRUB (below)

    In the first case, where Linux1 GRUB controls the booting --
    TECHNICAL NOTE:
    Configuring /boot/grub/menu.lst (in Linux1) to include an entry for Linux2
    Three methods:
    1 Copy the Linux2 boot entry into the menu.lst in Linux1
    Copy the boot entry for Linux2 FROM the Linux2 /boot/grub/menu.lst TO the Linux1 /boot/grub/menu.lst.

    If you're new to this, there's a few details:
    You will boot into Linux1 to access the Linux2 partition, then do the copying (using Konqueror or Dolphin). You must edit menu.lst as root (in order to make any changes to it).
    To open Konqueror (or Dolphin) as root, in 8.10 or after, type into Konsole the command kdesudo konqueror (or kdesudo dolphin); in 8.04 or before, use instead kdesu konqueror (or kdesu dolphin). If necessary, you may open two copies of Konqueror (or Dolphin).
    You will copy two boot entries for Linux2, the regular one and the one labeled “(recovery mode)” in its “title” line. And for each, you will copy four lines: title, root, kernel, and initrd.
    You must put the Linux2 boot entries into the Linux1 boot menu (/boot/grub/menu.lst) in one of two places: either before the line “### BEGIN AUTOMAGIC KERNELS LIST” or after the line “### END AUTOMAGIC KERNELS LIST.” Do NOT place any boot entries between those two lines. Recommended: Put them after the ### END statement.
    If for some wild reason, you need to do any menu.lst editing from a Live Kubuntu CD, see SECTION 4, How to access menu.lst, Case 2: Live CD method.

    2 Configfile
    See the SECTION 8 on using configfile.
    To illustrate, suppose Linux2 is installed to (hd0,1). Boot into Linux1, open Konqueror (or Dolphin) as root (in 8.10: kdesudo konqueror or dolphin; or in 8.04: kdesu konqueror or dolphin), after the line ### END AUTOMAGIC KERNELS LIST, type this boot entry for Linux2:
    title Linux2 OS in partition (hd0,1)
    configfile (hd0,1)/boot/grub/menu.lst

    3 Chainload
    Same procedure as configfile (above), except the boot entry for Linux2 in the Linux1 menu.lst is:
    title Linux2 OS on partition (hd0,1)
    chainloader (hd0,1)+1

    NOTE: This chainloader will only work if you had the Linux2 installer put GRUB into the Linux2 root partition. You may do that at any time--see the SECTION 8 on chainloading and Section 3 reinstalling GRUB (application: install GRUB from the Linux2 partition to the Linux2 partition: root (hdx,y), then setup (hdx,y), then quit).


    - - - - - - - - - -
    PROBLEMS
    Messing up the booting -- fixing GRUB without re-installing Kubuntu

    If you make a mistake with GRUB while installing the OSs, you can fix it without re-installing the OS.
    See SECTION 3 Re-installing GRUB.

    Example: Re-setting Linux1 to control the booting
    Suppose in setting up the dual boot with Linux1 and Linux2 that you mistakenly overwrote the MBR with the GRUB from Linux2. To restore the Linux1 GRUB to the MBR of hd0 (the first BIOS boot drive), simply re-install GRUB (as in SECTION 3). Then, as above, edit /boot/grub/menu.lst in Linux1 to include a boot entry for Linux2. Let's assume Linux1 is in partition (hdx,y) (for some specific x and y). Then re-install GRUB to the MBR of hd0 using the GRUB in Linux1 as follows:
    From any Linux OS (on your drive(s)) or from a Live Linux CD, at Konsole (a terminal)
    sudo grub
    grub>root (hdx,y)
    grub>setup (hd0)
    grub>quit
    $exit

    Example: Re-setting Linux2 to control the booting
    Or, if you wanted the GRUB from Linux2 (and its /boot/grub/menu.lst) to control the booting, but you did not have its GRUB installed to the MBR of the first BIOS boot drive, (hd0), then reinstall GRUB from Linux2 (to the MBR (hd0)) and edit the Linux2 menu.lst to include a boot entry for Linux1.
    If Linux2 is in the partition (hdx,y), then open Konsole
    grub>sudo grub
    grub>root (hdx,y)
    grub>setup (hd0)
    grub>quit
    $exit
    Then access (as root) the boot menu in Linux2 (/boot/grub/menu.lst) and include a boot entry for Linux1—Do that exactly as explained above under TECHNICAL NOTE: Configuring /boot/grub/menu.lst


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 6
    Windows topics
    --- Vista, dual-booting with XP and/or Kubuntu/Linux. When Vista in involved,
    see this definitive guide:
    http://apcmag.com/dualboot
    --- XP
    Installing XP & Kubuntu: How to set up dual booting
    Re-installed XP and now can't boot Kubuntu
    When XP is on a non-first hard drive
    --- Special Situations
    How to avoid installing GRUB to the MBR of your Windows XP drive
    Two drives, a Windows drive and a Kubuntu drive, GRUB is in the Windows MBR,
    but sometimes you must remove the Kubuntu drive
    and Windows won’t boot when you do.

    - - - - - - - - - -
    XP

    Installing XP & Kubuntu: How to set up dual booting (recommended outline)

    1 Install XP first, and install it to the first partition of your hard drive.
    2 Decide how you want to partition for Kubuntu:
    Partitioning—how to, Rog131:
    http://kubuntuforums.net/forums/inde...opic=3090704.0
    3 Prepare the partitions for Kubuntu using GParted.
    You may do this using Use GParted Live CD from here:
    GParted: http://gparted.sourceforge.net/
    Or, do it using gparted from the Live Kubuntu CD. (Here's how: in your live Kubuntu session, install gparted using K > System > Adept Package Manager; open it here: K > System > Partition Editor.)
    You will (probably) first have to shrink the XP partition (using GParted) before creating new partitions for Kubuntu; or, prior to installing XP, you can use GParted to partition the entire hard drive for both XP and Kubuntu.
    4 Install Kubuntu
    The Kubuntu installer will install GRUB to the MBR of the HD, and thus it overwrite the XP bootloader that XP installed in the MBR of that HD. If you do not want that to happen, you will have to use XP's bootloader to load Linux—See REFERENCES: Boot Linux from Windows
    5 When you re-boot your PC, you will see the GRUB boot menu offering you the choice to boot into either XP or Kubuntu.

    Re-installed XP and now can't boot Kubuntu
    Suppose you had a dual boot set up with XP and Kubuntu, but then you re-installed XP, XP's bootloader overwrote GRUB in the MBR, and now you can't boot into Kubuntu. To fix this, simply re-install GRUB (using the GRUB files in Kubuntu) to the MBR of the first BIOS boot drive (hd0). See SECTION 3 (Reinstalling GRUB) above; it goes as follows:
    From a Live Kubuntu CD session, open Konsole,
    sudo grub
    grub>find /boot/grub/stage1
    That returns the Kubuntu partition (hdx,y); put it here:
    grub>root (hdx,y)
    grub>setup (hd0)
    grub>quit
    $exit
    (re-boot to test it)

    XP on a non-first hard drive: (hdx,y), x > 1
    Suppose Kubuntu is on your first BIOS boot drive hd0, and GRUB (from Kubuntu) is installed to the MBR (hd0); thus, your PC boots from hd0 using GRUB.

    Later, you wish to install Windows on a second hard drive, (hd1), and you wish to set things up so GRUB controls the booting through its boot menu.
    Example
    To give a specific example, let’s say Windows XP goes into (hd1, 0) (the first partition of your second hard drive). (This method also works when Windows is on any non-first hard drive, (hdx,y), where x > 1.)
    To boot XP from your boot menu, edit /boot/grub/menu.lst (in Kubuntu) to include the following boot entry for XP:
    title Microsoft Windows XP
    map (hd0) (hd1) # Map hd1 to hd0
    map (hd1) (hd0)
    rootnoverify (hd1,0) # rootnoverify ensures no attempt is made to mount Windows
    chainloader +1
    (To edit menu.lst as root, see SECTION 4.) Place XP after the statement ### END AUTOMAGIC KERNELS LIST (See SECTION 4, Where to put Windows in menu.lst)
    Comments:
    XP likes to be on the first BIOS boot drive, hd0. To fix this, you can perform a virtual switch of hard drives using the GRUB map command in the boot menu (/boot/grub/menu.lst). (No physical change is made to the hard drives or to the operating systems.) I’ve never figured out why the second map statement is needed; I have often commented it out and things still work, like:
    # map (hd1) (hd0)
    There must be some subtle reason for it, or maybe there are certain applications where it’s needed.
    The first statement, map (hd0) (hd1), says, “map hard drive 1 to hard drive 0,” so, intuitively speaking, when GRUB sees (hd1) it will instead be fooled to read that as (hd0) (even though we haven’t physically touched either hard drive). That’s why the trick works: The statement rootnoverify (hd1, 0) “seems” to read as (hd0, 0), it is passed to XP, and XP is tricked to see itself on hd0 and then boots up. (Gosh, please don’t quote me on that non-technical mumbo-jumbo, but I think you get the idea.)

    GRUB manual, GNU GRUB Manual 0.97 at:
    http://www.gnu.org/software/grub/manual/
    See Section 4.2.6 DOS/Windows.

    If Windows is on (hdx, y), where x > 1, make the adjustments accordingly:
    title Microsoft Windows XP
    map (hd0) (hdx)
    map (hdx) (hd0)
    rootnoverify (hdx,0)
    chainloader +1

    - - - - - - - - - -
    Special Situations
    How to avoid installing GRUB to the MBR of your Windows XP drive

    Situation: You don’t want to mess up the MBR of the Windows drive.
    => Windows XP is on your hard drive that boots first (as set up in BIOS),
    Windows boots using its own bootloader (installed to the MBR of that hard drive),
    you wish to install Kubuntu to the same hard drive or to another hard drive,
    but you do not want GRUB installed to the MBR of the Windows drive
    (i.e., you do not want GRUB to overwrite and destroy your XP bootloader).

    Two types of solutions are:
    --- Boot Kubuntu using GRUB -- That’s what this post is about.
    --- Boot Kubuntu from the Windows bootloader -- See the References, or use Google.

    -- Solution #1: Put GRUB on a flash drive.
    Put GRUB on a bootable flash drive and use it to boot up Kubuntu when you wish to do so. This applies no matter where you installed Kubuntu (to any drive, internal or external). You can also boot Windows from the flash drive along with any other distros you may have. Or, when you want to boot Windows, unplug the flash drive before booting/re-booting, then let your PC boot normally from the Windows drive.
    => See the reference How To Make GRUB Thumb Drive.

    -- Solution #2: Use Super Grub Disk
    Put Super Grub Disk on a CD or on flash drive. It will boot Kubuntu, Windows, and other distros you may have. See References.

    -- Solution #3: Put Kubuntu on a second internal hard drive or an external USB hard drive.
    Have the installer put GRUB in the MBR of the Kubuntu drive. Keep the Windows drive as the first boot drive in BIOS. But each time you want to boot Kubuntu, when you re-boot the PC, enter BIOS setup and manually force it to boot from the Kubuntu drive.

    -- Solution #4: Put Kubuntu on a second internal hard drive or an external USB hard drive AND set BIOS to boot from the Kubuntu drive.
    Have the installer put GRUB in the MBR of the Kubuntu drive. Change BIOS so it boots first from the Kubuntu drive. Edit the GRUB boot menu on the Kubuntu drive (/boot/grub/menu.lst) to include an entry for Windows (which will now be on a non-first hard drive). Thus, when you boot your PC, it boots from the Kubuntu drive, from which you can boot either Kubuntu or Windows.
    See the above subsection: XP on a non-first hard drive: (hdx,y), x > 1.

    -- Solution #5: Put Kubuntu on an external USB hard drive and hope your BIOS boots from it when it is connected.
    Similar to Solution #3, but assumes your BIOS supports it and assumes you are lucky. Install GRUB to the MBR of the external drive. In BIOS, enable “boot from USB” (this assumes your BIOS supports this capability), and include your external drive in the hard drive list in BIOS. When the external USB drive is connected and powered On, turn on the PC, and hope it boots to the external drive. When the external drive is not connected to the PC, your PC boots from the Windows drive. My BIOS does support this solution. (Intel D915GAVL), although sometimes I must re-boot, or enter BIOS and reset BIOS.


    Special Situations
    Two drives, a Windows drive and a Kubuntu drive, GRUB is in the Windows MBR,
    but sometimes you must remove the Kubuntu drive
    and Windows won’t boot when you do.


    Solution: Include a dedicated GRUB partition on the Windows drive.

    Assume Windows is on the first drive, BIOS is set to boot from the Windows drive, Kubuntu is on a second drive, GRUB from your Kubuntu is used as the bootloader and is installed to the MBR of the Windows drive, and so it boots both Windows and Kubuntu, but sometimes you need to remove the second drive from your PC. How to boot Windows then?

    If you remove the Kubuntu drive, you will get an error or a freeze because GRUB can’t find its boot menu, /boot/grub/menu.lst (its “Stage_2” files). A simple solution for this is to build a separate, small, dedicated GRUB partition on the Windows drive, and boot both Windows and Kubuntu from that partition. You need only 200 KB to hold the GRUB files (so, in practice, make it 1MB or the minimum allowed by FAT32 or ext2 format). If your Windows XP operating system takes up the whole drive, you must first shrink that partition to make room for the dedicated GRUB partition. You can use GParted to do that; however, you really should make a backup of your Windows partition, or at least your data there (My Documents, or Documents and Settings), and make sure your Windows distribution CD is available in case you mess up and have to re-install Windows.
    Reference: See SECTION 9 Separate, dedicated GRUB partition.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    #2
    Re: HOW TO: GRUB Methods - Toolkit

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 7
    Getting a copy of GRUB files

    If you ever need a copy of GRUB files, you have four choices where to get them:
    (1) The GRUB image files in the Kubuntu directory /usr/lib/grub/i386-pc
    (2) Your regular Kubuntu operating system /boot/grub directory
    (3) A Live CD that has them (like Super Grub Disk)
    (4) A downloaded iso file (without burning a CD)

    For each choice, you may do the work in graphical user interface--GUI (Konqueror/Dolphin) or command line interface--CLI (Konsole). You may copy the GRUB files without root privileges.

    For example, in Kubuntu 8.04, the image files are these nine GRUB files for stages 1, 2, and 1.5, and for various filesystems:
    stage1, stage2, e2fs_stage1_5, fat_stage1_5, stage2_eltorrito, jfs_stage1_5, minix_stage1_5, reiserfs_stage1_5, xfs_stage1_5.

    GUI
    If you need to work as root, you may open a file manager as root a follows:
    in 8.10
    kdesudo konqueror
    kdesudo dolphin
    in 8.04
    kdesu konqueror
    kdesu dolphin
    Hidden files: There are no hidden files in a GRUB directory. However, if you are working in GUI, in many situations, you may want to enable “View > Show hidden files” (in Konqueror/Dolphin) before copying files; otherwise, you will not get the hidden files.

    The /boot directory: Usually, to use GRUB files in booting, you must place the grub subdirectory (containing the GRUB files) under a boot directory, so the end result is /boot/grub.

    CLI – notes, tips

    cp -r /boot/grub directory1/boot
    This copies the grub directory (under /boot) and its contents (the GRUB files) to directory1/boot as a subdirectory--it builds a new subdirectory of directory1 called grub; the end result is directory1/boot/grub, which contains all the GRUB files. This assumes you already created the boot subdirectory of directory1. The grub subdirectory of directory1/boot will be created by the command.

    cp -r /boot/grub/* directory1/boot/grub
    This copies the GRUB files contained in the directory /boot/grub into the directory you have already built and named directory1/boot/grub; the end result is directory1/boot/grub, which contains all the GRUB files.

    Using root, sudo: depending on the task, you may need to work as root by prefixing cp with sudo:
    sudo cp -r

    mkdir: To make a new directory, use the command mkdir or sudo mkdir.

    Super Grub Disk
    You may get GRUB files from a Live CD that has them. Super Grub Disk is an example.
    Let's assume you use a SGD live CD. Put the SGD CD in the CD tray, wait for Kubuntu to recognize it, then Open it. The GRUB files are at /boot/grub on the CD. Assume the CD is mounted as /media/cdrom0 (check this in your file manager).
    CLI:
    sudo cp -r /media/cdrom0/boot/grub directory1/boot
    will result in directory1/boot/grub.

    Downloaded iso file (without burning a CD)
    Example
    Super Grub Disk download
    The CD ROM 0.9774 from here:
    http://forjamari.linex.org/frs/?group_id=61
    We download super_grub_disk_0.9774.iso to the Desktop folder, then mount it as follows:
    sudo mkdir /media/SGDfiles
    sudo mount -t iso9660 -o loop /home/your_name/Desktop/super_grub_disk_0.9774.iso /media/SGDfiles
    cd /media/SGDfiles
    ls
    and you will see a boot directory;
    cd boot
    and you will see a grub directory
    cd grub
    ls
    and you will see the grub files. To copy them into a /boot/grub subdirectory of directory1:
    cp -r /media/SGDfiles/boot/grub directory1/boot
    That will build directory1/boot/grub.


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 8 Boot Methods: Rescue booting or by menu.lst
    GRUB booting methods
    --- Configfile
    --- Chainloading
    --- Booting directly
    --- Boot into Kubuntu using the edit function “e” on a broken boot menu

    --- Configfile
    You can use configfile to boot into an OS at the GRUB command line or in /boot/grub/menu.lst.

    Command line -- configfile
    Find the Kubuntu partition containing a workable menu.lst
    grub>find /boot/grub/menu.lst
    From the results, select the partition (hdx,y) you wish to boot into. Put that here:
    grub>configfile (hdx,y)/boot/grub/menu.lst
    You will then be given the menu.lst from (hdx,y), from which you may choose an entry to boot into.

    Menu.lst -- configfile
    To boot into an OS which has a menu.lst on the partition (hdx,y) using configile, include the following boot stanza entry in your menu.lst:

    title My OS on partition (hdx,y) booted by configfile
    configfile (hdx,y)/boot/grub/menu.lst


    --- Chainloading
    You can use chainloader to boot into an OS at the GRUB command line or in /boot/grub/menu.lst.

    Fact:
    Chainloading: If you are going to chainload an OS, you must first install GRUB to that OS’s root partition. It does no harm to do this even if you also install GRUB elsewhere.

    Booting your Kubuntu OS by chainloading at the grub> prompt
    First, find the GRUB files:
    grub>find /boot/grub/stage1
    Suppose that returns (hdx,y), which you know to be your Kubuntu root partition. Use that here to install GRUB to the root partition of your Kubuntu OS:
    grub>root (hdx,y)
    grub>setup (hdx,y)
    Then boot Kubuntu using chainloader:
    grub>chainloader (hdx,y)+1
    grub>boot
    and you'll get from Kubuntu the boot menu /boot/grub/menu.lst.

    Booting a hard drive (MBR) by chainloading at the grub> prompt
    Let's say you wish to boot your hard drive hd1 (as an example).
    First, find the GRUB files you wish to install to the MBR of hd1, install them there, then boot hd1 by chainloading:
    grub>find /boot/grub/stage1
    Suppose that returns (hdx,y), which you know to be your Kubuntu root partition. Use that here to install GRUB to the MBR of hd1:
    grub>root (hdx,y)
    grub>setup (hd1)
    Then boot hd1 using chainloading:
    grub>chainloader (hd1)+1
    grub>boot
    and you'll get from Kubuntu the boot menu /boot/grub/menu.lst.

    Booting using the boot menu in Kubuntu, /boot/grub/menu.lst
    Same thing, but you do not need the boot command:
    title My OS on (hdx,y) booted by chainloading
    chainloader (hdx,y)+1

    title Hard Drive hd1 booted by chainloading
    chainloader (hd1)+1

    => Both these menu.lst examples assumes GRUB has been installed to (hdx,y) or to (hd1) using the GRUB files from the Kubuntu partition (hdx,y).


    --- Booting directly: using specific kernel & initrd statements
    Use the specific kernel-initrd commands (as in a full menu.lst), ending with the boot command.
    To get the kernel and initrd statements, try to access the menu.lst on the Kubuntu partition you wish to boot:
    grub>find /boot/grub/menu.lst
    That returns the partition (hdx,y) you are looking for. Use it here:
    grub>root (hdx,y)
    grub>cat /boot/grub/menu.lst
    Write down the kernel & initrd statements you need to use next:
    (as an example ...)
    grub>kernel /boot/vmlinuz-2.6.24-23-generic root=UUID=4f8ed8da-e015-4149-954c-a353db1b284b ro quiet splash
    grub>initrd /boot/initrd.img-2.6.24-23-generic
    grub>boot

    In an emergency, if you having problems and don't know the UUIDs of the root partition of Kubuntu, try using Linux device notation. For example, if Kubuntu is on (hd1,1) = sdb2, try this:
    grub>kernel /boot/vmlinuz-2.6.24-23-generic root=sdb2 ro quiet splash
    grub>initrd /boot/initrd.img-2.6.24-23-generic
    grub>boot

    Tab-completion in GRUB commands
    Direct kernel booting at the GRUB prompt, grub>

    First, find the partition (hdx,y) where you think your Kubuntu root files and kernel are. Use the methods discussed above to do that (geometry, or find /boot/grub/stage1, or find /boot/grub/menu.lst).
    Example: Suppose you want to boot Kubuntu on (hd1,4) = sdb5. Use Tab-completion to try to get the kernel booted directly. In the Tab-completion below, do NOT type the symbol < or >.

    grub> root (hd1,4)
    then, you need a kernel:
    grub> kernel /<Press Tab key>
    That gives you some choices, from which you remember that the kernel is in /boot, so choose boot (and type boot):
    grub> kernel /boot<Press Tab key>
    You'll get a slash /
    grub> kernel /boot/<Press Tab key>
    and you get a list of choices, from which you remember that a Kubuntu kernel is called vmlinuz, so, again, type:
    grub> kernel /boot/vmlinuz<Press Tab key>
    and you get more choices. Keep playing with this until you get a full kernel, such as:
    grub> kernel /boot/vmlinuz-2.6.20-16-generic
    but before you press Enter you must pass the root device to the kernel. (hd1,4) is the same as sdb5, and don't forget to name it as a device:
    grub> kernel /boot/vmlinuz-2.6.20-16-generic root=/dev/sdb5
    Do the same thing to get the initrd file:
    grub> initrd /boot/initrd.img-2.6.20-16-generic
    Then, finally,
    grub> boot
    and off you go! You'll boot into that operating system using that kernel & initrd.
    With Tab-completion, you keep trying, little-by-little, until you get where you want to be.

    --- Boot into Kubuntu using the edit function “e” on a broken boot menu

    You see a boot menu, but it doesn't work.

    So, re-boot, get the boot menu again, and this time you can try to edit the boot menu to see if something will work. These edits are temporary!!! To make them permanent, you must access/edit menu.lst as root and make permanent changes (with File > Save, File > Quit). (See SECTION 4, menu.lst)

    Example
    Suppose you select "Kubuntu on sdb5" from the boot menu, and you know Kubuntu is there and you know that sdb5 = (hd1,4). But, you get an error, perhaps Error 15 File Not Found. Re-boot to get the boot menu again. On the boot menu, Highlight "Kubuntu on sdb5." Press "e" key to edit. Ha! There you see a line
    root (hd1,3)
    which you know should be
    root (hd1,4).
    Highlight root (hd1,3), press "e" key to edit, change it using arrow keys, backspace, delete, etc., press Enter to accept the final version, then press "b" to boot, and if you are right, it'll boot into Kubuntu on sdb5.

    General procedure
    Re-boot to get the boot menu.
    Highlight the operating system your wish to boot.
    Press “e” to edit its boot stanza entry in menu.lst.
    Highlight the line (in menu.lst) you wish to edit.
    Press “e” to edit that line.
    After completing your edit, press Enter to accept the edit.
    Then press “b” to boot. Or ...
    If you need more information, press “c” to get a GRUB prompt
    grub>
    and use geometry, find, cat, etc. to gather more information about your drives, partitions, files.
    (See SECTION 1: Getting information about drives, GRUB files, menu.lst, fstab, UUIDs, version #'s
    IMPORTANT: Exploring your hard drive(s) -- fdisk, geometry, Tab-completion.)
    Then,
    at any time,
    press the ESC key on your keyboard to return to the boot menu.
    Highlight and edit (“e”) some more.
    When done, “b” to boot (or, again, “c” to go back to a GRUB prompt, grub>, then ESC to come back to the boot menu).

    The full instructions are listed at the bottom of the boot menu. They are easy to follow. You can't harm anything by trying. Worst case, you'll have to re-boot by pressing the Re-set button on your PC. You can also, at any time, type reboot at a grub prompt to reboot:

    grub> reboot
    or
    grub> halt
    to turn the PC off.


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 9 Separate GRUB Partition
    Making and using a separate GRUB partition

    A separate GRUB partition contains only one item: /boot/grub and the GRUB files (contained under the grub directory). The partition does not contain any other boot files under /boot; the kernel and initrd files are not present. (A full /boot partition contains the kernel(s) and initrd files. That is a different subject and is not covered here. Basically, it is the same, except you must maintain the up-to-date kernel list correctly and edit your groot= (hdx,y) statement in menu.lst)

    Advantages/uses of a separate GRUB partition:
    -- If you install a lot of OSs, it is easy to manage the multi-booting and boot menu using a separate GRUB partition.
    -- If you change the OSs on your partitions, it is easy to modify the boot menu if you use a separate GRUB partition (if you use configfile booting, you don't have to change anything).
    -- In the separate GRUB partition, you do not have to use specific kernel and initrd statements; nor do you have to use UUIDs (which is nice in case you repartition your hard drive(s), and thus there is no need to edit your main boot menu.

    Four steps: To build a separate GRUB partition and make your PC boot from it.
    Step 1: Use a partition editor to make a small partition (1 MB is plenty; FAT32) that will become the GRUB partition.
    Step 1: Make a /boot directory in the GRUB partition, and copy GRUB files into it so you have /boot/grub.
    Step 2: Using those GRUB files, install GRUB to the Master Boot Record of the first BIOS boot drive.
    Step 3: Edit the boot menu (/boot/grub/menu.lst) of the GRUB partition to suit your needs.

    Example
    Two SATA HDs, sda and sdb. Windows XP in sda1 = (hd0,0); Kubuntu 8.04 in (hd1,1); Kubuntu 8.10 in (hd1,2). The first BIOS boot drive is hd0, from which the PC boots. The GRUB that controls the booting is the GRUB in Kubuntu 8.04 (which is also the controlling boot menu, /boot/grub/menu.lst) (and so GRUB from (hd1,1) was installed to the MBR (hd0)).
    To do: Make a separate GRUB partition in sdb1 = (hd1,0) to control the booting.
    Note: In setting all this up, GParted Live CD (see REFERENCES) was used to do the partitioning, formatting, and then all OSs were installed as indicated.

    Outline/tips

    The partitioning is already done. The separate GRUB partition was created as sdb1 = (hd1,0), formatted FAT32 (or ext2 or ext3).
    Boot into Kubuntu 8.04. (This can also be done from Kubuntu 8.10 or from a Live Kubuntu CD).
    You can do this work in GUI (Konqueror or Dolphin) or CLI (Konsole, or a console).
    If you do it in Konsole, you may wish to open your file manager as root:
    in 8.10:
    kdesudo konqueror
    kdesudo dolphin
    in 8.04:
    kdesu konqueror
    kdesu dolphin

    While in Kubuntu 8.04, access the GRUB partition (hd1,0) (or sdb1). Make a directory called boot.
    (In GUI: right-click, Create New > Folder, name it boot; in CLI: sudo mkdir /boot).

    Copy grub and GRUB files into the GRUB /boot directory:
    Again, from Kubuntu 8.04, copy the grub directory and its contents into the /boot directory of the GRUB partition (hd1,0) (or sdb1). The result in the GRUB partition is /boot/grub (with all the GRUB files under grub).

    Set up GRUB:
    Open Konsole, and install GRUB to the MBR of the first BIOS boot drive (hd0) using the GRUB files in your GRUB partition:
    Konsole
    sudo grub
    grub>root (hd1,0)
    grub>setup (hd0)
    grub>quit
    $exit

    Edit menu.lst in the GRUB partition:
    Edit the menu.lst in the GRUB partition (hd1,0) (or sdb1) to include boot entries for XP and the Kubuntu OSs.
    You may open the menu.lst (in sdb1), as root, and delete everything (if you so wish). Then type the following:

    # menu.lst for separate GRUB partition.
    Default 0
    timeout 10

    title Windows XP in (hd0,0)
    chainloader (hd0,0)+1

    title Kubuntu 8.04 in (hd1,1)
    configfile (hd1,1)/boot/grub/menu.lst

    title Kubuntu 8.10 in (hd1,2)
    configfile (hd1,2)/boot/grub/menu.lst

    # End of menu.lst for the GRUB partition

    That's it – Your are done
    Re-boot to test it.


    CLI: Konsole details
    Here's the details at Konsole. The lines starting with # are comments.

    # First, use GParted to make and format a new partition, sdb1= (hd1,0).
    # Starting in the “main” Kubuntu in sdb2, at Konsole, proceed with:
    # make a new directory for mounting sdb1
    sudo mkdir /media/sdb1
    # mount partition sdb1 on /media/sdb1
    sudo mount /dev/sdb1 /media/sdb1
    # make a /boot subdirectory in sdb1
    sudo mkdir /media/sdb1/boot
    # The next statement automatically makes a /grub sub-directory; then -r copies recursively
    # all contents of the grub folder into the /boot/grub folder on sdb1
    sudo cp -r /boot/grub /media/sdb1/boot
    # open, as root, menu.lst on sdb1in text editor Kate
    # in 8.10, use kdesudo; in 8.04, use kdesu:
    kdesudo kate /media/sdb1/boot/grub/menu.lst
    # Edit this menu.lst (see the text above)
    # Then File>Save and File>Quit
    # get a GRUB prompt as root
    sudo grub
    # install GRUB to the MBR of the first BIOS boot drive (hd0) using the GRUB files in the GRUB partition (hd1,0) (= sdb1)
    grub>root (hd1,0)
    grub> setup (hd0)
    grub> quit
    # to restart and test the new boot menu from sdb1
    $ sudo shutdown -r now


    Notes:

    -- menu.lst: You may construct your menu.lst any way you wish, using kernel & initrd booting, chainloader booting, or configfile booting, or combinations thereof.

    -- For configfile and chainloader, see SECTION 8.

    -- Adding a new operating system; tips on installing it
    If you install a new operating system, include it in your boot menu, /boot/grub/menu.lst in your GRUB partition. When you install the new OS, have the installer put GRUB in the same partition as the root (/) files of the new OS. Do NOT let the installer put GRUB in (hd0) (doing so would overwrite the GRUB that is already there from your GRUB partition). Then copy the boot entry for the new OS from the menu.lst there to the menu.lst in your GRUB boot partition (sdb1 in the above example). For a simpler method, see “Using configfile” below.

    -- Kernel updates: Editing the boot menu.
    If you update an OS on your drive, you must edit the menu.lst of the GRUB partition to reflect the new kernel reference. However, see the next subject--Using configfile.

    -- Using configfile to simplify things; tips
    Use configfile in the menu.lst of the GRUB partition for Linux operating systems. That way, you won’t have to manually update the kernel lines in the menu.lst of your GRUB partition each time there is a change/update in one of your OS kernels.
    Example:
    Suppose you have an instance of Kubuntu on sdb5. To boot to it from the boot menu on sdb1, as root, access /boot/grub/menu.lst on sdb1 and include the following boot entry for Kubuntu on sdb5:

    title Kubuntu on sdb5 = (hd1,4)
    configfile (hd1,4) /boot/grub/menu.lst

    When you select this from the sdb1 boot menu, GRUB will show you the boot menu from sdb5, from which you then select Kubuntu again (or any other OS listed on the sdb5 menu.lst). That is, you will see two boot menus, the first one from the GRUB partition sdb1, the second one from the OS you chose to boot into. To make Kubuntu boot automatically and quickly from the second boot menu, edit, as root, /boot/grub/menu.lst on sdb5, to set the timeout to some small number of seconds (e.g., timeout = 2), but NEVER zero seconds!, and set the default = n to point at the Kubuntu on sdb5 (i.e, set n equal to the position of Kubuntu in the menu.lst, counting title lines starting at zero; usually, n = 0). You never want to set timeout = 0; if you did, you'd never be able able to select another OS, nor would you be able to interrupt the boot menu in an emergency (by typing “c”).


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SECTION 10
    Rescuing Your System, Emergencies, Fixing Boot problems
    SGD, Emergency boot methods, Working from a Live Kubuntu CD
    Options, strategies for accessing menu.lst and re-installing GRUB

    This section is a quick summary if you have a boot emergency and don't know how to proceed. For an expanded version of troubleshooting tips, see Reply #22 (GRUB Boot--Rescue Methods; How to Boot Into Your Operating System in an Emergency, and some tips on fixing the problem).

    Rx: Either fix menu.lst, and/or re-install GRUB
    If your PC does not let you boot into your operating systems, one of two GRUB components must be fixed: the boot menu, /boot/grub/menu.lst; and/or you must re-install GRUB (to the first BIOS boot drive (hd0)).

    Two ways to do this work: boot into Kubuntu; or use a Live Kubuntu CD
    You may do this work either booted into ANY one of your Kubuntu/Linux OSs or from a Live Kubuntu CD.
    Suppose you can't boot into any of your Kubuntu/Linux OSs.
    => Then, you must use a Live CD to try to fix GRUB.
    Suppose you can't boot into your “main” Kubuntu, but you can boot into another of your Kubuntu/Linux OSs.
    => You can fix GRUB from any Linux OSs you are able to boot into.
    => You can use Konsole (terminal) and/or Konqueror/Dolphin.
    Suppose you can boot into your “broken” Kubuntu.
    => You can then use Konsole and/or Konqueror/Dolphin to fix the problem.


    Emergency boot methods:
    Ways to (try to) boot into your Kubuntu OS (or any of your Linux OSs) where you can then try to fix the problem)

    SGD gets you in fast

    If you need to boot into your Kubuntu, try Super Grub Disk Live CD:
    Super Grub Disk: http://www.supergrubdisk.org/

    Boot into Kubuntu from a GRUB prompt, grub>
    Three ways to get a GRUB prompt, grub>:
    1 After BIOS POST, when the GRUB boot menu appears, press the “c” key. (Press ESC to go back to boot menu)
    2 If you do not have a workable menu.lst, but GRUB is setup, after the POST, you’ll get a grub> prompt instead of menu.lst.
    3 Use a rescue disk (Super Grub Disk ), press the “c” key when prompted
    Then:
    When you get the GRUB prompt, grub>, try to boot into Kubuntu using these methods:
    configfile
    chainloader
    direct kernel booting
    using the edit function “e” on a broken boot menu

    => See SECTION 8 for these methods.

    Fixing the problem from inside Kubuntu
    Fixing the problem assuming you are able to boot into the broken Kubuntu OS (using one of the Emergency boot methods above). How to re-install GRUB, and how to access menu.lst:

    Re-install GRUB (from inside Kubuntu at Konsole)
    -- Re-install GRUB to the MBR of the first BIOS boot drive (hd0) using GRUB files from your Kubuntu partition.
    Open Konsole
    sudo grub
    grub>find /boot/grub/stage1
    # then, if necessary, determine which partition (hdx,y) Kubuntu is in
    # using grub>geometry (hd1), grub>geometry (hd2); etc.
    # Put the correct (hdx,y) here:
    grub>root (hdx,y)
    grub>setup (hd0)
    grub>quit
    $exit

    -- To install/re-install GRUB to the MBR of a non-first HD, do the same, except use
    grub>setup (hd1) (or grub>setup (hd2), etc.) (Applies to external HDDs and flash drives)

    Fixing menu.lst (from inside Kubuntu)
    -- Using Konqueror or Dolphin:
    Open Konqueror/Dolphin as root, then do the edits:
    in 8.10: kdesudo konqueror (or dolphin)
    in 8.04: kdesu konqueror (dolphin)
    Then, from the file manager, access/edit menu.lst, make your edits, then File>Save and File>Quit.
    -- Using Kate (to open menu.lst as root):
    in 8.10: kdesudo kate /boot/grub/menu.lst
    in 8.04: kdesu /boot/grub/menu.lst
    Then, make your edits, and File>Save and File>Quit.

    Fixing the problem using a Live Kubuntu CD
    Fixing the problem assuming you wish to use or you must use a Live Kubuntu CD. How to re-install GRUB, and how to access menu.lst:
    Boot the Live Kubuntu CD, start a live session (i.e., do not “Install”), open Konsole.

    Re-install GRUB (from the Live Kubuntu CD at Konsole)
    -- Re-install GRUB to the MBR of the first BIOS boot drive (hd0) using GRUB files from your Kubuntu partition.
    sudo grub
    grub>find /boot/grub/stage1
    # then, if necessary, determine which partition (hdx,y) Kubuntu is in
    # using grub>geometry (hd1), grub>geometry (hd2); etc.
    # Put the correct (hdx,y) here:
    grub>root (hdx,y)
    grub>setup (hd0)
    grub> quit
    # If that's all you have to do, you may exit
    # Or, you may continue, and access menu.lst for editing ...

    Fixing menu.lst (from the Live Kubuntu CD at Konsole)
    => As root make a “mount” directory, mount the filesystem containing the menu.lst you need to edit, open menu.lst as root, edit it, save, quit, unmount the filesystem, exit.
    # to identify which partition contains the menu.lst (and your Kubuntu):
    sudo fdisk -lu
    # Example: let's suppose it is sdb3
    # make a directory called /media/sdb3:
    sudo mkdir /media/sdb3
    # mount device sdb3 on directory /media/sdb3:
    sudo mount /dev/sdb3 /media/sdb3
    # change to that directory:
    cd /media/sdb3
    #
    # Now, you may use a file manager or a text editor (Kate) to access menu.lst and make edits:
    # (Choose your method; do NOT use the comment signs #.)
    #
    # Open Konqueror/Dolphin as root, then do the edits:
    # in 8.10: kdesudo konqueror (or dolphin)
    # in 8.04: kdesu konqueror (or dolphin)
    # Access /boot/grub/menu.lst
    # Make your edits, then File > Save, File > Quit
    #
    # Or,
    # Open menu.lst as root using Kate, then do the edits:
    # in 8.10: kdesudo kate /boot/grub/menu.lst
    # in 8.04: kdesu kate /boot/grub/menu.lst
    # Make your edits, then File > Save, File > Quit
    #
    # After making edits to menu.lst:
    # unmount the directory; note the spelling of umount:
    sudo umount /media/sdb3
    $ exit
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    Comment


      #3
      Re: HOW TO: GRUB Methods - Toolkit

      A gui to edit grub:

      StartUp Manager, or SUM, is a gui tool for changing settings in the bootloader and splash screen in ubuntu.
      also in the kubuntu

      Homepage:
      http://web.telia.com/~u88005282/index.html

      Ubuntu Forums:
      http://ubuntuforums.org/showthread.php?t=295524


      Note:
      SUM seems to work BUT a good advice: Read Qqmike's
      The boot menu: /boot/grub/menu.lst How to access, back up, and edit
      and especially
      Case 2: Live OS CD method: Use this (or Super Grub Disk) if you are not able to boot into any of your Linux OSs to access/edit the menu.lst.
      Before you edit, BACKUP !

      Why there are dead links ?
      1. Thread: Please explain how to access old kubuntu forum posts
      2. Thread: Lost Information

      Comment


        #4
        Re: HOW TO: GRUB Methods - Toolkit

        Wow -- Qqmike, my hat is off! Thank you very much for taking the time to write it out.

        I presently boot 4 OS's, on 1 PATA and 2 SATA drives. Keeping the Grub menu correct is quite a feat, and I could have used this instruction, rather than figuring it out the hard way(s).

        I appreciate the effort that went into this!

        Comment


          #5
          Re: HOW TO: GRUB Methods - Toolkit

          As anyone who has perused their /boot/grub/menu.lst file lately has noticed, life has gotten a little more complicated lately (in Feisty). In order to compensate for removable drives switching their device numbers, (*)buntu is now using UUIDs to identify partitions in menu.lst! Thus what used to be "root=(hd0,0)"<==hda1 (or sda1) in the good old days, is now "root=UUID=67cc8394-6917-48b5-9e8f-ddfd06cc9c2b" Curiously enough, that doesn't apply to windoze partitions which still have the old-style designation. However, this must be taken into account when messing around with GRUB! . It is now much easier to crash your system. Backing up first is now even more important than before. BE WARNED

          Comment


            #6
            Re: HOW TO: GRUB Methods - Toolkit

            Yes, about the UUIDs, also about sdx naming (the old hdx is now being called sdx, and you may need to check your x’s, too). Here’s a brief discussion about this at another forum I hang out at (hardwareguys as mikemqa):

            http://forums.hardwareguys.com/ikonb...ST;f=12;t=5440

            - - - - -

            Herman’s bigpond reference is at:

            Bigpond, home: http://users.bigpond.net.au/hermanzone/
            (under Filesystems and Mounting)

            where he lists some useful things, like:
            “ . . .this command, (below), will give a whole list of your partitions and their UUIDs,

            herman@edgy:~$ ls /dev/disk/by-uuid/ -alh . . . “

            - - - - -

            Vista and GRUB?

            Another topic I haven’t really nailed own, but only see all the many mentions of it popping up everywhere, is how Vista plays with GRUB. We know the Vista bootloader has changed (not the NTLDR).
            A really good contribution would be to have a brief How-To on that. I don’t use Vista, so it’s difficult to experiment! Maybe Herman will do some work on that.
            I’ll post that issue at the Super Grub Disk mailing list for fun and see if anything comes up.

            - - - - -

            Finally, dibl thanks much for your thanks and kind words. (I’ve quoted you many times re GRUB on mixed SATA and IDE drives.)

            And thanks Rog131 and thanks askrieger for your interest/comments here, too.
            An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

            Comment


              #7
              Re: HOW TO: GRUB Methods - Toolkit

              Two new subjects:

              UUIDs (in Feisty’s filesystem table, fstab)

              Windows Vista dual-booting issues

              -- EDIT: Vista and Linux. I've added another post below on July 17, 2007 on dual booting Vista and Linux, and some related subjects.

              -- Please consider this post to be work-in-progress as I get new information

              - - - - - - - - - -

              UUIDs

              Summary: How the “kernel” lines of the /boot/grub/menu.lst are changed to reflect the new UUID’s for naming devices, starting with Feisty.

              With Feisty, the fstab (filesystem table) uses UUIDs (unique device identifiers) instead of sda, sdb, etc., to name devices.

              To see your UUIDs, use these commands:
              -- From a live Cd or drom a hard-disk installed OS:
              $ ls /dev/disk/by-uuid/ -alh
              (Note: “ls” is “l” as in “list”; and “-alh” is also with an “l” as in”list”)
              -- From only a hard disk-installed OS:
              $ blkid

              This change is at the operating system level. It is not a change in GRUB (or some other place).
              But it affects how GRUB passes the root device to the operating system in the kernel line of the GRUB configuration file (ie, in /boot/grub/menu.lst).

              Example

              Suppose the old or previous fstab entry is:
              /dev/sdb3 /media/sdb3 {followed by all the options}
              And it changes (in Feisty) to:
              UUID=7f4c701f-1ad2-4781-83e5-2bd423cc8g44 /media/sdb3 {options}

              So then, for GRUB:
              The configuration file, menu.lst, passes the root to the kernel for the root filesystem, as in:
              root (hd1,2)
              kernel /vmlinuz-2.6.17-10-generic root=/dev/sdb3 {all the kernel options}
              initrd /boot/initrd.img-2.6.17-10-generic

              Since fstab changed the naming of /dev/sdb3, so must the kernel command be changed as follows:
              root (hd1,2)
              kernel /vmlinuz-2.6.17-10-generic root=UUID=7f4c701f-1ad2-4781-83e5-2bd423cc8g44 {kernel options}
              initrd /boot/initrd.img-2.6.17-10-generic

              (End of the Example)
              - - - - -

              When you change things on your disks, check your UUIDs in fstab and menu.lst . . .

              Herman (bigpond) reminded me about something else:
              When you make changes to your partitions, when you edit them, or change any filesystem types, or reformat partitions, whatever, you should check to see which UUIDs have changed as a result. So you should check it as follows --
              Use the command to check your UUIDs ( ls /dev/disk/by-uuid/ -alh ), and check your filesystem table (fstab) to make sure everything (partitions and UUIDs) is correct. Then, your menu.lst references (to UUIDs) should be checked.

              - - - - -

              UUID, a note about hdx and sdx’s:

              In the past, in Linux notation (eg, in fstab), hard drives were designated hdx (for IDE/PATA drives) and sdx (for SATA drives).
              I have read (and seen one example in Feisty) that the old hdx is gone for IDE/PATA hard drives. PATA drives that used to be hdx are now sdx. Drives that used to be sdx are still sdx but the x is likely to be different.

              - - - - - - - - - -
              - - - - - - - - - -
              Windows Vista
              notes

              EDIT: I've added another post on July 17, 2007 (see below) on dual booting Vista and Linux, and some related subjects.

              Issue #1: Chainloading Vista from Linux, using GRUB

              Instead of the three lines (in /boot/grub/menu.lst) for Windows:
              root (hd0,0)
              chainloader +1
              boot

              . . . use these three lines for the Vista boot entry in menu.lst:

              rootnoverify (hd0,0)
              chainloader +1
              boot


              Issue #2: Chainloading Linux from Vista

              There are problems when people want to chainload Linux from the new Vista bootloader.
              This topic is not covered here, anyway, but a note is made here about it.
              (Previously, people found various ways to chainload Linux from the Windows “old” bootloader NTLDR and the boot.ini file.)

              - - - - - - - - - -

              References:

              Thanks to askrieger (post above) for raising the issue of UUIDs in Feisty.

              Many thanks to the Super Grub Disk mail list owner and members. You can find what I’ve said here and other good GRUB stuff in the archives:
              SGD Archives: https://listas.ensanjose.net/pipermail/supergrub/
              (say OK to any certificates etc.)

              Thanks to Herman at bigpond ( http://users.bigpond.net.au/hermanzone/ ) for the command for finding your UUIDs in fstab, $ ls /dev/disk/by-uuid/ -alh .

              I ripped the following references from our Kubuntu forum where we were trying to assist someone.
              Some more info/detail/aspects of this UUID subject.
              http://www.penguin.ch/dokuwiki/doku....:k_0704:revert
              and USB tacking (interesting):
              http://www.penguin.ch/dokuwiki/doku....ab#usb_tacking
              reasoning behind the UUIDs:
              https://wiki.ubuntu.com/LibAtaForAtaDisks



              An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

              Comment


                #8
                Re: HOW TO: GRUB Methods - Toolkit

                Originally posted by askrieger
                (*)buntu is now using UUIDs to identify partitions in menu.lst
                Interestingly enough, (a.o. Feisty's) device.map sticks to traditional notation ... Am I supposed to understand that?

                Comment


                  #9
                  Re: HOW TO: GRUB Methods - Toolkit

                  "Consistency is the hobgoblin of little minds." R.W. Emerson (or something like that, by someone like that)

                  Comment


                    #10
                    Re: HOW TO: GRUB Methods - Toolkit

                    I’m not sure about that (Edit: what UnicornRider said above). In fact, sometimes, I feel I’m not sure about using device.map at all, to be honest. It's been a bit confusing to me.

                    As we all know, BIOS sees drives in a certain way, GRUB sees them as BIOS does, and Linux sees drives in its own certain way. The correspondence between how BIOS sees HDDs and how Linux grub shell (what you see when you type grub at bash prompt -- not the GRUB menu that you see when you boot your computer) sees them is defined by the mapping table in /boot/grub/device.map.

                    For example, the native GRUB (the one you see when you boot the computer, and the one that shows you your boot menu from menu.lst) sees as hd0 the first hard disk from the BIOS point of view. The file device.map is not read at all. That is, the native GRUB bootloader does not see the device.map.

                    These device.map settings are useful so that the grub shell can read it and the data are correct; for example, when grub-install is run, and the grub shell is used, the device.map is read, so the map table there must be correct or an error or a message occurs. As an example, if you invoke the grub shell, and if no /boot/grub/device.map is found, you’ll get the message: "Probing devices for getting BIOS devices … this may take awhile." However, if there's a /boot/grub/device.map, the grub shell reads it. Also, once you are in the shell you can use the device command to override "device-grubdrive" mappings. (This info was paraphrased from a Super Grub Disk mail list member’s post and other notes.) The GRUB manual describes this grub shell in Section 15.

                    *****
                    EDIT:
                    ***** See Reply #20 below for more on the subject of device.map and the grub shell in Kubuntu. *****
                    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                    Comment


                      #11
                      Re: HOW TO: GRUB Methods - Toolkit

                      How to make a separate, dedicated “GRUB partition.”
                      Make a partition dedicated to the GRUB files and make your PC boot from those GRUB files.

                      Changed:
                      This topic has been deleted in this post.
                      It has been re-written/improved and included in SECTION 9 of the original post (and appears in Reply #1 above)

                      For the Table of Contents of the GRUB toolkit, see the original post (above).

                      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                      Comment


                        #12
                        Re: HOW TO: GRUB Methods - Toolkit

                        Vista -- Linux Dual Boot
                        (Also, some Vista – XP issues)

                        This is a conceptual, birds-eye summary of methods taken from the following excellent source:
                        The Definitive Dual-Booting Guide: Linux, Vista and XP step-by-step: http://apcmag.com/node/5162/

                        Notes & Disclaimer: For actual, step-by-step details, with screenshots, see the Guide. It’s hard to improve upon what they’ve done there, and it seems to be well maintained and tested. The reader comments following each tutorial are very useful, too. As of today, this Guide is the most visible, easiest to read, and generally the best I could find in a 3-minute google scan. The Guide is being continually revised and expanded. (I’m not connected with the Guide. I’m just doing some research/summarizing and sharing it with you so you have a concise, conceptual summary of methods, what’s involved, and what your choices are.)

                        - - - - - - - - - -
                        Vista and Linux

                        When Vista is already installed first, then you install K/Ubuntu (the easiest case):

                        1 Use the Vista Disk Management utility to shrink the Vista partition. That leaves a lot of unallocated space.
                        2 Two choices now:
                        Make partition(s) in the unallocated space using GParted Live CD, then install K/Ubuntu,
                        Or,
                        Simply just proceed to install K/Ubuntu in the unallocated space using the manual partitioning method of the K/Ubuntu installer ("Manual - use the largest continuous free space").
                        3 GRUB will overwrite the MBR and take over the boot management.
                        4 Optional: Access /boot/grub/menu.lst in K/Ubuntu to edit the boot menu for the default OS, the timeout, or to edit the title lines.


                        When K/Ubuntu is already installed first, then you install Vista:

                        1 If the existing K/Ubuntu takes up the entire disk, use GParted Live CD to shrink the existing K/Ubuntu partition. In the freed-up space, do whatever other partitioning/editing you wish to do now.
                        Still in GParted now:
                        -- If you want the Vista bootloader to take over the booting, then note that “… [the K/Ubuntu partition] is marked as a boot partition, and this means that the Vista installation won't work properly while there's a bootable non-Windows partition on the system. Remove the boot flag and click Close.”
                        -- If you will instead have GRUB control the booting, then leave the boot flag in place.

                        2 Install Vista in the newly created space (or partition you made for it).

                        3 In Step 2, the Vista bootloader overwrote the MBR. So now you have to fix the bootloader.
                        Two choices:

                        -- If you want GRUB to control the booting, then use the K/Ubuntu Live CD to re-install GRUB to the MBR. This requires the easy and familiar steps: root (hdx, y), setup (hd0), quit, where the GRUB files are located in (hdx, y) (which is also where you may have put the K/Ubuntu root files). Then check to see if you also need to or wish to edit the boot menu (/boot/grub/menu.lst).

                        -- If you want the Vista bootloader to control the booting, then proceed as follows:
                        First Step:
                        Re-install GRUB to the K/Ubuntu * boot partition * (where /boot/grub/stage1 is located; NOT to the MBR). This requires the steps: root (hdx, y), setup (hdx, y), quit. (Normally, (hdx, y) will probably be (hd0, 0) for most standard K/Ubuntu installations.) Doing this ensures that the Vista bootloader can load K/Ubuntu by loading GRUB and passing control to it.
                        Second Step:
                        In Vista, download and install the EasyBCD.
                        Use EasyBCD to add an entry for K/Ubuntu, using the same partition (hdx, y) you used in the First Step above.
                        - - - - - - - - - -

                        Vista and XP – a few notes

                        “…. if your boot loader is a Microsoft only one, and the installer detects that it is a newer version than the one it is installing, it leaves it intact.”
                        “… Vista recognises (sic) that XP is installed and takes over booting it with no fuss…”
                        http://www.apcstart.com/3895/how_vis...ooting_nirvana

                        This is consistent with the following expected * principle *:
                        “. . . Things are a little better starting with Windows XP Service Pack 2 and Windows Server 2003 Service Pack 1, though. Those and future versions of Windows setup check the version of the NTLDR file and will leave a newer version of the boot loader intact rather than overwriting it with an older version.”
                        (From a Windows blogger about how Windows overwrites boot sectors:
                        http://blogs.msdn.com/oldnewthing/ar...20/505887.aspx )

                        - - - - -
                        XP and Vista -- Overview of two install cases:

                        -- XP is on your system, then you install Vista:
                        If you need to shrink the XP partition, try first to use the utility on the Vista CD (DISKPART). If it won’t go, then use GParted Live CD to shrink it. Then install Vista. The Vista bootloader will automatically recognize and include XP for booting. Download and install Easy BCD. Edit the Vista bootloader as desired (usually for cosmetics only). (EasyBCD is a GUI for the command line BCDEDIT utility; EasyBCD may be easier to use than the CLI.)

                        -- Vista is already installed, then you install XP:
                        If Vista’s partition needs to be shrunk to make room for XP, load Vista, and use its utility (DISKPART) to do so. Then install XP in the partition you created for it. XP will overwrite the MBR, so Vista can’t boot now. Then re-install the Vista bootloader to the MBR (using the Vista DVD, Repair Your Computer, System Recovery Options, etc.). Download and install Easy BCD. Use Easy BCD to edit the Vista bootloader to Add and Entry for XP. See the Guide for other issues (like if the Windows XP bootloader corrupts during the install and fixing it).
                        - - - - -

                        Notes and References

                        Other Cases:
                        See the tutorials, especially the reader comments following each tutorial.
                        Example: Same hard drive or two hard drives? Try it on two. Many readers have done so successfully without major issues.

                        EasyBCD, download:
                        http://neosmart.net/dl.php?id=1
                        (EasyBCD is third-party GUI front end to the BCDEDIT bootloader command-line editor in Vista.)

                        For basic GRUB methods (editing the boot menu; re-installing GRUB), use the first post and following posts of this "How To GRUB Methods - Toolkit" you are reading right now.

                        GParted Live CD:
                        http://gparted.sourceforge.net/livecd.php.
                        http://sourceforge.net/project/showf...kage_id=173828
                        (Note: GParted is also included as a system application in K/Ubuntu 7.04, System > Administration > GNOME Partition Editor, but it’s also handy to have a copy of the GParted Live CD).

                        An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                        Comment


                          #13
                          Re: HOW TO: GRUB Methods - Toolkit

                          Install Windows XP *after* Kubuntu, and assume
                          You install XP to a non-first hard drive
                          - - - - - Question: How do you setup/edit GRUB so it boots either your Kubuntu or your XP?

                          Changed:
                          This topic has been deleted in this post.
                          It has been re-written/improved and included in SECTION 6 of the original post (and appears in the first post above).

                          For the Table of Contents of the GRUB toolkit, see the original post (above).
                          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                          Comment


                            #14
                            Re: HOW TO: GRUB Methods - Toolkit

                            Install Kubuntu 7.04 to an external USB hard drive: How to.

                            If I may, for people who ended up here, I’d like to cross reference the Thumb Drive How-To where I added a new post:

                            How To Make GRUB Thumb Drive
                            http://kubuntuforums.net/forums/inde...opic=3081748.0
                            *** New posting:
                            How to install K/Ubuntu 7.04 to an external USB hard disk drive (HDD).
                            (Scroll to the second post, August 14, 2007.)

                            Installing to an external USB HDD involves the same BIOS and GRUB issues you encounter when building a bootable USB Flash Drive (UFD) or thumb drive.
                            An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                            Comment


                              #15
                              Re: HOW TO: GRUB Methods - Toolkit

                              Separate, dedicated GRUB partition--Another example.

                              Changed:
                              This topic has been deleted in this post.
                              It has been re-written/improved and included in SECTION 9 of the original post (and appears in Reply #1 above)

                              For the Table of Contents of the GRUB toolkit, see the original post (above).
                              An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                              Comment

                              Working...
                              X