0% found this document useful (0 votes)
59 views5 pages

Install Ubuntu Dual Window

The document provides steps to install Ubuntu 15.04 on a Sony Vaio laptop that has Windows 7 pre-installed. Key steps include: 1) Shrinking the Windows partition to make space for Ubuntu; 2) Installing Ubuntu in the freed up space; 3) Updating GRUB to locate the Windows boot file; 4) Backing up and renaming the Windows boot file, then copying the GRUB file to the location to trick the computer into loading GRUB.

Uploaded by

Thành Công
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views5 pages

Install Ubuntu Dual Window

The document provides steps to install Ubuntu 15.04 on a Sony Vaio laptop that has Windows 7 pre-installed. Key steps include: 1) Shrinking the Windows partition to make space for Ubuntu; 2) Installing Ubuntu in the freed up space; 3) Updating GRUB to locate the Windows boot file; 4) Backing up and renaming the Windows boot file, then copying the GRUB file to the location to trick the computer into loading GRUB.

Uploaded by

Thành Công
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

After numerous attempts to solve this issue I finally resolved it with a few tips from various sources.

First of all, I appreciate everyone's help in attempting to solve this issue. None of the answers worked
directly but they all helped me in finding a solution to the problem, so thank you.

Installing GRUB directly into the MBR of /dev/sda did not work because I believe Windows and Sony
did a very good job disguising how Windows actually boots on my machine. In the end I had to copy
the "grubx64.efi" file over the boot manager file for Windows. Here are the steps I took in order to do
this safely and efficiently. I will go through every step I took in installing Ubuntu incase anyone with
a similar issue needs a thorough answer.

Steps To Install Ubuntu 15.04 on a Sony Vaio S with Windows 7


NOTE: This Process should only be used if you feel that you have exhausted all other possible
options. This process will work but it requires renaming Windows boot files, which can be
dangerous if not done properly. I highly recommend backing up important information before
continuing.
1. Prepare Hard Drive for Ubuntu Install
 Boot into Windows
 If desired you can defrag your hard drive but this is not necessary
 Shrink your Windows Partition by the desired amount. I recommend deciding how much
space you would like for all your files and the install and such, and then adding the size of
your RAM to this amount.
 For a visual tutorial on how to shrink your partition click here
 Example: I wanted 50GB reserved for my Ubuntu system, and I have 16GB of RAM.
Therefore I shrunk my partition by 66GB. Windows calculates the shrink in MB
however, so you need to multiply your desired size by 1024. In my case, 66 x 1024 =
67584MB
 NOTE: If your current install does not already have a ESP (EFI System Partition) then I
recommend following another tutorial for your install. This tutorial specifically targets
installs on computers with an ESP causing boot problems because of Windows security
measures. Learn more about UEFI and ESP here
2. Boot Ubuntu from Live CD or USB
 When the GRUB menu shows up click "Try Ubuntu without Installing" If you are unfamiliar
with Ubuntu I recommend playing around for a little while to make sure this is something
you want to install. Mind the fact that everything will load very slowly considering you are
operating out of a CD or USB stick.
3. When Ubuntu is finally up and running click the logo on the Desktop that says "Install Ubuntu
XX.XX" with whatever version you are installing. In my case it was 15.04.
4. Click through the menu following the instructions (I recommend clicking on the install "3rd Party
Drivers" and "Install Updates" check boxes if you have a fast internet connection and especially
if you are installing on an SSD.

If you feel like having a quicker install then don't check these boxes as you can always do these
steps later.
5. IMPORTANT: When you reach the menu that says "Allocate Drive Space" you want to click
the option that says "Something Else" because this is where we set up your partitions that you
prepared for in Step 1.
6. Create Partitions:

 Create partition for the swap. Select the free space partition then click the plus button to the
lower left. Make the size equivalent to your RAM size, in my case it was 16GB (16384MB).
Select "Primary" for type of partition, "Beginning of space" for location and "swap" for use
as section. Note: The mount point option should disappear on selection of "swap". Click
"OK"
 Create partition for all your files and root. This is the main partition where all your files and
programs will be located. Select the free space, click the plus button to the lower left. Make
the size equivalent to the remaining free space you have (the editor should do this
automatically). Select "Primary" for the partition type, "Beginning of this space" for the
location, "Ext4 journaling file system" for use as and lastly select "/" (root) for the mount
point. Click "OK"

NOTE: There should be no more "free space" remaining. If you have some left over make
sure that all of your partition sizes add up to the total number of MB you shrunk windows by
in Step 1.
 IMPORTANT: When selecting the option for "Device for boot loader installation" you want
to select the same location as your "/boot" directory. Since this is an install on an ESP system,
your boot directory will be in the same location as the Windows Boot Manager.
In my case this was "/dev/sda3" but there should be a description saying "Windows Boot
Manager" or something of that sort so you know which device your ESP is on.

If there is no description in the installer, then open GParted and look in the Label section for
something describing a Windows Boot Manager, this is location you are looking for. Select
that device in the "Device for boot loader installation"
 Now Click the "Install Now" button in the bottom right. THIS IS THE POINT OF NO
RETURN. ONLY CONTINUE IF YOU ARE SURE YOU HAVE SET EVERYTHING
CORRECTLY
When the installation is finished DO NOT CLICK RESTART. Please click the "Continue Trying
Ubuntu" link and continue to Step 7.
7. Close all open programs and windows.

NOTE: In this section replace "/dev/sda3" with the device you chose for boot loader
installation at the end of Step 6.
Open the Terminal and do the following while making sure to read carefully and TAKE YOUR
TIME.

We need to determine where your Windows Boot Manager file is located. It is most likely going
to be in the path of "/EFI/Microsoft/Boot/bootmgfw.efi", as was mine, but we need to make sure.

The only way I know how to do this is by updating grub and letting it tell us where it found the
boot manager. Do this by typing the following, remembering to replace "/dev/sda3" with the
device you installed your boot loader into:

sudo mount /dev/sda3 /mnt


cd /mnt
sudo update-grub
The cd /mnt command is necessary in order to get into the directory where grub was installed
and it will also be useful later when navigating to different directories. The update-grubcommand
should spit something out like the following. This is what mine spit out:
jrichter@RICKY:~$ sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-22-generic
Found initrd image: /boot/initrd.img-3.19.0-22-generic
Found linux image: /boot/vmlinuz-3.19.0-15-generic
Found initrd image: /boot/initrd.img-3.19.0-15-generic
Found Windows Boot Manager on /dev/sda3@/EFI/Microsoft/Boot/bootmgfw.efi
done
Looking at the last line, the line before "done", we should see where the boot manager was found.
Mine says the Windows Boot Manager was found on /dev/sda3 at the
location /EFI/Microsoft/Boot/bootmgfw.efi This is the exact location of the boot file that is
called when your system boots normally, and this is what we need to replace.
NOTE: If you get an error updating GRUB or it does not find a location for the Windows Boot
Manager then you likely mounted the wrong device or you installed the boot loader onto the wrong
device during the installation period.
If everything ran without error and you now understand the file and location that Windows boots
from then we are ready to move on. For the remaining steps remember to replace the location in
which my boot file is located with the location of yours, although I would bet they are the same.

Continue by typing the following commands:

Go to the directory in which your boot file is located:

cd EFI/Microsoft/Boot
Copy the normal Windows boot file to a backup and a new file we are calling "bootwin.efi" that
we will set Windows 7 to boot to inside GRUB:

sudo cp bootmgfw.efi bootmgfw.efi.bkp


sudo cp bootmgfw.efi bootwin.efi
Copy the GRUB loader file over the normal Windows boot file. This is to fake your machine into
thinking it is loading Windows, but instead it will load the GRUB menu. Type the following:

cd /mnt/EFI
sudo cp ubuntu/grubx64.efi Microsoft/Boot/bootmgfw.efi
Change back to the main directory, unmount your boot loader device and reboot the computer.
Note that the command to unmount is called umount NOT unmount:
cd
sudo umount /dev/sda3
sudo reboot
8. After the the computer reboots it SHOULD boot into the GRUB menu.

NOTE: We are no longer using the Live CD or USB so make sure those are removed. If it does
not boot to GRUB then you have likely made a mistake somewhere along the road, or the file we
copied over ("bootmgfw.efi") is not actually the file called when Windows Boot Manager starts
up.
 If you encounter this error I recommend downloading rEFInd to a bootable CD. Insert the
bootable CD and start your computer. rEFInd should be able to see all boot files and give
you options to boot. I recommend going through these options until you find one that boots
Windows normally. Note: The file being called on boot is under the option selection in
rEFInd. Use this as the file in which to copy over with "grubx64.efi"
9. Once you have loaded the GRUB menu please boot into Ubuntu.

Note: If all steps were performed correctly, selecting the Windows Boot Manager option should
bring you back to the GRUB menu. This is because we copied over the file to boot Windows Boot
Manager with the file to boot GRUB.
10. Now that we are back in Ubuntu, open the Terminal and type the following commands:

Start an administrator terminal by typing:

sudo -s
This allows us to make root level commands without having to type sudo every time. Now type
the following to find the file in which to add a Windows entry to:

cd /etc/grub.d
ls
This should give you a list of files. Look for one that looks like "XX_custom" where XX is a
number, probably a multiple of ten. In my case it was "40_custom". This is what the file should
look like:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
Type the following commands to add a menu entry for Windows (replacing "40_custom" with
your appropriate file name):

nano 40_custom
Add a menu entry below all the comments (represented with a #).

NOTE: Replace 'hd0,gpt3' with the appropriate hard drive and device that your boot loader
is on (this is the same location as where you installed your boot loader on during installation
where gpt3 represents sda3 for example). Also replace the line after "chainloader" with the
same location you determined your Windows boot file to be in.
Now type the following, making sure the filename at the end is the filename we created earlier by
copying "bootmgfw.efi". I named mine "bootwin.efi":

menuentry "Windows 7" {


root='hd0,gpt3'
chainloader /EFI/Microsoft/Boot/bootwin.efi
}
Now Press "Ctrl-X" then Press "Y" and then Press "Enter" to save the changes. Make sure you
are in a sudo -s terminal otherwise you will not be allowed to make changes.
And lastly, we need to update GRUB with our new entry and reboot the system to make sure
everything works. Do this by typing:
update-grub
reboot
11. Upon your system booting, GRUB should load by default and you should see a new entry with
the name you gave it in the "XX_custom" file. In my case it says "Windows 7". Choose the
Windows option to make sure it loads properly, as it should boot Windows in the same way it did
before the install.
12. Reboot and confirm that the Ubuntu option still works.
13. Congrats! You are all done and if everything went correctly you have officially installed Ubuntu
on a machine with ESP alongside Windows. You can now dual boot the two best operating
systems out there :)

You might also like