[Guide] How to install Ubuntu on a Windows PC (aka Dual-Boot)

(Eric Perbos-Brinck) #1


This is a follow-up to the thread posted in the non-beginner section of Part1 v2.

Some of you may have a desktop Windows PC at home with an Nvidia GPU because you need it to frag opponents in Overwatch or PlayerUnknown’s Battlegrounds edit family pictures.

If you have a recent Nvidia GPU (not an AMD Radeon), then maybe you’d like to start using your PC to as a “DL rig”, aka a Deep Learning Workstation.

  • The first step is to verify that your Nvidia GPU is capable of running CUDA (an Nvidia platform using your GPU for computation). You can check it here.
    Most likely, you have a GTX card so check the GeForce Products tab.

  • The second step is to check that you both have decent RAM (8Gb is a really strict minimum, 16Gb is fine) and at least 100Gb available on your hard-drive: you want 20Gb to install Ubuntu, 32Gb as a Swap file (it extends your RAM) and 50Gb to install specific libraries/software + data files.

If at this stage, you don’t feel comfortable already, I suggest you don’t go any further because there’s always a risk that your system will crash and need a full Windows re-install.

Now if you’re used to installing new RAM bars, adding hard-drives, switching GPUs from Nvidia to Radeon and vice-versa, and re-installing Windows on your PC every second year because it became a sluggish snail due to bloatware/patches, then getting your PC into dual-boot Ubuntu/Windows is really a piece of cake: you’ve seen worse before :sunglasses:

  • The third step is to make sure (1) you have two USB drives/keys (with 8Gb capacity), to play it safe: one is for Ubuntu install package, and one is for -your current version of- Windows install package;
    and (2) either a secondary PC like a notebook or an Android/iOS tablet connected to your home WiFi network.
    Why ?
    Because when you dual-install Ubuntu on your PC, it will impact your Windows Boot Manager (as in “hijack it”: you now start with an purple Ubuntu loading screen asking to choose Ubuntu or Windows).
    As a result, if something goes wrong with Ubuntu (it can), you may end-up with an error message when starting your PC saying something like “Windows can’t find the Boot Manager”.
    That’s not a problem if you have the USB drive with the Windows install package AND can use your notebook/tablet on WiFi to search for “repair Windows Boot Manager”: the procedure is super simple, you’ll just need to reboot with the USB drive and use the Repair option.
    It will take 2 mins max to go from “cant’ find Boot Manager” to “Enter your Windows password” and restore your Windows PC as before. But having a tablet handy to search and read the procedure = peace of mind.

  • The fourth step is to use this guide.
    It was written for Windows 8 and Ubuntu 14.04 in 2016.
    Today in 2017 you probably use Windows 10 and want to install Ubuntu 16.04 (NOT version 17.04, too cutting-edge: many libraries used in Deep Learning are not compatible yet => stick to 16.04).
    So read this guide first, keep in mind “replace 8 by 10, 14.04 by 16.04”.
    Edit: updated guide for Windows 10

Once you’re comfortable, give it a try. There’s really nothing dramatic/insane about getting your PC into dual-boot.

Last tip: always back-up your important files (documents, pictures etc.) before doing this, just like you would when changing/upgrading your PC.

Next-step: getting your Ubuntu PC into a DL rig by installing the Python/CUDA/CudNN/TensorFlow/PyTorch combo.
@ekami is the boss there :cowboy_hat_face:

Edit: if you need to buy an Nvidia GPU, here’s a very popular post which explains the basics and more, plus has a TL;DR section focused on the current cards. Tim updates it regularly since its v1 in 2015.


Using my own GPU locally,TitanX
(Erin Pangilinan) #2

Thanks! Wish I had this much earlier hehe. I think I probably could have allotted more space even for VR stuff but under 100GB should be okay if i have other drives (SSHD 2TB, SSD 1TB, and other HDDs too).

(Tuatini GODARD) #3

Thanks @EricPB :slight_smile: . Here are my tutorials for the software/environment installation:
Part 1
Part 2

(Maureen Metzger) #4

Thanks, @EricPB and @Ekami, this is super helpful information!

My daughter has a Windows machine that I have been thinking of replacing; she does video editing/gaming/other GPU intensive activities. So I was thinking of getting something that could work for both of us – Windows partition for her to do her thing, Ubuntu partition for me to do DL. This post just made that idea seem a lot more do-able!

Only downside would be fighting over who gets to use the computer and when. :laughing:

(Jeremy Howard) #5

I’m pretty sure whoever provided the money for the machine gets first priority :wink:

(My 2yo doesn’t always see it that way however.)

(Maureen Metzger) #6

@jeremy just a head’s up, based on my n=1 time series experiment (13yo daughter), don’t expect your 2 year old’s perspective to change much on this point . . .

(Eric Perbos-Brinck) #7

Just added a link on “Which GPU for Deep Learning”.

(Eric Perbos-Brinck) #8

Added a link to an updated version for Windows 10, same author.

(Even Oldridge) #9

I did the same a little while back and I really enjoy the dual boot system. One thing to be aware of is that the upgrade to the fall creators edition of windows can wipe the linux boot selection or can make a different windows only boot loader the main boot partition.

Either make sure you upgrade windows first, or be prepared for some messing about in your bios to get your partitions back. Thankfully in my case they were just hidden rather than wiped entirely but I’ve heard of really bad cases where you lose your linux partition entirely.

(Sanyam Bhutani) #10

Can someone please share the instructions to setting up CUDA, CuDnn instructions on ubuntu?
I’ve tried a bunch of tutorials and ended up doing fresh installs repeatedly :frowning:

(Aseem Bansal) #11

I followed the guide till the end and ran the command via Powershell (Admin)

bcdedit /set "{bootmgr}" path \EFI\ubuntu\grubx64.efi

Now whenever I try to start the computer (with or without pressing Shift button) Dell’s recovery starts and it tells me that error is NO_BOOT. I tried letting the recovery run as I could not find how to get cmd to start without starting Windows to set the variable back to whatever it was. Now it is just telling me No bootable devices found. The variable got messed up, I guess.

So any idea how to change that variable back to whatever it was?

I have the USB for Ubuntu not windows. Was just lazy because the Windows came pre loaded and I never downloaded it. I am able to get the pen drive ubuntu to work by choosing the legacy mode instead of UEFI mode in boot menu and it can access all of my hard drives so they are ok. Can I do anything from there? I tried boot-repair but it says this is legacy mode and need to run in EFI mode

So I found out that I can open up the ubuntu that I installed by repeatedly pressing F2, turning off Dell support Assist, restarting and pressing F12 repeatedly and then selecting the Hard Disk on which I installed the ubuntu. My Windows is installed on a SSD and ubuntu is installed on separate hard disk. Able to get in the installed ubuntu. Seems I just messed up my Windows boot manager not everything so situation does not seem that bad. But I need my Windows machine too.

Just adding comments here just in case someone faces the same issue. If anyone has any idea how I can go about repairing Windows boot manager please let me know.

Called Dell Support. They told me will have to re-install Windows in Legacy mode. Downloading Windows 10 ISO image and making a bootable device.


Ideally, it would be better to have each OS on separate physical drives in your system so you don’t run into boot manager issues. If you are fortunate enough to have multiple hard drives, I would suggest keeping everything separate as I did. Here is a summary of what I did:

  1. Working Windows 10 install on existing SSD
  2. Open Machine, Install physical NVME drive for Ubuntu, unplug windows drive
  3. Boot from USB and install Ubuntu to new drive
  4. Shut down, plug in Windows drive, reboot.
  5. Run ubuntu and update GRUB to see the windows drive, reboot
  6. Select preferred OS for work.

Again, this setup allows me to keep everything separate between the two OS’s. Detailed steps can be inferred from here: http://linuxbsdos.com/2015/10/31/how-to-dual-boot-windows-10-and-ubuntu-15-10-on-two-hard-drives/

Not to thread hijack, but I hope to start a new thread showing how to setup V2 of this course using Docker and NVIDIA’s GPU cloud containers in the hope I can make and share an image for anyone wanting easy setup running locally. It may take me a few days or weeks, but I hope to contribute.

(Akhil Rajput) #13

Hi @FourMoBro Did you get a chance to crate a Docker image yet? Thanks

(houda kaddioui) #14

Not sure if you still need the instruction but here is how I did it on a machine with a Titan X GPU. I also tried a bunch of tutorials and failed, but this worked for me:

1. install cuda following this tutorial : http://www.pradeepadiga.me/blog/2017/03/22/installing-cuda-toolkit-8-0-on-ubuntu-16-04/#post/0
ensure where GCC is installed or not
`gcc --version`
`sudo apt-get install build-essential`

  1. download the CUDA 8packages from the nvidia website. I downloaded the CUDA 8 .deb package

    install the package

    sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb

    sudo apt-get update

    sudo apt-get install cuda

  2. Now you need to update the path of the etc environment

    sudo nano /etc/environment

    include /usr/local/cuda-8.0/bin at the end of the path (something/something/games:/usr/local/cuda-8.0/bin)

    source /etc/environment

  3. check the install

    nvcc --version

--------------If you ever end up on a login loop at this point, because this is what happened to me------------------
ctrl F1 to access terminal
`sudo service lightdm stop`
`sudo nvidia-uninstall` ( click yes on the first message)
`sudo service ligthdm start`
#Alternative to try is sudo dpkg-reconfigure nvidia*. I did not have to use this

5. Intall cudnn following this tutorial: https://medium.com/@ikekramer/installing-cuda-8-0-and-cudnn-5-1-on-ubuntu-16-04-6b9f284f6e77
#WARNING DO NOT DL THE cudnn V6 UNLESS WE ARE ON 2018 (I put this warning to myself. Not sure if it's still the case now. I would need someone to confirm or infirm this.
if pip is not installed on your computer, install it
`sudo apt-get install pip-python`

This is how I did it. What came next for me is installing tensorflow then all the dependencies. I hope this was useful, this is my first post so let me know if something is wrong.