Ubuntu

GRUB problem

Asked by Iqbal on 2010-07-12

Hi,
I have problem in installing GRUB in boot sector of /boot partition.

I have Vista in first partition. I added an entry for linux in Vista boot loader using EasyBCD. Now I want to install GRUB in boot sector.

When I use grub-install, it say
"Cant read core.img for correctly"

How to solve this problem?

My laptop has One Drive. 64 bits. OSs are Vista and Ubuntu 9.10.
Boot partition is /dev/sda5.
I tried

First mounted /dev/sda5 partition (the boot partition)

$sudo grub-install --root-directory=/boot/grub /dev/sda5

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Last query:
2010-07-23
Last reply:
2010-08-18
Goh Lip (gohlip) said : #1

Just do this
sudo grub-install /dev/sda

Iqbal (naqvi-iqbal2001) said : #2

Hi,
When I boot the system I get GRUB prompt.
I then executed

grub>root (hd0,4)

grub>setup (hd0,4)

grub>kernel /vmlinuz-2.6.31-22-generic

grub>kernel /initrd.img-2.6.31-22-generic

All of these commands didn't give problem. Then I executed boot command

grub>boot

After some time, I got the messege

Gave up waiting for root device. Common Problems:

- boot args (cat /proc/cmdline)

- Check root delays (Did the system wait long enough ?)

- Check root : (did the system wait for the right device?)

- missing modules ( cat /proc/module; /ls/dev)

- Alert /dev/disk/by-uuid=[XXX] does not exist. Dropping to a shell.

initrmfs>

Then I booted in my original ubuntu using Super Grub Disk
edited the line in /etc/defualt/grub, or uncommented and saved.
GRUB_DISABLE_LINUX_UUID=true

Then I executed
sudo update-grub

No command found.

The laptop has separate boot partition.

How to boot into the system?

Goh Lip (gohlip) said : #3

I assumed you are using grub2, not grub-legacy. And I also assumed you can boot into Ubuntu because you issued a command "$sudo grub-install --root-directory=/boot/grub /dev/sda5". Never mind, now I shall assume you cannot boot into Ubuntu at all but you are still using grub2, and you have a separate /boot at sda5 as per your post above. If this is wrong, please get back again. At grub prompt, type the following..

 linux (hd0,5)/vmlinuz-2.6.31-22-generic root=/dev/sda5 ro
 initrd (hd0,5)/initrd.img-2.6.31-22-generic
        boot
When booted into Ubuntu, at terminal "sudo grub-install /dev/sda"
If assumptions are wrong, please inform what partitions are '/', '/boot', and grub version. If you can boot into Ubuntu using easybcd, do so and just "sudo grub-install /dev/sda". If error message appears, you are probably on grub-legacy and you need to convert to grub2 by "sudo apt-get install grub-pc". Please complete all instructions and remember to set grub to "sda".

If you still have problem and cannot boot into ubuntu, please provide more details as to Ubuntu version, grub version and list of all partitions, ie, /boot partition and / partition. (or if /boot is actually in /). I shall take it then you cannot provide details of 'sudo fdisk -l' or 'sudo blkid'.

Iqbal (naqvi-iqbal2001) said : #4

Good Morning,

System Information:
Dual Boot: Windows Vista (64 bits) and Ubuntu 9.10 (64 bits)
Partitions: Three Windows NTFS partitions and 4 Linux partitions as given below
Partition 1 mounted on /
Partition 2 mounted on /boot (/dev/sda5)
Partition 3 mounted on /home (/dev/sda6)
Partition 1 swap
MBR has Windows Vista boot loader. An entry for Linux has been added using EasyBCD.

Because grub2 is default boot loader for ubuntu 9.10 and above so Laptop has grub2. The Laptop does bot have menu.lst file.
My target is to install grub in /boot partition's boot sector.

Goh, When I boot the system, I get Windows boot loader (Vista) with an entry for Linux. Once I select Linux, I am put to GRUB prompt.
After running grub's fdisklu command, it tells that /dev/sda5 is boot partition mounted on /boot.

Then I executed root and setup commands. These commands did not report any error. The sequence is given below

grub>root (hd0,4)

grub>setup (hd0,4)

grub>kernel /vmlinuz-2.6.31-22-generic

grub>initrd /initrd.img-2.6.31-22-generic

grub>boot
 It does not boot, but put me on initrmfs prompt.
initrms>

If I boot using LiveCD and try to execute sudo update-grub or sudo update-grub2, it says command not found.

If I boot in my original ubuntu using Super Grub Disk
edited the line in /etc/defualt/grub, or uncommented and saved.
GRUB_DISABLE_LINUX_UUID=true

Then I executed
sudo update-grub

No command found.

How to solve it?

Goh Lip (gohlip) said : #5

Let me ask again, where is your '/' on, sda4, sda3?
And are you on grub2 or grub-legacy?
And have you done what I ask you to do on my message of 2010-07-14:?

and at grub prompt, can you get any result from
search -f /vmlinuz
search -f /boot/vmlinuz
search -f /vmlinuz-2.6.31-22-generic
search -f /boot/vmlinuz-2.6.31-22-generic

Also when you get any result from the above queries,
ls (hd0,x) ----- where 'x' is the result of query.

or if you get no output from NONE of these, try this at grub prompt
find /boot/grub/stage1

Print these results out , okay? and tell me what is '/' and grub version, okay?

Iqbal (naqvi-iqbal2001) said : #6

Good Morning,

Goh, sorry for the delay in responding.

As for as your four queries are concerned, grub returned Unrecognised command.

But when I execute the root and setup commands at grub prompt, then I get following output.

grub> root (hd0,4)
grub setup (hd0,4)
        Checking if /boot/grub/stage1 exists ....yes
        Checking if /boot/grub/stage2 exists ....yes
        Checking if /boot/grub/e2fs_stage1_5 exists ....no
Running install /boot/grub/stage1 (hd0,4) /boot/grub/stage2 p /boot/grub/menu.lst .... succeeded
Similarly kernel and initrd commands also run successfully.
Then boot command puts me on BusyBox, finally initrmfs prompt.

Now the information about the system (Laptop):
fdisklu command of grub gives the following information

 2 (hd0,1) fat 14 GB Windows
 5 (hd0,4) ext2fs 63 GB /boot
 6 (hd0,5) ext2fs 93 GB ubuntu 9.10 \n \l
 7 (hd0,6) ext2fs 91 GB
-----------------------------
/dev/sda5 is /
/dev/sda6 is /boot
/dev/sda7 is /home

Output of blkid command:

/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="8A58E36458E34D8F" LABEL="HCL_DISK1" TYPE="ntfs"
/dev/sda2: LABEL="HCL_DISK2" UUID="1D56-17FB" TYPE="vfat"
/dev/sda3: UUID="70AC3ED0AC3E9118" LABEL="HCL_DISK3" TYPE="ntfs"
/dev/sda5: UUID="b81b47f5-6fd6-4cef-8402-99732b71387f" TYPE="ext4"
/dev/sda6: UUID="e5de72fe-c90b-4da0-85d3-aab9416f75a4" TYPE="ext4"
/dev/sda7: UUID="1b1196a6-c997-42ed-8518-2426200fabde" TYPE="ext4"
/dev/sda8: UUID="2be15991-abd1-477a-81b4-425e5c89320b" TYPE="swap"
/dev/sdb1: LABEL="Iqbal" UUID="0920-E0CE" TYPE="vfat"

Output of fdisk command:

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0429987d

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 6528 52428800 7 HPFS/NTFS
/dev/sda2 6528 8486 15726592 c W95 FAT32 (LBA)
/dev/sda3 8486 28154 157983738+ 7 HPFS/NTFS
/dev/sda4 28155 60801 262237027+ 5 Extended
/dev/sda5 28155 36422 66412678+ 83 Linux
/dev/sda6 36423 48580 97659103+ 83 Linux
/dev/sda7 48888 60801 95699173+ 83 Linux
/dev/sda8 48581 48887 2465946 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 2001 MB, 2001731584 bytes
16 heads, 32 sectors/track, 7636 cylinders
Units = cylinders of 512 * 512 = 262144 bytes
Disk identifier: 0x000d8292

   Device Boot Start End Blocks Id System
/dev/sdb1 * 16 7636 1950784 e W95 FAT16 (LBA)

Goh Lip (gohlip) said : #7

Let me say one more (last) time, and you are still not doing this, so do this and get back to me. Looking at your many other new posts on this section, you might be using super grub, and you are confusing the whole situation that we cannot follow you any more. If the grub prompt is from the computer system, and NOT from the super grub, then do this....

grub> linux (hd0,6)/vmlinuz-2.6.31-22-generic root=/dev/sda5 ro
grub> initrd (hd0,6)/initrd.img-2.6.31-22-generic
grub> boot

<OR> (since you have now provided uuid info and partition info)

grub> search --no-floppy --fs-uuid --set e5de72fe-c90b-4da0-85d3-aab9416f75a4
grub> linux /vmlinuz-2.6.31-22-generic root=UUID=b81b47f5-6fd6-4cef-8402-99732b71387f ro
grub> initrd /initrd.img-2.6.31-22-generic
grub> boot

When booted, at terminal
sudo grub-install /dev/sda

DO NOT DO THIS ANYMORE......
grub> root (hd0,4)
grub> setup (hd0,4)
etc etc

ps: you have 91 GB for /boot? mmmm....

Iqbal (naqvi-iqbal2001) said : #8

Good Morning,

As suggested, I tried
grub> linux (hd0,6)/vmlinuz-2.6.31-22-generic root=/dev/sda5 ro
grub> initrd (hd0,6)/initrd.img-2.6.31-22-generic
grub> boot

But, first command linux reurned output as "Unrecognised command".

Then I saw using help --all command and found that there was no linux command.

Consequently, initrd and boot commands also did not execute in the absence kernel.
With reference to your doubt grub prompt, grub prompt is from computer only.

for this comment --> ps: you have 91 GB for /boot? mmmm....
This is the output of grub>fdisklu
2 (hd0,1) fat 14 GB Windows
 5 (hd0,4) ext2fs 63 GB /boot
 6 (hd0,5) ext2fs 93 GB ubuntu 9.10 \n \l
 7 (hd0,6) ext2fs 91 GB

So /boot is 63 GB.

Goh Lip (gohlip) said : #9

It is very likely you have thoroughly messed up your mbr and grub by both EasyBCD and super-grub.
Your details from fdisk and other output shows this. For example sda4 is extended and you claim it is /boot. But never mind, lets clean all this up.

Boot up your Karmic-livecd and install 'mbr' by
sudo apt-get install mbr
sudo install-mbr /dev/sda
sudo mount /dev/sda6
sudo grub-install --root-directory=/dev/sda6 /dev/sda

Reboot to computer system not livecd, at grub prompt,

> grub> linux (hd0,6)/vmlinuz-2.6.31-22-generic root=/dev/sda5 ro
> grub> initrd (hd0,6)/initrd.img-2.6.31-22-generic
> grub> boot

<OR>
> grub> search --no-floppy --fs-uuid --set e5de72fe-c90b-4da0-85d3-aab9416f75a4
> grub> linux /vmlinuz-2.6.31-22-generic root=UUID=b81b47f5-6fd6-4cef-8402-99732b71387f ro
> grub> initrd /initrd.img-2.6.31-22-generic
> grub> boot

> When booted, at terminal
> sudo grub-install /dev/sda

And please, do not use easyBCD or super grub.

Iqbal (naqvi-iqbal2001) said : #10

Good Noon Goh,

After booting from LiveCD, I executed the command sudo apt-get install mbr, It could not install. Then I downloaded one .deb (64 bit) from Debian site and installed. Then moved on as suggested. It boots successfully to grub prompt.
When I executed the command

grub> linux (hd0,6)/vmlinuz-2.6.31-22-generic root=/dev/sda5 ro

it gave error then I switched device numbers and executed the following command

grub> linux (hd0,5)/vmlinuz-2.6.31-22-generic root=/dev/sda6 ro

and executed the remaining commands initrd and boot.
The laptop booted (without LiveCD) in original installation.

Then I executed sudo grub-install /dev/sda
It gave unrecognised command.

If I reboot now, it goes to grub prompt again. Now again load kernel and initrd then boots to original installation.

Then I booted in original installation, connected it to internet and installed grub-pc from synaptic program. It was, to some extent successful.
But if I reboot, it shows grub screen to choose OS from. If I choose ubuntu, it works and if choose Windows it does not.
How to register Windows (Vista).

Information:
GParted shows that /dev/sda5 is boot, mounted on /boot.
/dev/sda6 is root, mounted on /.

Goh Lip (gohlip) said : #11

Good! We are making progress.

When booted,
sudo grub-mkdevicemap
sudo update-grub

Good luck

Goh Lip (gohlip) said : #12

ps: did you do
sudo grub-install --root-directory=/dev/sda5 /dev/sda
while at livecd?
need to mount sda5 first
sudo mount /dev/sda5

Then when booted
sudo grub-install /dev/sda

Iqbal (naqvi-iqbal2001) said : #13

Hi,
I did on live CD, in the way and order you told me.

When booted sudo grub-install does not run.

Goh Lip (gohlip) said : #14

sudo grub-install --root-directory=/dev/sda5 /dev/sda

note it is sda5, not sda6 as you said /boot is sda5 now.

Goh Lip (gohlip) said : #15

Also check your fstab, it should contain an entry for /boot, that is sda5.
If not, manually an an entry. fstab may have been corrupted

Iqbal (naqvi-iqbal2001) said : #16

Hi,

I executed the following commands, as told on 2010-07-22,

sudo grub-mkdevicemap
sudo update-grub

it works and linux starts smoothly, but Windows is gone. How to get it back?

I am leaving for leave for a week, so I would report you back on next to next monday.

Goh Lip (gohlip) said : #17

Your windows bootloader may also have been corrupted too by supergrub/easybcd.
To get back your windows, you have to get the windows install disk and either fixmbr or something else depending on your version of windows. Google and you might find something that may help you out.

*BUT* before you fix your windows bootloader, get a grub-rescue cd first.
sudo grub-mkrescue --output=anyname.iso

Burn that iso image file to disk and remember to write the details of your existing grub.cfg.
After you fix your windows, ubuntu will not be able to be booted. Put in that rescue cd when booting up and you will have a grub prompt. Type in the entry you copied from the grub.cfg and you will boot into ubuntu. at terminal, "sudo grub-install /dev/sda"

Iqbal (naqvi-iqbal2001) said : #18

Hi,
What is the meaning of the line "remember to write the details of your existing grub.cfg." in your post?

delance (olivier-delance) said : #19

I think he wanted to say print grub.cfg on paper or copy it on a USB key.
To see how to restore the Ubuntu/XP/Vista/7 bootloader, go on this site
      http://ubuntuforums.org/showthread.php?t=1014708
Perhaps you will have to add an entry in file 40_custom of /etc/grub.d

Can you help with this problem?

Provide an answer of your own, or ask Iqbal for more information if necessary.

To post a message you must log in.