1

I am quite new to Ubuntu and I have a problem. I have an Acer Aspire E5-573-P5AB and I had Windows 10 installed on it first. Then I installed Ubuntu 16.04 or 16.10 LTS. I can't remember which one.

Since I upgraded Ubuntu to 17.10, Grub decided to try booting Windows 10 from /dev/sda1, which is the recovery partition of Windows 10 instead of /dev/sda2, which is the main partition of Windows 10, and when I try to boot into Windows 10 I see the background color of grub and some glitchy lines on the screen, and then the laptop restarts in grub.

In order to boot in Windows 10 from grub, I have to highlight Windows 10 on Grub boot screen and edit the command to change hd0,msdos1 to hd0,msdos2. This is very annoying!

Also note that I used sudo update-grub several times and it still detects Windows 10 on /dev/sda1 instead of /dev/sda2. Can anybody help me? I am new and I don't know what to do! Also note that both OSes are installed in BIOS, not UEFI.

Here's my pastebin from Boot Repair

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • This sounds like GRUB is treating WinX like it is 7, where there was a boot partition on /dev/sda1. –  Dec 02 '17 at 15:49
  • 1
    Was boot flag on sda1 when you installed Windows 10 to sda2? Then Windows would put bootmgr & BCD on sda1. And grub2's os-prober only looks for bootmgr & BCD files to know which Windows partition has boot files. You may be able to copy bootmgr & BCD from sda1 to sds2 and edit sda2's BCD to only boot Windows 10. Then rerun sudo update-grub. You then should have two entries but one will be correct. – oldfred Dec 02 '17 at 16:39
  • @oldfred The hard disk was empty when I installed Win10, so it created 2 partitions, the recovery one and the main one, so I don't know which one had the boot flag set. – Alin Stanescu Dec 04 '17 at 16:25

1 Answers1

0

There are a number of tools you could try using. Boot Repair is one. Grub Customizer is another tool that comes to mind. However, since update-grub isn't working as advertised, it sounds like something is wrong with your partition flags on /dev/sda2 as the aforementioned script should generate menu entries for all bootable partitions regardless of OS or version thereof. Although it's not usually recommended, you could manually edit /boot/grub/grub.cfg

Find the menu entry that you've been editing at boot time to change hd0,msdos1 to hd0,msdos2 since you say that works. you can locate the specific line so that you can recognize the block you'll be editing with cat /boot/grub/grub.cfg | grep -A11 /dev/sda1 change every reference in that block between the curly braces from hd0,msdos1 to hd0, msdos2 there should be 3 of these. you may be able to get away with just changing the set root= part. You may also wish to change the menu entry title reference where is says on /dev/sda1 to on /dev/sda2 to avoid confusion later on.

The problem with the above approach is the next time you grub is updated it's likely to revert to the same behavior you are seeing now. It sounds like the root cause is something is wrong with the the grub configuration scripts or os-prober. the command sudo apt install --reinstall grub-common should resolve that and result in update-grub working as advertised.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • Hello! I tried the last command you suggested since the first one just printed the lines when run in Terminal, and sudo update-grub still detected Windows 10 on /dev/sda1. Then I ran Boot Repair and now when I run update-grub it does not detect Windows anymore, and Grub Customizer can't help since it doesn't find Win. Before trying anything I installed Gparted and and set the boot flag on /dev/sda2 then ran update-grub and still the same. Here's the pastebin from Boot Repair, if it helps http://paste.ubuntu.com/26112901/ This is slowly becoming a nightmare... Thank you for your help! – Alin Stanescu Dec 04 '17 at 16:19
  • According to your pastebin report, your partition table is screwed up "Partition 3 does not start on physical sector boundary." Further complicating the issue is "Unknown BootLoader on sda3" I've reviewed your grub.cfg from http://paste.ubuntu.com/26112901/ and there's no sign of a Windows 10 menu entry so I'm not sure what you were editing to get it to boot but it's not there now. – Elder Geek Dec 04 '17 at 18:07
  • First, I had to change from sda1 to sda2 in order to boot in Windows 10. Now it's like Windows doesn't even exist. So what do you suggest? Formatting the HDD and installing Ubuntu first then Windows 10? Because what you're saying sounds really bad to me. – Alin Stanescu Dec 04 '17 at 22:39
  • A lot depends on whether you have critical data on the system. If you do you and have some recollection of what the partition layout was originally you may want to try to fix it utilizing testdisk as discussed in my answer here or one of the data recovery options like SystemRescueCD or parted. Re-installation is always an option of last resort, but always install Windows first, never last. Ubuntu will typically keep your existing OS's. Win, NO! – Elder Geek Dec 06 '17 at 03:30
  • I remembered that I have a GRUB disk somwhere and decided to give it a try but I didn't see any Win entry, so it didn't help. Testdisk found 4 Win partitions but 2 of them seem corrupted, so I don't know what to say. I had a backup option in boot repair but I didn't use it because I am just soo stupid... So it seems that I still have Windows somewhere on the HDD, but is inaccessible. The things that keep me on Win are the tools to repair my phone when I break it and MS Office, because I can't get used to Libre and I can't get Office installed on ubuntu, not even on wine. Idk what to do – Alin Stanescu Dec 07 '17 at 13:37
  • If you are working with a forensic image or copy of the drive as suggested here you have nothing to lose by recovering those Windows partitions that remain uncorrupted. If all this is beyond your skill set you may wish to seek an IT professional in your area to assist you as any qualified professional should be able to resolve this issue for you, given physical access to the system. – Elder Geek Dec 07 '17 at 16:01
  • Can't I just format the whole HDD and install Win and Ubuntu all over in UEFI mode? Or delete the win partitions and install win in a vm and try to live with it? But if I do that, can I reflash my S7 phone when sth goes wrong with it and run MS Office properly in a vm or do I have to install Win on the HDD to do these 2 things properly? Because these are the only things keeping me on Windows right now – Alin Stanescu Dec 08 '17 at 16:43
  • As I said in my previous comment a lot depends on whether you have critical data on this system. If not, there's absolutely no reason you can't install dual boot from scratch. If you have other questions regarding windows I recommend superuser.com where such questions are on topic – Elder Geek Dec 08 '17 at 21:21