Pages

Showing posts with label boot. Show all posts
Showing posts with label boot. Show all posts

Thursday, January 13, 2011

Restoring GRUB2

PROBLEM: Restoring the Grub2

INFORMATION: This post is for the dual-boot people who find their booting screen has been missing some operating system after fresh installation of fresh Ubuntu(grub2)/Windows 7.

NOTE: The steps given for restoring grub2 are for Ubuntu version later than 9.10 .

STEPS:

Restoring Grub2(Ubuntu 9.10 or later)

1)  Boot with bootable pen-drive or cd of Ubuntu.

2) Type this in terminal

sudo fdisk -l

Output:
Disk /dev/sda: 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: 0xf4caf4ca


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20482843+  42  SFS
/dev/sda2            2551        9730    57666845   42  SFS


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: 0x329e329d


   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2              14        1810    14432040    7  HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sdb3            1913        9729    62785769+   5  Extended
Partition 3 does not end on cylinder boundary.
/dev/sdb4            1810        1913      824040   82  Linux swap / Solaris
Partition 4 does not end on cylinder boundary.
/dev/sdb5            1913        4023    16949488+  83  Linux
/dev/sdb6            5929        9167    26006368+   7  HPFS/NTFS
/dev/sdb7            9167        9729     4520848+   7  HPFS/NTFS
/dev/sdb8            4023        5929    15307776   83  Linux



The above output shows presence of 2 hard-disks . One /dev/sda and other one being /dev/sdb.
I have 2 linux partition present(Ubuntu 11.10-(/dev/sdb8) & Ubuntu 11.04:(/dev/sdb5))

3) Check your partition on which your Ubuntu is installed. I am using /dev/sdb5

4) Make a directory in /media using the command:


sudo mkdir /media/sdb5

5) Now mount your partiotion into above created directory

sudo mount /dev/sdb5 /media/sdb5

6) To install your grub on your drive use grub-install as follows. Note: /dev/sdb is used as it is the boot partition (look at the fdisk output)

sudo grub-install --root-directory=/media/sdb5 /dev/sdb

7) If you miss “grub.cfg” file,use following to recreate:

mount --bind /proc /mnt/proc
 mount --bind /dev /mnt/dev 
mount --bind /sys /mnt/sys 
chroot /mnt update-grub 
umount /mnt/sys 
umount /mnt/dev 
umount /mnt/proc

Saturday, December 25, 2010

Change BOOT TIMEOUT in Ubuntu 9.10 or 10.04 (GRUB 2)

PROBLEM : To change BOOT TIMEOUT in Ubuntu 9.10 or 10.04 (GRUB 2)

INFORMATION: After the development of GRUB 2(used in Ubuntu 10.04,9.10) many things have changed for the booting options. So if your Linux installation is using grub 2.0 then this trick should work for you.

With Grub 2 you can no longer edit grub.conf or menu.lst files located in /boot/grub folder. In Grub 2, file is located in /etc/default with name as grub

STEPS:

1) Boot your Ubuntu

2) Open your terminal using (Alt+Ctrl + T or by browsing through Applications->Accessories-> Terminal)

3) Type the following command in the terminal(red color)

sudo gedit /etc/default/grub

: sudo allows users to run programs with the security privileges of another user (normally root)
: gedit is a text editor in Ubuntu

4) The contents would look like this:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=3
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

5) To change the BOOT TIMEOUT , change the value of the GRUB_TIMEOUT paramter.
In the above example, the value of GRUB_TIMEOUT is set as 20 which is equivalent to 10 sec .


6)Save and close the file.Switch to terminal again.

7)To make the changes applicable type the following command(red color).
sudo update-grub


8) BOOT to see the changes .

Tuesday, December 21, 2010

Changing Default BOOT ORDER in Ubuntu 9.10 or 10.04 (GRUB 2)

PROBLEM : To change the Default BOOT ORDER in Ubuntu 9.10 or 10.04

INFORMATION: After the development of GRUB 2(used in Ubuntu 10.04,9.10) many things have changed for the booting options. So if your Linux installation is using grub 2.0 then this trick should work for you.

With Grub 2 you can no longer edit grub.conf or menu.lst files located in /boot/grub folder. In Grub 2, file is located in /etc/default with name as grub

STEPS:

1) Boot your Ubuntu

2) Open your terminal using (Alt+Ctrl + T or by browsing through Applications->Accessories-> Terminal)

3) Type the following command in the terminal(red color)

sudo gedit /etc/default/grub

: sudo allows users to run programs with the security privileges of another user (normally root)
: gedit is a text editor in Ubuntu

4) The contents would look like this:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=3
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

5) To change the Boot Order, change the GRUB_DEFAULT parameter.
The first option in the default boot has the GRUB_DEFAULT parameter value as 0.
So if u want that the 4th row in boot display shoud be selected by default.Then change the value of the GRUB_DEFAULT to 3.
In the above example, my GRUB_DEFAULT is set as 3, which boots WINDOWS 7.

6)Save and close the file.Switch to terminal again.

7)To make the changes applicable type the following command(red color).
sudo update-grub


8) Now your BOOT ORDER has been changed and Boot the computer to see the changes.