Skip to content

Instantly share code, notes, and snippets.

@bsantraigi
Last active December 30, 2017 18:22
Show Gist options
  • Save bsantraigi/70268f35a74dedeea98b3c4c88420f08 to your computer and use it in GitHub Desktop.
Save bsantraigi/70268f35a74dedeea98b3c4c88420f08 to your computer and use it in GitHub Desktop.
Installing Ubuntu 16.04 with Cuda 8-0 in MSI-GP62 6QF (Or similar systems)

Installing Ubuntu 16.04 with Cuda 8-0 in MSI-GP62 6QF (Or similar systems)

  • There are two modes of this installation
    • Install Ubuntu to only use NVIDIA GPU. Intel HD doesn't work in this mode but everything works really well in this setting and you don't have to install bumblebee and all
    • Install bumblebee to switch between NVIDIA and Intel GPU as required to save battery power(also it's life). Using this you will need to use optirun to make any program run using GPU and Cuda. This can be problematic in certain scenarios as the optirun library uses lots of old libraries which creates conflict with newer programs(like pip)

Prepare a Bootable flash drive

Steps:

  • Download Ubuntu 16.04 amd64 iso image
  • Download Rufus for Windows. We will use this to create the bootable flash drive.
  • Start Rufus and choose to create 'GPT for UEFI boot partition'

Booting from the Live-USB

  • Goto BIOS/System (or BIOS/Boot) and change the order of boot devices to give USB-HDD/USB higher priority than HDD. You will have to disable 'Fast Boot' and 'Secure Boot'. Then save changes and reset.
  • When at the Grub menu, highlight Try Ubuntu without installing and press e. Go to the line with quiet splash in it and add acpi=no nouveau.modeset=0 and press F10.
  • Ubuntu will boot from live-usb now.

Installing Ubuntu on HDD or external HDD

  • Following partitioning is required when you are trying to install Ubuntu on a disk with GPT partition connected to a UEFI system.1
  • Following partitions are must for a proper installation
    • EFI: A 250MB ~ 1GB partition of type efi. Position this at the beginning of the disk (or atleast within the first 100GB). This is automatically mounted at /boot/efi
    • swap: Should be of size as big as the RAM
    • [root] \: Can be of any size. Recommended file system - ext4
  • If you are installing the system on a external HDD (USB-HDD) it is recommended that the external HDD is empty.

Persist GRUB settings

  • Edit /etc/default/grub file to change the following value, GRUB_CMDLINE_LINUX_DEFAULT="acpi=off nouveau.modeset=0 i915.modeset=1 quiet splash"
  • Then run sudo update-grub
  • Restart your system. Now you wouldn't need to add the acpi=no etc. options in the GRUB menu.

Install Updates

Next you should update your repositories and packages by running,

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremov

Restart your system once and verify it's working properly at this point.

Blacklist nouveau etc.

Now we start the process to get Nvidia drivers installed on the system, but before we do that, we need to remove nouveau and nvidia-current(if any) drivers as it may conflict with newer nvidia drivers. Press Alt + Ctrl + F1 to access consoles. Stop the Xserver and remove any existing installs of Nvidia, nouveau etc.

sudo service lightdm stop
sudo apt-get remove --purge nvidia*
sudo apt-get remove --purge bumblebee*
sudo apt-get --purge remove xserver-xorg-video-nouveau*

To Blacklist nouveau, add the following lines to /etc/modprobe.d/blacklist.conf

blacklist nouveau
blacklist lbm-nouveau
alias nouveau off
alias lbm-nouveau off
options nouveau modeset=0

Disable gpu-manager.service, as it has a tendency to overwrite xorg.conf and result in black screen on boot.

sudo vi /etc/init/gpu-manager.conf

Comment these start on settings ; GPU Manager ruins our work

# start on (starting lightdm
#          or starting kdm
#          or starting xdm
#          or starting lxdm)`
task
exec gpu-manager --log /var/log/gpu-manager.log

Create initramfs sudo update-initramfs -u -k all. Now restart your PC once.

Install CUDA

  • Download CUDA 8.0 ga2 release local installer .deb file
  • Run
    • dpkg -i cuda-8.0-ga2-xx.deb
    • sudo apt-get update
    • sudo apt-get install cuda-8.0

Now restart you system. Once you get in you should be able to use your GPU and CUDA

Footnotes

  1. DiskSpaceWiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment