8

I run dual boot Ubuntu and Windows on my machine. Last night Windows started installing some updates and it stated the machine would restart a few times during the updates.

Well, after the first restart it brought up this GRUB rescue screen, and it seems my machine can't find the Ubuntu partition. I start to think Windows may have destroyed it by updating.

In all other threats I've found so far it says to execute the 'ls' command to find all partitions and the 'set' command to see what GRUB has set up.

ls returns:

(hd0) (hd0,msdos5) (hd0,msdos2) (hd0,msdos1)

OK, set returns:

cmdpath=(hd0)
prefix=(hd0,msdos7)/boot/grub
root=hd0,msdos7

Now I understand this is wrong. The solution would be to ls every partition until the Ubuntu one is found. I tried this by doing ls (hd0,msdos#)/ where # is one of the numbers shown by ls. All of the commands return:

error: unknown filesystem.

I also tried adding boot/grub and combinations to the command, but nothing works.

Now, my next plan is to get a Ubuntu live USB using somebody else's computer, but I can't right now.

What is wrong here? Is my hard disk drive broken? Did the uncompleted update break it? Is there another solution?

Tijmenh
  • 83
  • Ah... the notorious Windows 10 Anniversary Update. Your idea about seeing what's left using the Ubuntu Live DVD is a good idea. Your problem probably came up because your GRUB is always set to boot Ubuntu, and as you note, Windows wants to reboot itself... then it'll probably do a nasty and overwrite your GRUB with a standard Windows Boot Loader. For now, try and reboot into Windows to try and let the Windows update complete. Monitor any reboots, and choose Windows each time, until the update completes. Then you may have to worry about reinstalling GRUB using boot-repair. Cheers, Al – heynnema Aug 26 '16 at 19:02
  • Alright, thanks for the answer. I'll have to note I had windows 10 installed already. It were just 'updates'. Also I can't get past the grub rescue. I can reach the bios but after that it shows the grub rescue, so I don't know how to boot into windows to finish the update. – Tijmenh Aug 26 '16 at 19:12
  • Do you have either a Windows installation disk, or, Ubuntu Live DVD, or can get access to boot-repair on USB flash drive or CD? Search here on AskUbuntu for boot-repair, and see other posts about how to install and run boot-repair from the Ubuntu Live DVD. Cheers, Al – heynnema Aug 26 '16 at 19:32
  • I've made a live USB now, I tried boot-repair but no results. I used Lilo to bypass grub and boot directly into windows. Finishing the update now. EDIT: Also used gparted and found out the Ubuntu partition is still there. – Tijmenh Aug 26 '16 at 21:03
  • Sounds like we're making progress! Once/if you're able to boot into Windows, then boot-repair might work for you to restore dual-boot functionality. ps: Does the Ubuntu partition show up as EXT4, or something else? Cheers, Al – heynnema Aug 26 '16 at 21:11
  • This is weird. I just finished the update and tried boot-repair, without result. Now I see in gparted my sda3 (the Ubuntu partition) doesn't show how much it uses (neither how much it doesn't use..). Using the command lsblk doesn't show sda3 at all. What's wrong? The partition is of the type 'extended' so it says. – Tijmenh Aug 26 '16 at 21:40
  • type extended is just a partition enclosure. Your Ubuntu partition should show as EXT4. Post a screenshot of gparted for me to see. Did boot-repair reinstall GRUB for you so that you can boot Windows from it? Cheers, Al – heynnema Aug 26 '16 at 21:44
  • I'm sorry, I was busy with something else. I used Lilo to boot windows. After that I tried boot-repair but it didn't work. (Or do I somehow have to disable Lilo?). In the log from boot-repair it said 'using Lilo' or something. This is the log: http://paste2.org/p4Vb1fJ9 and also a screenshot from Gparted and the lsblk comment: http://imgur.com/5hvxT41. sda1 is windows and sda3 is (or.. should be) ubuntu. – Tijmenh Aug 29 '16 at 21:44
  • Ah... the gparted screenshot told me what's up. Ubuntu was /sda4 which currently shows as ~93GB of unallocated space! I've got 3 ideas on how you might recover. Lets try the first one... start gparted, highlight where sda4 is supposed to be, go to Device/Attempt Data Rescue and see what it does (I've never used this one myself). If it tries to make it into a EXT4 partition, that's good. If it tries to recover files, we don't want to do that. The other two ideas involve download some free tools in Windows. I'll start another comment with that info. Cheers, Al – heynnema Aug 29 '16 at 22:18
  • In Windows, download the free versions of EaseUS Partition Manager and/or AOMEI Partition Assistant. These both claim to have partition recovery tools that might also work. Be careful, because if you try and recover one way, other ways may not work. Let me know. Cheers, Al – heynnema Aug 29 '16 at 22:21
  • Thanks a lot, I tried the Gparted data rescue but it says it needs Gpart installed. I tried sudo apt-get install gpart but this doesn't work. A quick google search didn't help me either. Any suggestions or should I move on with the windows programs? – Tijmenh Aug 29 '16 at 22:45
  • You probably have to do a sudo apt-get update, then sudo apt-get install gpart. If that doesn't work, start synaptic, click the RELOAD icon, then search for gpart, and install it. Let me know. Cheers, Al – heynnema Aug 29 '16 at 22:59
  • Alright, got gpart installed after generating a new sources.list file. I get the following message while doing the attempt data rescue: No file systems found on /dev/sda - The disk scan by gpart did not find any recognizable file systems on this disk. – Tijmenh Aug 29 '16 at 23:17
  • Lets try the Windows tools. To be honest, I don't hold up much hope for recovery, as the partition is shown as unallocated, not raw, or some other such. You may just have to reinstall Ubuntu, and hope you have backups of your files. Keep us posted. Cheers, Al – heynnema Aug 30 '16 at 01:15
  • I've downloaded EaseUS Partition Manager. It has data recovery, but the thing you said about recovering one way might cause another way to fail kind of spooks me. Do you recommend one of the tools? Also if the data is unrecoverable that's okay, most of the files I have somewhere online or backed-up. I only used ubuntu for programming so no real harm done. Only thing which makes it annoying is that I have to install and set-up everything again. – Tijmenh Aug 30 '16 at 16:58
  • Go ahead and try the EaseUS tool. If it can't do the job, then just delete partitions sda5 first, then sda3, and install Ubuntu "along side" of an existing Windows installation. Cheers, Al – heynnema Aug 30 '16 at 18:32
  • Hm, no success. All it can recover is 10mb. Ok, I guess I'll have to reinstall ubuntu then. Thanks a lot for the help anyways! :) – Tijmenh Aug 30 '16 at 21:41
  • Will do, unfortunately I can't vote because I don't have 15 reputation yet. – Tijmenh Aug 31 '16 at 12:48

2 Answers2

20

I had a very similar problem.

I dual boot Windows 10 and Debian (BunsenLabs), and if it is relevant then I use the (U)EFI BIOS system. Here is how I solved the problem.

Yesterday, I opened Windows for first time since summer, and it needs to install updates and to reboot and at second reboot I get the GRUB rescue prompt.

error: unknown filesystem
grub rescue>

ls gave: (hd0) (hd0,gpt6) (hd0,gpt5) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)

In order to find a filesystem GRUB rescue could recognise I run through ls (hd0,#) where the hashtag is a number between 1 and 6 (note: one can leave out the "gpt"-part and probably also the "msdos" part if you use the old partition table).

It turns out gpt5 is my home partition and gpt4 is my Debian root partition. None of the other partitions had a filesystem that could be recognised (by GRUB rescue).

I now followed Carla Schroder's "How to rescue a non-booting GRUB 2 on Linux" guide. At the end of the guide she provides commands to boot from GRUB rescue. Notice when reading the guide, that at first she addresses the problem of booting from the normal GRUB prompt - that is not the rescue prompt, which is relevant to us, so read past that part, and you'll get to the rescue prompt.

Since my boot partition is gpt4, I ran the following commands:

set prefix=(hd0,4)/boot/grub
set root=(hd0,4)
insmod normal

The last one made the font of the prompt change a bit, and then the command

normal

which started the my normal GRUB 2 graphical boot menu. The guide didn't say anything about that, that would happen... but it worked splendid. I choose the Windows booter, and the update install continued. It rebooted another time, and sent me back into the GRUB rescue prompt, and I repeated the procedure, again choosing to boot Windows, and this time the update installation finished.

Now reboot manually (when the Windows update have been configured). Again I get the GRUB rescue prompt and I repeat, but this time in the graphical boot menu I choose my Linux (BunsenLabs), and when I have logged in I open a terminal and still following Carla Schroder's guide, I did

sudo update-grub

which finds my Linux image and the Windows boot manager, and then I did:

sudo grub-install /dev/sda

Finally I reboot again to check that everything works. I now directly get the graphical GRUB boot menu and both Linux and Windows can be chosen.

I hope this will be helpful, if anyone experiences a similar problem.

Eliah Kagan
  • 117,780
daniel
  • 201
  • 1
  • 3
  • 2
    Thank you @daniel... thank you thank you thank you!!! – atreeon Jan 07 '19 at 13:16
  • This worked perfectly for me dual booting Linux Mint 19.1 and Windows 10, after updating to 1809. In my case, the only filesystem recognized was (hd0,msdos4) as ext2. – John B Mar 24 '19 at 21:06
  • 2
    This should be the accepted answer. – Luca D'Amico Jun 10 '19 at 14:39
  • @LucaD'Amico The first two comments come from users other than the original poster. What (may have) worked for them may not apply to the original poster's problem. And, if you note, John B problem also occurred after a major Windows update, and that their Ubuntu partition had been changed to ext2. Either testdisk or Ubuntu reinstall would fix that kind of problem... not a GRUB reinstall. – heynnema Jun 10 '19 at 15:50
  • As I said in your answer, I was able to recovery my system using these steps after the windows 10 may 2019 update. – Luca D'Amico Jun 10 '19 at 16:22
  • @LucaD'Amico The reason that this may have worked for some users is that they had GPT partition tables. The OP had an MBR partition table... and that's where the Windows updater bug comes into play... on major Windows updates... on MBR disks. Different problem. Different fix (maybe). – heynnema Jun 10 '19 at 16:26
  • If old BIOS/MBR and major update to Windows, it will not rewrite partition table to include Linux logical partitions. Parted rescue seems easier than testdisk https://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition & https://askubuntu.com/questions/654386/windows-10-upgrade-led-to-grub-rescue/655080#655080 – oldfred Jun 10 '19 at 19:59
  • Using an old thinkpad with a manjaro install that I hadn't turned on in years, this worked flawlessly. Amazing – sonarforte May 25 '20 at 12:51
  • You have saved my life. – joaofbsm Nov 23 '20 at 22:50
1

Major Windows updaters have a bug that changes Linux partition types on MBR disks. Either use testdisk see how to here to fix your MBR partition problem, or a full Ubuntu install would be needed to fix the problem in this case.

heynnema
  • 70,711
  • 1
    Nope, an ubuntu reinstall just to fix an issue with GRUB is not what is needed. Check Daniel answer for a full fix. – Luca D'Amico Jun 10 '19 at 14:39
  • @LucaD'Amico Never mind that this is a three year old answer... if you read the comments, you'd see that a major Windows update changed the linux partition from ext4 to some other partition type, and that's why Ubuntu no longer boots. It's a known Window updater bug. It's not a GRUB problem, or something boot-repair can fix. Three years later I can say that testdisk might be something to try instead of a reinstall, but it's a very technical tool that requires intimate knowledge of disk partitioning to use properly. You can remove your down vote please. – heynnema Jun 10 '19 at 15:32
  • I got this problem after updating my windows installation (may update), and yeah it changed my partition from ext4 to ext2 (or at least that's what grub recovery shell told me). I was able to fully recover my system by following the Daniel's answer. No testdisk needed. So yeah, I can remove the downvote but still your answer is clearly wrong. I repeat: after windows 10 May 2019 update, grub failed to find partition (it saw my ext4 partition as ext2), but after following Daniel's answer I fully recovered my system and I have NOT used testdisk. – Luca D'Amico Jun 10 '19 at 16:19
  • yeah I have GPT. Okay, so if you specify that a full reinstall may be needed for users with MBR partition table (and not GPT), I can remove the downvote. – Luca D'Amico Jun 10 '19 at 16:30
  • @LucaD'Amico Yes, for MBR disks, testdisk or reinstall. – heynnema Jun 10 '19 at 16:31
  • @LucaD'Amico I just edited the answer to make it more applicable. – heynnema Jun 10 '19 at 16:33