Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting up a MSI laptop with GPU (gtx1060), Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow

Setting up a MSI laptop with GPU (gtx1060)

Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow

Installing Ubuntu 18.04

Get Image

https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0

Install (solving issues)

  • Security boot disable (change this in BIOS, for MSI computers reboot system and press delete a couple of times before the OS is loaded)
  • Possible problem: Screen freezing while installing
    • Reboot system
    • Go to the Install Ubuntu option (BUT DONT PRESS ENTER)
    • Press e
    • Find the line that starts with linux then add modprobe.blacklist=nouveau after quiet splash.
  • Choose a Wifi Network and install third party software and updates
  • Once the installation is done, remove the pendrive and reboot system

Installing Nvidia Drivers

  • Select Ubuntu at GRUB (you may need to repeat the modprobe.blacklist=nouveau step if the screen freezes again).
  • Make sure security boot is disable
  • Access command line (ctrl+alt+ F1,F2,F3...F??)
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
    # You can change this driver to whatever version suits you best :)
    sudo apt install nvidia-driver-396
    sudo reboot
    

Installing Conda

https://docs.anaconda.com/anaconda/install/linux

Installing CUDA 9.0 and CUDNN 7.0

https://medium.com/@taylordenouden/installing-tensorflow-gpu-on-ubuntu-18-04-89a142325138

Installing Pytorch 0.4

create conda env

conda create -n torch python=3.6

install torch (cuda 9)

conda install -y pytorch=0.4 torchvision cuda90 -c pytorch

if cuda 9 fails, install this way using cuda 8

conda install -y pytorch=0.4 torchvision -c pytorch conda install cuda80 -c soumith

test gpu install

python -c 'import torch; print(torch.rand(2,3).cuda())'

Installing TensorFlow (1.8)

https://www.tensorflow.org/install/install_linux#installing_with_anaconda

REMEMBER

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

test gpu install

python -c 'from tensorflow.python.client import device_lib; device_lib.list_local_devices()'

output:

2018-06-11 11:32:18.954198: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/device:GPU:0 with ...)

Getting my battery to last for longer

  1. Open the app "Nvidia X Server Settings"
  2. Go to "PRIME profiles" and select the Intel (Power Saving Mode).
  3. Then restart or log out your user session and log in again.

This way you'll be using the Intel integrated graphics card and the battery will last way more. To use the Nvidia GPU, just repeat the process above but choose Nvidia (Performance Mode).

In a MSI Gs65 Stealth, with nvidia 1060GTX it lasts about 8h with the Intel GPU enabled. It's a minor issue while not using the nvidia graphics cards.

@gcccoder

This comment has been minimized.

Copy link

@gcccoder gcccoder commented Nov 17, 2018

Hi,
Thank you for the post. I was struggling to get linux working on my msi laptop.
Have you tried getting optimus technology work on msi in ubuntu? since after following your post, the graphic card is all the time loaded(as implied by power button remaining orange) unlike windows where it gets powered up or woken up only when needed.

Thanks again for such helpful post. saved me days.

@hagonzalezd

This comment has been minimized.

Copy link

@hagonzalezd hagonzalezd commented Nov 25, 2018

Hello, thanks for your post. It was pretty helpful

@mari-linhares

This comment has been minimized.

Copy link
Owner Author

@mari-linhares mari-linhares commented Dec 13, 2018

Hi,
Thank you for the post. I was struggling to get linux working on my msi laptop.
Have you tried getting optimus technology work on msi in ubuntu? since after following your post, the graphic card is all the time loaded(as implied by power button remaining orange) unlike windows where it gets powered up or woken up only when needed.

Thanks again for such helpful post. saved me days.

Hi @gccoder, indeed... I haven't tried but I think it would be very helpful, using the graphic card all the time drains the battery way too fast. If you find a solution I would love to update this gist file with instructions of how to do so.

Cheers!

@prokons

This comment has been minimized.

Copy link

@prokons prokons commented Jan 12, 2019

Hi,
I'm planning to buy a P65 RE and then replacing windows with ubuntu. I need to have ubuntu installed, if I couldn't install it on MSI I would buy a Dell XPS 9570.
Reading your post I see that ubuntu run on MSI (thank you for posting). Can you also confirm that nvidia drivers make graphic card working fine at its full capabilities? Did someone maybe solve the problem with all-the-time loaded graphic card?
Also is everything fine with webcam, function keys, anything else?
Cheers!

@vitalik74

This comment has been minimized.

Copy link

@vitalik74 vitalik74 commented Jan 13, 2019

Thanks! I very happy that found this tutorial. My Ubuntu works fine on MSI GL63 8RC. Thanks again

@xidoc

This comment has been minimized.

Copy link

@xidoc xidoc commented Jan 31, 2019

Thank a lot. Amazing !
Ubuntu work on my MSI GL62 7RD

@shimanteko

This comment has been minimized.

Copy link

@shimanteko shimanteko commented Feb 9, 2019

Thanks for the guide. This also works on Lenovo Legion Series :)

@snehadasa

This comment has been minimized.

Copy link

@snehadasa snehadasa commented Feb 10, 2019

Thanks for the guide. If on restart ubuntu is not detecting run this on grub

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

@linxnerd

This comment has been minimized.

Copy link

@linxnerd linxnerd commented Feb 14, 2019

Thank you very much! it saved my time. it worked on GS63vr. thanks again

@mckdev

This comment has been minimized.

Copy link

@mckdev mckdev commented Feb 26, 2019

Thanks! Ubuntu installation was freezing on my XMG laptop with GTX 1050 Ti, but with your guide I managed to get it running.

@IBobko

This comment has been minimized.

Copy link

@IBobko IBobko commented Mar 13, 2019

Thank, it is helpful for me!!!

@timniven

This comment has been minimized.

Copy link

@timniven timniven commented Mar 18, 2019

A wonderful help. I add my thanks to those of many above :)

@kishor-p

This comment has been minimized.

Copy link

@kishor-p kishor-p commented Mar 19, 2019

Does this work on all MSI laptops?
Any one tried with MSI-GP63-GTX1070(NEWEGG special editions laptop)?

I have the aboue mentioned laptop. I want to run Ubuntu on my HDD not SSD. Is it the same process?

@glydeb

This comment has been minimized.

Copy link

@glydeb glydeb commented Mar 31, 2019

MSI ought to be paying you - great instructions: concise, clear, and accurate. My new laptop (G65 creator) is now making me smile instead of giving me headaches. Thanks so much.

@c0desBym3ta

This comment has been minimized.

Copy link

@c0desBym3ta c0desBym3ta commented Apr 1, 2019

Worked for my msi gs65. Thanks a lot. :)

@dharmendrakawasthi

This comment has been minimized.

Copy link

@dharmendrakawasthi dharmendrakawasthi commented Apr 13, 2019

Hi,
i have MSI GL 63 8RE can i go with above guide for ML setup ?

@davidz-br

This comment has been minimized.

Copy link

@davidz-br davidz-br commented Apr 17, 2019

I haven't been able to use the function keys neither the webcam, has someone found any solution/drivers to this problem? thanks for the gist!

@aherreacep1

This comment has been minimized.

Copy link

@aherreacep1 aherreacep1 commented May 1, 2019

Hi, how did you do to disable security boot? Mine is active and even after adding a bios password it still doesn´t let me disable it. Thanks

@bratan05

This comment has been minimized.

Copy link

@bratan05 bratan05 commented May 2, 2019

Thank you for that guide!
Works like a charm on MSI GT63 Titan 8RF.

@mari-linhares

This comment has been minimized.

Copy link
Owner Author

@mari-linhares mari-linhares commented May 2, 2019

About battery drain, someone commented a few days ago (I think the comment was removed):

I have a bit another solution.
I repeated a modprobe.blacklist=nouveau step to boot ubuntu after installation.
After that in "About system" menu i saw that it uses intel hd graphics driver for graphics.
So i consider to do not install proprietary nvidia graphics driver which will drain battery.
I installed grub customiser and edited ubuntu script: i added there a modprobe.blacklist=nouveau so changes became permanent. This way and it will every time will boot with disabled nouveau and use intel hd driver instead

If someone could try that and verify I would be happy to update the tutorial to avoid battery drain :)

@carlos-mg89

This comment has been minimized.

Copy link

@carlos-mg89 carlos-mg89 commented May 4, 2019

About the battery drain, it's pretty easy. Open the app "Nvidia X Server Settings", go to "PRIME profiles" and select the Intel GPU. Then restart or log out your user session and log in again. This way you'll be using the Intel integrated graphics card and the battery will last way more.

In a MSI Gs65 Stealth, with nvidia 1060GTX it lasts about 8h with the Intel GPU enabled. It's a minor issue while not using the nvidia graphics cards. If you want to play video games, this graphics card is still suitable for many of them. But obviously it's best to switch back to the nvidia one for more exigent games.

@mari-linhares

This comment has been minimized.

Copy link
Owner Author

@mari-linhares mari-linhares commented May 5, 2019

Thanks @carlos-mg89, I've just added these instructions to the tutorial!

@noglitchyo

This comment has been minimized.

Copy link

@noglitchyo noglitchyo commented May 13, 2019

HI guys,
Thanks for this wonderful post which really helps to get setup quickly.
Any of you guys encounter CPU peek every 10 seconds making screen freeze for about 1 or 2 seconds? It does not occur every time I boot the computer, it is totally random. I'd like to know if it only happens to me.
Thanks!

@kalote

This comment has been minimized.

Copy link

@kalote kalote commented Jun 11, 2019

Thanks a lot for this guide :) My P65-creator thanks you!

@umjundun

This comment has been minimized.

Copy link

@umjundun umjundun commented Jun 14, 2019

Would this work on the GL62 6QF? nvidia 960M?

@S-T-O-R-M

This comment has been minimized.

Copy link

@S-T-O-R-M S-T-O-R-M commented Jun 19, 2019

I have msi gs 63 7rd. When I use any type of linux distro the fan doesn't run. I tried using fan control using pwn config but this method doesnt work.
Has anyone tried and succeeded in this??

@MariusHolm

This comment has been minimized.

Copy link

@MariusHolm MariusHolm commented Jun 21, 2019

Thank you so much for this. Was having trouble booting a couple of MSI laptops at work.
When I was turning them off they seemed to freeze with full desktop on and still running with no mouse or commands possible. Have anyone else encountered similar issues, and if so how did you fix it? (GTX 1070, MSI GS63)

@kawinpop

This comment has been minimized.

Copy link

@kawinpop kawinpop commented Jul 26, 2019

wow it's work for me
Thank you so much

@Ic3Sandy

This comment has been minimized.

Copy link

@Ic3Sandy Ic3Sandy commented Jul 28, 2019

That a veryyyyy useful.
Thank you.
love love

@PaulisMatrix

This comment has been minimized.

Copy link

@PaulisMatrix PaulisMatrix commented Jul 30, 2019

Hey op, I am facing the problem
Error :retrieving gpg key timed out. Please help.

@Ic3Sandy

This comment has been minimized.

@PaulisMatrix

This comment has been minimized.

Copy link

@PaulisMatrix PaulisMatrix commented Jul 30, 2019

@Ic3Sandy. Nope still not working. Still the same error.

@prefpkg21

This comment has been minimized.

Copy link

@prefpkg21 prefpkg21 commented Aug 25, 2019

@PaulisMatrix I had to disable secure boot first in the BIOS and then this way https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS in Method 2 to get it to work. Apparently just disabling in the BIOS did not disable dkms from not allowing the driver to load. I did not re-enable in the last step. Works now.

Note if you use Method 1, you will have to re-enroll the key every time you update the kernel modules or drivers. Otherwise you’ll get the blank screen at boot and have to use command line or nouveau to redo

@inigodm

This comment has been minimized.

Copy link

@inigodm inigodm commented Aug 26, 2019

Thanks, I'm going to use it rigth NOW.
Only a little thing:
I use powertop app to let battery last loooooonger. Seriously, give it a chance if you haven't already try it. Is very easy to use.

@tomriddle54

This comment has been minimized.

Copy link

@tomriddle54 tomriddle54 commented Oct 26, 2019

Thanks! I very happy that found this tutorial. My Ubuntu works fine on MSI GL63 8RC. Thanks again
Anyone else facing this issue
sound drivers for ubuntu because I am not able to hear sound but when i attach earphones i am able to hear my laptop is gl638re

@nlinker

This comment has been minimized.

Copy link

@nlinker nlinker commented Oct 30, 2019

These instructions are suitable for MSI GS65 as well, thanks!

@a-berg

This comment has been minimized.

Copy link

@a-berg a-berg commented Nov 2, 2019

Hi, I have a MSI GE72 with a geforce 960M. Is it possible to get this card running in Ubuntu? Help appreciated, I have tried a couple times by myself with no luck.
Great post btw.

@hadyanq1

This comment has been minimized.

Copy link

@hadyanq1 hadyanq1 commented Nov 10, 2019

Thanks a lot for this guide :) My P65-creator thanks you!

Hi, did you manage to turn off the Nvidia graphics from the Nvidia settings GUI? If so, does the power LED still lights orange or does it turn white correctly? Because mine is always orange regarding my settings.

@Sassy85

This comment has been minimized.

Copy link

@Sassy85 Sassy85 commented Nov 11, 2019

Hey, did any of you had a problem with random reboots? I can’t find a solution to fix it up. I am using msi Gf638rd set with gtx1050ti Max-Q inside.

@nlinker

This comment has been minimized.

Copy link

@nlinker nlinker commented Nov 12, 2019

@timothyasp

This comment has been minimized.

Copy link

@timothyasp timothyasp commented Dec 5, 2019

Thanks for this - got things installed for me with a x570 board, RTX 2060 SUPUER, installing Ubuntu 18.04 from a USB disk.

In order for it to work, I had to add the grub arguments noapic noacpi nosplash in place of quiet splash in addition to adding modprobe.blacklist=nouveau

@ajitsen

This comment has been minimized.

Copy link

@ajitsen ajitsen commented Dec 8, 2019

Thanks for the Guide. I just did installation of Ubuntu 18 on MSI GS65 Stealth, with Windows 10.
Installation worked, but the Grub menu was not showing up and Windows was loading directly.

Followed following steps as described in this blog https://itsfoss.com/no-grub-windows-linux/

  1. From Windows run Command prompt as Administrator
  2. Run following command bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

To Setup Nvidia Drivers for GTX 1660 Ti - from @Ic3Sandy 's recommendation

It might help @PaulisMatrix
https://www.mvps.net/docs/install-nvidia-drivers-ubuntu-18-04-lts-bionic-beaver-linux/

  1. Removed all nvidia drivers
  2. I checked driver version for 1660 Ti (both 440 and 43 https://www.nvidia.com/Download/driverResults.aspx/154997/en-us
  3. And installed drivers from the "Software & Updates" GUI, nvidia-driver-435
  4. Reboot
  5. Run command nvidia-smi which shows details of driver installed
@VitorMeirelesOliveira

This comment has been minimized.

Copy link

@VitorMeirelesOliveira VitorMeirelesOliveira commented Jan 1, 2020

Hi, thanks a lot for the post, it's very helpful. But my laptop (MSI GL73 9RCX) when I press F11 and choose ubuntu to boot and put my password it seems to going start but then it turns off. As a temporary solution, I pressed e and check that the modprobe.blacklist=nouveau added was not there, so I put it again and worked, but when I reboot the system I have to add again to avoid that the laptop turns off after I put my password.

Another doubt is: the system should be starting using grub or just let me choose using F11?

@syntakker

This comment has been minimized.

Copy link

@syntakker syntakker commented Feb 6, 2020

Thanks for the Guide. I just did installation of Ubuntu 18 on MSI GS65 Stealth, with Windows 10.
Installation worked, but the Grub menu was not showing up and Windows was loading directly.

Followed following steps as described in this blog https://itsfoss.com/no-grub-windows-linux/

1. From Windows run Command prompt as Administrator

2. Run following command `bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi`

Same for me. On my MSI WS65, I could set the boot order for the EFI partition in BIOS. The option is in:

  • Boot -> UEFI Hard Disk Drive BBS Priorities
@py1998

This comment has been minimized.

Copy link

@py1998 py1998 commented Feb 7, 2020

Hi, Thanks for the tutorial. I am having one problem that my speakers are not working in ubuntu, but if I plug in the earphone, then I can hear the sound. I have MSI GL63 -8re
Thanks in advance!!

@B-R-Bender

This comment has been minimized.

Copy link

@B-R-Bender B-R-Bender commented Mar 17, 2020

worked well for MSI GF63 Thin 9RXC

@syntakker

This comment has been minimized.

Copy link

@syntakker syntakker commented Mar 24, 2020

I ran into one or two other problems while setting up my MSI laptop, e.g. no WiFi.
I have compiled my installation process here:
https://gist.github.com/syntakker/1ce0328222dee3409fb96e2965953317

@callibicknese

This comment has been minimized.

Copy link

@callibicknese callibicknese commented Mar 31, 2020

Hey, thank you for this! I have been researching like crazy for two days trying to get Ubuntu installed on my MSI laptop. This guide helped

@akhil93R

This comment has been minimized.

Copy link

@akhil93R akhil93R commented May 10, 2020

Thank a lot. Amazing !
Ubuntu work on my MSI GL62 7RD
bro am facing the issue while installing ubuntu 20.05 on my windows i have gtx1050 nvidia graphics card can u tell me how to install plzzz

@syntakker

This comment has been minimized.

Copy link

@syntakker syntakker commented May 11, 2020

@D4r3-D3v1L

This comment has been minimized.

Copy link

@D4r3-D3v1L D4r3-D3v1L commented Aug 2, 2020

I Installed Ububtu 20.04 on MSI GF63 9SC , in ubuntu the battery draining so fast compared to Windows.

How to make my battery good in Ubuntu ??

@syntakker

This comment has been minimized.

Copy link

@syntakker syntakker commented Aug 3, 2020

@D4r3-D3v1L: Switching between graphic cards might help, if the graphic card is the reason.
To switch between Intel and NVidia graphics, do:

  1. Open the app "Nvidia X Server Settings"
  2. Go to "PRIME profiles" and select Intel (Power Saving Mode) or one of the NVidia options.
  3. Then restart or log out your user session and log in again.
@D4r3-D3v1L

This comment has been minimized.

Copy link

@D4r3-D3v1L D4r3-D3v1L commented Aug 6, 2020

@syntakker I already did it , even though it's not fixed, full charge -2 hours in Ubuntu and 4+ hours in Windows

Is there any other way

Thank you

@syntakker

This comment has been minimized.

Copy link

@syntakker syntakker commented Aug 6, 2020

@D4r3-D3v1L No real idea. I would look for processes with unusually high cpu consumption, and monitor overall cpu usage, maybe you'll find some hint there.
Otherwise check if it might be an ACPI issue. In my setup I've added an additional acpi_osi=! acpi_osi='Windows 2009' in the grub command line, see: https://gist.github.com/syntakker/1ce0328222dee3409fb96e2965953317
Maybe you can explore further there.

@venkeythemonkey

This comment has been minimized.

Copy link

@venkeythemonkey venkeythemonkey commented Aug 15, 2020

Thanks! I very happy that found this tutorial. My Ubuntu works fine on MSI GL63 8RC. Thanks again

Hey, I'm also using MSI GL63 8RC. just curious about battery backup on ubuntu. how is it?

@D4r3-D3v1L

This comment has been minimized.

Copy link

@D4r3-D3v1L D4r3-D3v1L commented Aug 15, 2020

@venkeythemonkey I'm using gf63 9sc and it is very bad , it only lasts for 2+hours instead of 4+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.