Find the answer to your Linux question:
Results 1 to 4 of 4
Hi folks, sda Windows7 sdb Ubuntu 10.04 bootloader Grub On installing Ubuntu Grub was saved on sda Windows7. The system works without problem by selecting the 1st boot HD = ...
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,546

    About bootloader

    Hi folks,

    sda Windows7
    sdb Ubuntu 10.04
    bootloader Grub

    On installing Ubuntu Grub was saved on sda Windows7. The system works without problem by selecting the 1st boot HD = Windows7 on BIOS.

    I'm curious to know is there any way moving Grub to Ubuntu? If YES, please advise HOW? TIA

    B.R.
    satimis

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    You can use Ubuntu LiveCD to re-install GRUB in MBR of Ubuntu disk.

    Boot up from LiveCD and execute this in Terminal :
    Code:
    sudo mount /dev/sdbX /mnt
    sudo grub-install --root-directory=/mnt /dev/sdb
    sudo umount /mnt
    Replace X with partition number assigned to root partition of Ubuntu.
    Set Ubuntu disk as First Boot Device in BIOS. If everything works fine, boot up Ubuntu from Hard disk and execute sudo update-grub command in Terminal to add an entry of Windows OS in GRUB Menu.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,546
    Quote Originally Posted by devils casper View Post
    You can use Ubuntu LiveCD to re-install GRUB in MBR of Ubuntu disk.

    Boot up from LiveCD and execute this in Terminal :
    Code:
    sudo mount /dev/sdbX /mnt
    sudo grub-install --root-directory=/mnt /dev/sdb
    sudo umount /mnt
    Replace X with partition number assigned to root partition of Ubuntu.
    Set Ubuntu disk as First Boot Device in BIOS. If everything works fine, boot up Ubuntu from Hard disk and execute sudo update-grub command in Terminal to add an entry of Windows OS in GRUB Menu.
    Hi,

    Thanks for your advice.

    Actually there is no problem on booting. Ubuntu can boot automatically after displaying the bootloader (grub) screen. To boot Win7 I must select it manually on the screen.

    But I don't understand why the BIOS setup on boot must be as follow?

    Code:
    1st Drive - Win7
    2nd Drive - Ubuntu
    
    Boot
    Win7 Drive
    With following setup;
    Code:
    1st Drive - Ubuntu
    2nd Drive - Win7
    
    Boot
    Ubuntu Drive
    Ubuntu can't boot and the bootloader screen doesn't display.


    $ cat /boot/grub/grub.cfg
    Code:
    ### BEGIN /etc/grub.d/00_header ###
    if [ -s $prefix/grubenv ]; then
      load_env
    fi
    set default="0"
    if [ ${prev_saved_entry} ]; then
      set saved_entry=${prev_saved_entry}
      save_env saved_entry
      set prev_saved_entry=
      save_env prev_saved_entry
      set boot_once=true
    fi
    
    function savedefault {
      if [ -z ${boot_once} ]; then
        saved_entry=${chosen}
        save_env saved_entry
      fi
    }
    
    function recordfail {
      set recordfail=1
      if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
    }
    insmod ext2
    set root='(hd1,1)'
    search --no-floppy --fs-uuid --set 4bd744f4-6710-4cef-ba8e-92dc1f64da93
    if loadfont /usr/share/grub/unicode.pf2 ; then
      set gfxmode=640x480
      insmod gfxterm
      insmod vbe
      if terminal_output gfxterm ; then true ; else
        # For backward compatibility with versions of terminal.mod that don't
        # understand terminal_output
        terminal gfxterm
      fi
    fi
    insmod ext2
    set root='(hd1,1)'
    search --no-floppy --fs-uuid --set 4bd744f4-6710-4cef-ba8e-92dc1f64da93
    set locale_dir=($root)/boot/grub/locale
    set lang=C.UTF-8
    insmod gettext
    if [ ${recordfail} = 1 ]; then
      set timeout=-1
    else
      set timeout=10
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    	recordfail
    	insmod ext2
    	set root='(hd1,1)'
    	search --no-floppy --fs-uuid --set 4bd744f4-6710-4cef-ba8e-92dc1f64da93
    	linux	/boot/vmlinuz-2.6.32-24-generic root=UUID=4bd744f4-6710-4cef-ba8e-92dc1f64da93 ro   splash quiet
    	initrd	/boot/initrd.img-2.6.32-24-generic
    }
    menuentry 'Ubuntu, with Linux 2.6.32-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    	recordfail
    	insmod ext2
    	set root='(hd1,1)'
    	search --no-floppy --fs-uuid --set 4bd744f4-6710-4cef-ba8e-92dc1f64da93
    	echo	'Loading Linux 2.6.32-24-generic ...'
    	linux	/boot/vmlinuz-2.6.32-24-generic root=UUID=4bd744f4-6710-4cef-ba8e-92dc1f64da93 ro single 
    	echo	'Loading initial ramdisk ...'
    	initrd	/boot/initrd.img-2.6.32-24-generic
    }
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    menuentry "Memory test (memtest86+)" {
    	insmod ext2
    	set root='(hd1,1)'
    	search --no-floppy --fs-uuid --set 4bd744f4-6710-4cef-ba8e-92dc1f64da93
    	linux16	/boot/memtest86+.bin
    }
    menuentry "Memory test (memtest86+, serial console 115200)" {
    	insmod ext2
    	set root='(hd1,1)'
    	search --no-floppy --fs-uuid --set 4bd744f4-6710-4cef-ba8e-92dc1f64da93
    	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
    }
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry "Windows 7 (loader) (on /dev/sda1)" {
    	insmod ntfs
    	set root='(hd0,1)'
    	search --no-floppy --fs-uuid --set be165b2e165ae745
    	chainloader +1
    }
    ### END /etc/grub.d/30_os-prober ###
    $ sudo fdisk -l
    Code:
    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000c92e3
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1      118707   953510912   83  Linux
    /dev/sda2          118707      121602    23248897    5  Extended
    /dev/sda5          118707      121602    23248896   82  Linux swap / Solaris
    
    Disk /dev/sdb: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000d09a7
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1        9729    78148161    7  HPFS/NTFS

    B.R.
    satimis

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    GRUB has been installed in MBR of Hard disk having Windows 7. Both Hard disks are dependent on each other. If you unplug any, OS in other disk will not boot up. That's why I suggested you to install GRUB in MBR of Hard disk having Ubuntu.

    If you just want to change boot order and set Windows 7 as default OS, edit /etc/default/grub file. Set default OS in that file and execute sudo update-grub command to generate new GRUB Menu.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...