# [SOLVED] Linux in Legacy mode, grub rescue



## Shashank M (Jul 19, 2010)

I have a dell laptop with pre-installed windows8. I installed ubuntu on it in legacy mode as I didnt know how to install it otherwise. I noticed that Windows8 was on uefi mode.
as a result, whenever I turn the laptop on, I need to press F2 to change 3 boot settings...
boot mode UEFI/LEGACY, secure boot ON/OFF, enable mode legacy.
So, when in UEFI mode, I don't get a grub menu.
And in Legacy mode's grub menu, it doesn't show Windows.

All was fine until I updated windows8 to 8.1 through update.
I noticed that along with C drive, there were few recovery partitions visible in MyComputer. I think they provide those partitions to help us get back to windows8 if wanted.

I think, those recovery partitions lead to resize of ubuntu partitions. Few days later when I tried to start ubuntu, It showed,
"file /grub/i386-pc/normal.mod not found"
followed by line "grub rescue >"

Fortunately, as ubuntu is on legacy mode, I can use windows 8.1 properly through uefi mode.

I need to get back ubuntu. I read about BOOT REPAIR, but I also read that it changes ubuntu's mode to uefi which would harm my windows8.1 as well.

Also I DO NOT have a windows recovery disk.
I know that removing ubuntu requires deleting partitions, and then fixing the MBR using windows recovery disk. But I dont have one.
I would like to remove and re-install ubuntu through windows itself.

I think there may be a way to repair ubuntu properly without windows recovery disk...
Help me with it


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

I tried inserting the ubuntu disk to see if I can boot through it, but it just loops through the DELL's start screen with Dell written on it.


----------



## hal8000 (Dec 23, 2006)

*Re: Linux in Legacy mode, grub rescue*

Try changing to secure boot off, legacy mode, then see if you can boot from the Ubuntu CD.
If you cannot get the Ubuntu CD to boot in live mode, then there is little chance of recovery.

By upgrading to windows 8.1, you may have wiped out your ubuntu partition, cant tell for certain unless you can access your laptop from a live linux CD.


----------



## sobeit (Nov 11, 2007)

*Re: Linux in Legacy mode, grub rescue*



Shashank M said:


> I tried inserting the ubuntu disk to see if I can boot through it, but it just loops through the DELL's start screen with Dell written on it.


clarification - did you change the boot order to boot from the ubuntu disk?


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

I tried with secured boot off and legacy mode... but the dell start screen keeps looping. and the moment I remove the disk, the same grub rescue error flashes.

And there is no direct option for boot from cd/dvd.
That's why I had installed Ubuntu on Legacy mode with the 3 settings changed. Secure boot off, legacy mode on etc.


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

I tried booting from ubuntu live CD and this time it booted !
I wanted to see if all partitions are intact. And I think all the partitions were shown when chose ubuntu installation. However, when I clicked on CONTINUE, there was a message that NO ROOT WAS detected or something similar. Though I did not want to install ubuntu again.

So I clicked on "Try ubuntu" and then I wanted to restore grub. So, in terminal, I typed,
"sudo fdisk -l" I expected a list of all my partitions shown previously, but it shows only 1 partition of 1TB. My HDD is 1TB. So, it is showing the complete HDD... and the file system shown is GPT. Also the 1st line after executing the "sudi fdisk -l" command is,
"Warning : GPT detected. Use G Parted......"

As it was clear that all ubuntu partitions were intact, I tried to use the 'grub rescue' to check which partition has boot folder.
After reboot without ubuntu cd, when I got grub rescue>,
I typed... ls
and it showed 14 partitions as below :
(hd0), (hd0,gpt1), (hd0,gpt2), .......... , (hd0,gpt13)
What I expected was something like (hdo,1), etc., so that I could search for boot/ folder...

What do I need to do now ?


----------



## hal8000 (Dec 23, 2006)

*Re: Linux in Legacy mode, grub rescue*



Shashank M said:


> I tried booting from ubuntu live CD and this time it booted !
> 
> So I clicked on "Try ubuntu" and then I wanted to restore grub. So, in terminal, I typed,
> "sudo fdisk -l" I expected a list of all my partitions shown previously, but it shows only 1 partition of 1TB. My HDD is 1TB. So, it is showing the complete HDD... and the file system shown is GPT. Also the 1st line after executing the "sudi fdisk -l" command is,
> ...



You may not get out of this without reinstalling.
Ok its not the filesystem that is GPT but the partition table.
Your disk is using a GUID partition table not the standard Intel partition table.
The first partition hd0,gpt1 will almost certainly be windows, also, as its windows 8 there may also be a recovery partition hd0,gpt2.

So what you need to do now is again boot from the live CD and try ubuntu, then from a terminal type

sudo gdisk /dev/sda

(If you get command not found you will have to install gdisk the code is below:

sudo apt-get install gdisk 

This will install gdisk for working with GUID partition tables)

Now you need to list partitions and post the output, the live CD should give you network access. The command is:

[email protected]:~$ sudo gdisk -l /dev/sda

Replace sda with correct drive (if you have one drive it is sda)
The output from gdisk is slightly different, example below:



```
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 312581808 sectors, 149.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): C5842E07-C70E-4EB3-9ADB-FA06A5EF62BD
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 312581774
Partitions will be aligned on 2-sector boundaries
Total free space is 1734 sectors (867.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34        78125000   37.3 GiB    0700  Backup
   2        78125056       156250111   37.3 GiB    0700  Images
   3       156250112       195311615   18.6 GiB    0700  MP3
   4       195311616       312580095   55.9 GiB    0700  video
```
You can have 126 partitions in a GUID partition table but from your output you need to work out which partition is / and which is /home
Once you have found /home it will be matter of backing up the data you need to keep,
then I would consider a reinstall.

I want to see the GUID partition table first if 14 entries have been created, I will be surprised.

Others have got around it this way:
system installation - GPT partition table warning message during install of ubuntu - Ask Ubuntu

However be very careful as one mistake and you can also wipe windows


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

Well, thanks for explaining, but I'm a newbie to linux so I could understand till...
I need to install gdisk and list the partitions using,
[email protected]:~$ sudo gdisk -l /dev/sda
but what should I replace "sda" with ?
and do you mean, that if I type the wrong sda'x' in that command, windows will get wiped out ??


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*


```
[email protected]:~$ sudo gdisk -l /dev/sda

GPT fdisk (gdisk) version 0.8.8



Partition table scan:

MBR: protective
  
BSD: not present
  
APM: not present
  
GPT: present



Found valid GPT with protective MBR; using GPT.

Disk /dev/sda: 1953525168 sectors, 931.5 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): A3B82A8D-74F1-4704-BB7C-226AAF195C74

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 1953525134

Partitions will be aligned on 2048-sector boundaries

Total free space is 13893565 sectors (6.6 GiB)



Number             Start (sector)      End (sector)       Size         Code	Name
1		      2048            1026047   500.0 MiB   EF00	EFI system partition
2		1026048            1107967     40.0 MiB    FFFF	Basic data partition
3		1107968            1370111   128.0 MiB   0C01	Microsoft reserved part
4		1370112            2394111   500.0 MiB   2700	Basic data partition
5		2394112      1467629567    698.7 GiB   0700	Basic data partition
6	          1467629568      1468551167   450.0 MiB   2700
7	          1468551168      1797068799    156.6 GiB   0700	Basic data partition
8	          1797068800      1836130303      18.6 GiB   8300
9	          1836130304      1875191807      18.6 GiB   8300
10	          1875191808      1904488447      14.0 GiB   8200
11	          1904488448      1914253311        4.7 GiB   EF02
12	          1928142848      1928859647   350.0 MiB   2700
13	          1928859648      1953523119      11.8 GiB   2700	Microsoft recovery part

[email protected]:~$
```


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

here above I don't remember clearly but I think,
the two partitions of 18.6GB were for ROOT and HOME;
the one of 14GB was for SWAP;
the one with 4.7GB was for some BOOT... something (It was suggested to be of 1MB though)

Hope this helps...

i read on internet that...
code 8200 is for SWAP, 8300 for linux filesystem, EF02 for BIOS BOOT partition


----------



## hal8000 (Dec 23, 2006)

*Re: Linux in Legacy mode, grub rescue*

That is a very messy partition scheme.
Before you do anything else, can you boot into windows 8 and tell me how many drive letters you see. There will be a C: drive, perhaps D: and E:

Do you need to recover anything from Ubuntu?
We never radvocate creating a /boot partition, its not necessary on modern distributions and
/swap size you are ok with 1G even with 4G of memory, but thats not important at the moment.
Out FAQ has suggestions on partitioning:

http://www.techsupportforum.com/forums/f64/linux-faqs-and-guides-645711.html


If you can let me know what drives you see in windows first and if you need to recover anything from Ubuntu before I advise you further.


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

In windows I can see... C drive of 698GB and E drive of 156GB.
I don't want any backup of linux. I have not used it much.
But I want windows safe, as I don't have a recovery disk for windows...


----------



## hal8000 (Dec 23, 2006)

*Re: Linux in Legacy mode, grub rescue*



Shashank M said:


> In windows I can see... C drive of 698GB and E drive of 156GB.
> I don't want any backup of linux. I have not used it much.
> But I want windows safe, as I don't have a recovery disk for windows...
> 
> ...


Your C: drive is GUID partition 5, and E: drive is GUID partition 7. I would suggest that partition 6 is a backup and 13 is also a recovery.

You need to resinstall Ubuntu again, but at the partition screen choose custom (option is called *something else* )
You then need to manuallly select 3 partitions as /, home and swap.
You need to be very careful here and select partition 8 as /, 9 as /home and 10 as /swap
and install grub as before in the mbr.

If you are at all unsure, then it would be better to seek out a local linux group in your area.
You managed to install it once before so decision is yours.

However, I would strongly suggest backing up your own dat, bookmarks, files etc to a CD
or memory stick before you begin. As you have no receovery disk it will not be possible to reinstall windows if you mistakingly choose wrong partition, which is why I suggest a linux user group, search on google if you have one near you.


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

Thanks... I'll do it myself...
But am not clear with 1 thing.
should I first format the existing root, home and swap partitions so that they form the free space,
And then follow the exact way I did during 1st time install ??
or keep those 3 partitions as they are ?


----------



## hal8000 (Dec 23, 2006)

*Re: Linux in Legacy mode, grub rescue*



Shashank M said:


> Thanks... I'll do it myself...
> But am not clear with 1 thing.
> should I first format the existing root, home and swap partitions so that they form the free space,
> And then follow the exact way I did during 1st time install ??
> or keep those 3 partitions as they are ?


As long as you know the partition number there is no need to format as during the install at the partioning stage there is an option to tick the box to format the partition.

Just take things slow and you should be ok. No one installs linux once, the first time is the most difficult, you will find it easier this time, but just make sure you select correct partitions.
I always have a list, on paper, of partition number, start and end sectors and UUID of the partition, this way it makes it easy to keep track of things.


----------



## Shashank M (Jul 19, 2010)

*Re: Linux in Legacy mode, grub rescue*

Installed successfully... Thanks 
But I would like to know a few things...
First is,
If I ever update windows and get the same problem with ubuntu, OR end anyhow at "grub rescue >", should I follow this same procedure ?
Another thing is,
How to resize the ubuntu partitions like root and home (if I have free space on HDD) ?


----------



## hal8000 (Dec 23, 2006)

*Re: Linux in Legacy mode, grub rescue*



Shashank M said:


> Installed successfully... Thanks
> But I would like to know a few things...
> First is,
> If I ever update windows and get the same problem with ubuntu, OR end anyhow at "grub rescue >", should I follow this same procedure ?
> ...



If you update windows, you should not have a problem. However if you upgrade, like changing from 8.0 to 8.1 then these upgrades probably will upgrade the windows boot loader and wipe out Ubuntu.
In this case you need to follow the same procedure.

Resizing partitions is always dangerous because there could be data loss. The time to resize is when you install (or reinstall), this involves deleting the partition or partitions then creating a new one.

Resizing a partition can not be done whilst it is in use, you must do this from the live CD, plenty of pages on google, such as:

partitioning - How can I resize an ext root partition at runtime? - Ask Ubuntu

I'll mark this thread as closed if you are happy. You can always start a new thread with another topic.


----------



## Shashank M (Jul 19, 2010)

Okay... marked as solved... Thanks


----------

