Tuesday, 12 July 2016

Install Dual Boot System (Windows10 and Ubuntu14.04 Ubuntu 16.04) UEFI, Legacy, bcdedit, etc..

----------
2017 July 06
Original Title: Install Dual Boot System (Windows10 and Ubuntu14.04) on a SONY VAIO laptop

Recently I am teaching ROS in China for the spark program. The dual boot system is critical but it gives many problems. I try to gather different info about this.
----------

If you are looking for a general guidance for dual boot system installation, checkout this
http://www.everydaylinuxuser.com/2014/05/install-ubuntu-1404-alongside-windows.html

I cannot remember how many times I have been installing ubuntu on a windows PC to realize a dual boot system for ROS. However, seems every time I would encounter some silly frustrated problems. Pity that I did not write down all the details how I solved the problem previously, now I wish to keep this post in very detail when there are problems in installing ubuntu and ROS. This post should be actively maintained.


Install Ubuntu 14.04 on a Pre-installed Windows 10 PC 


2016 Jul 12
I want to install ubuntu14.04 on a SONY VAIO laptop T series with NVidia graphic card. The OS is Win10 upgraded from win8.1, all the partitions for recovery or backup are never modified.

Normally just follow some common tutorials and the system can be boot to ubuntu grub menu. However this time I have no luck.

As usual, I have downloaded a Ubuntu 14.04 ISO file from the official website, created a bootable usb thumb drive, emptied one of the partition, and boot from USB device. FIRST ISSUE - Ok, for my laptop, DEL or any Funtion keys won't take me into BIOS setup... Simply press ASSIST during power off instead of press the power key, you will have an option to access bios setup. EVERY laptop is different, find your own way to do that.

Installing ubuntu...

However after restart, the familiar grub does not appear. The system directly enter Windows 10. Tried many ways but no use. Changed to boot from legacy mode and OPERATING SYSTEM NOT FOUND! Sure no operating system found because both of my OS are installed in UEFI mode. And in the BIOS settings, in UEFI mode, the system cannot detect the UEFI options as some other BIOS do.

After searching for some posts, we conclude that we should use bcdedit to change the start sequence. (Some suggest use EasyBCD, I can add a new entry and see the NeoSmart Ubuntu option when UEFI boot up but it cannot enter ubuntu, giving some bcd errors. I suggest bcdedit as we know what happened behind the scene)

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi
Some one suggest that we should change the boot manager path to these two files. For this sony notebook both do not work. Pay attention in Windows 10 we should use
bcdedit /set '{bootmgr}' path \EFI\ubuntu\grubx64.efi
bcdedit /set '{bootmgr}' path \EFI\ubuntu\shimx64.efi
And I unlocked the efi partition, I have these files there.

So I made a quick decision, reinstall ubuntu, in LEGACY BIOS, and it works, now I can simply choose my OS through change the bios settings. UEFI to win10 and legacy to Ubuntu. Next will try change legacy mode ubuntu to UEFI, will post here if works.

One more thing, EasyBCD 2.2 ruined my windows boot system after I tried many combinations(add and delete entries, finally crashed). Not sure if version 2.3 works well, but it seems safer because it disabled many settings. Repair the bcd using a newly created win10 bootup usb device.
Here is the error code and solution.
error code: 0xc0000098 Missing file: /bcd
solution from this post.
http://answers.microsoft.com/en-us/windows/forum/windows8_1-update/error-code-0xc0000098-missing-file-bcd/a5e0d28d-1e25-4ebd-836a-eb8656f41579?auth=1

key steps, enter prompt shell and repair bcd using the command lines:

BOOTREC /SCANOS
BOOTREC /FIXMBR
BOOTREC /FIXBOOT
BOOTREC /REBUILDBCD


---------
UEFI and Legacy BIOS
I was aware that UEFI is a newer version of firmware, but I did not pay attention to the difference of UEFI and traditional BIOS. Many mistakes are due to the lack of knowledge of UEFI. checkout this link:
http://askubuntu.com/questions/221835/installing-ubuntu-on-a-pre-installed-windows-10-with-uefi
You will find it useful if you encountered pitfalls during making dual boot system.

Future work

Next, will be install ubuntu 16.04 on a win10 pc, should be much easier according to the post above.

And, install ubuntu on all kinds of embedded systems, smartphones, etc.

----------
2017 July  06

Today I tried to install the ubuntu 14.04 on a lenovo x260.
There are many options in the Bios to configure the boot sequence and mode. After many testing, we found that the live cd can only boot in legacy mode.

check this post which mentions
https://ubuntuforums.org/showthread.php?t=2309806

I think the following paragraphs are quite clear and should be read carefully.

On a machine with a UEFI boot system and Windows 10 pre-installed or upgraded from Windows 8.1 it is most likely that Windows 10 will be installed in EFI mode. That means we should run the Ubuntu live session in EFI mode and then Ubuntu will be installed in EFI mode. Whatever mode one OS is installed in (EFI or BIOS/Legacy) the other OS must also be installed in. If we do not do that then we will only be able to load one of the 2 OS.

If Windows is installed in EFI mode and the Ubuntu live session is running in BIOS/Legacy mode, then we will only get the option to Erase disk & install Ubuntu or Something Else. No offer to install alongside.

If Windows 10 is installed in EFI mode then the Windows installer will have created an efi boot partition for the Windows efi boot files. The Ubuntu installer when installing Ubuntu in EFI mode will make use of the existing efi boot partition to put the Ubuntu efi boot files in and it will do that without over-writing the Windows efi boot files. And sda1 will be the efi boot partition.

I am guessing that the Ubuntu live session is running in BIOS/legacy mode. If it is running in efi mode then there can only be one place to install the Ubuntu boot loader efi files - sda1

So we cannot leave the "device for boot loader installation" option to the default setting, because the system does not boot in UEFI mode. We need to find the partition with efi format. Not tried yet.

No comments:

Post a Comment