windows 10 and ubuntu dual boot [closed]

Solution 1:

Let me write about some of problems to help other people who might encounter the same issues.

My computer came with Windows 8 pre-installed so I shrunk the Windows partition to make room for Ubuntu. That it how it works for the last year.

After the second reboot in Windows 10 upgrade the computer did not boot any more. The 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 was no longer where grub expected it. I don't know how and why this happened.

First what you can do is to see the partitions in grub rescue with "ls". Mine were (hd0,gpt1), (hd0,gpt2), etc. Try to find out which partition is your boot partition. I tried the following commands until i found the right partition:

ls (hd0,gpt1)/

ls (hd0,gpt1)/boot

ls (hd0,gpt2)/

etc.

Then type set in grub rescue prompt. It will display where the grub looks for its files. In my case (hd0,gpt6) has moved to (hd0,gpt7). The set command displayed:

prefix=(hd0,gpt6)/boot/grub

root=hd0,gpt6

Change the prefix and root settings to point to the right partition. In my case commands were:

set prefix=(hd0,gpt7)/boot/grub

set root=(hd0,gpt7)

Then switch from rescue to normal mode:

insmod normal

normal

You should get the normal grub menu. From now on 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 will 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 corrected the /boot/grub/grub.cfg where I replaced (hd0,gpt6) with (hd0,gpt7) and performed sudo grub-install.

Now it was only the encryption. Since the root Ubuntu partition was raised for one (7 from 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 they were changed.