I was dual-booting Windows 7 and Linux Ubuntu on my desktop, and today is the day they gave out free Windows 10 upgrades. How exciting! I got the update, and it was installing, and I left to go take a 30 minute nap. However, when I came back to my computer, it led me to the grub rescue prompt.
error: no such partition.
Entering rescue mode...
grub rescue>
I get the following when I type ls
:
grub rescue> ls
(hd0) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)
After a quick look through of people who encountered the grub rescue prompt, I typed set
and got the following
grub rescue> set
cmdpath=(hd0)
prefix=(hd0,msdos6)/boot/grub
root=hd0,msdos6
I was still kind of lost after finding that certain commands like normal
didn't work, and then I found a video tutorial where you boot from a Linux image cd and run some commands on the terminal. Luckily, I had my CD with me, and booted from there. When I typed sudo fdisk -l
into the terminal however, this is what I got:
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc03ede74
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 206848 1547022335 773407744 7 HPFS/NTFS/exFAT
/dev/sda3 1547022336 1547943935 460800 27 Hidden NTFS WinRE
/dev/sda4 1547945982 1953521663 202787841 f W95 Ext'd (LBA)
/dev/sda5 1915731968 1953521663 18894848 7 HPFS/NTFS/exFAT
Says here none of my devices has the Linux system in them! And I couldn't follow the video tutorial any more than that…
I teased my brain a little and determined that sda2 contained my Windows system (since I remember my C: drive has around 700-ish GB of space). After thinking a little bit more, I remember assigning around 200-ish GB of my hard disk space to something that's Ubuntu related when installing Ubuntu. I don't exactly remember which, but I think it was basically Ubuntu "hard disk space", and it didn't have any boot files in them. I assigned two other things for linux, but they were very small in size (not breaking the 1 GB mark yet).
So, can anyone here help me out get my upgrade back on track? I won't mind if I end up having to completely remove the partitions that have Linux in them.
Best Answer
My computer came with Windows 8 pre-installed so I shrunk the Windows partition to make room for Ubuntu. That is how it worked for the last year. After the second reboot in Windows 10 upgrade the computer did not boot any more. GRUB only displayed a
grub rescue
command prompt. I found out later that the problem occurred because Windows somehow changed the partition scheme. The boot partition (containing normal GRUB data) was no longer where GRUB expected it. I don't know how and why this happened.The first thing that you can do in the rescue mode is to see the partitions with the
ls
command. Mine were:Try to find out which partition is your boot partition. There is no Tab completion, you have to type it out completely. I tried the following commands until I found the right partition:
etc.
Then type
set
in the same prompt. It will display where GRUB looks for its files. In my case (hd0,gpt6) has moved to (hd0,gpt7). The set command displayed:To get back into normal GRUB, start by changing the
prefix
setting to point to the right partition. In my case the command was:Then you can switch from rescue to normal mode:
One could also have fixed the
root
setting with:But this is not strictly necessary, as it doesn't matter for Windows chain-load entries. Once in the normal GRUB menu, you can boot Windows and finish your Windows upgrade. The problem is that you have to tell grub rescue about the right partitions on every reboot. That is how I did it. I left the problem of GRUB for later because I was not sure whether Windows would do some more changes to the partitions or boot.
When Windows finished I started to solve GRUB problems. Press
e
to edit boot options for Ubuntu. I changed all(hd0,gpt6)
to(hd0,gpt7)
and Ubuntu booted.However, I use encrypted partition and cryptswap. At the boot Ubuntu asked me for the passphrase. Fortunately I saved it at the installation of Ubuntu and entered it at the boot. Ubuntu booted without problems.
I then corrected the
/boot/grub/grub.cfg
file where I replaced(hd0,gpt6)
with(hd0,gpt7)
and performed:At that point the only remaining issue was the encryption. Since the root Ubuntu partition number was increased by one (7 instead of 6), the swap partition suffered a similar change. I had to change the
/etc/crypttab
file to point to/dev/sda8
instead of/dev/sda7
.I am using only two partitions for Ubuntu (root and swap). If other operating systems coexisting with Windows use more partitions there might be more changes required. Especially if partitions are mounted according to their numbers and not by their UUIDs. Take a look at your
/etc/fstab
. If the partitions are identified by UUID there should be no problems. But if there are/dev/...
lines the number should be corrected if these partitions had been renumbered.