Getting Nvidia Optimus working on my Lenovo Ideapad Y580 Ubuntu/Kubuntu
So I recently got a Lenovo Ideapad Y580 in the hope I could use it to do some CUDA coding at a conference I recently went to. Well I got back from the trip and I still hadn't got CUDA or the optimums card working under Linux, finally on a second trip I got frustrated enough to fix it. It took many re-installs and web searches to get it all to work so I though I might outline the steps. I hope it helps someone else....
So I installed various Ubuntu and Kubuntu versions and kernel and found the one that works is kernel 3.5.0-17 or greater, so I installed Kubuntu 12.10 and updated to the latest kernel.
$ sudo apt-get -y update
$ sudo apt-get -y install linux-headers-generic
$ sudo apt-get -y upgrade
So the Y580 uses NVIDIA's Optimus technology which works great on Windows but is not directly supported on Linux. However using Bumblebee and optirun one can asses the discreet NVIDIA 660M
A possible solution is to install Bumblebee and to access the card with optirun. There is however a bug in the kernel which means Bumblebee will not work, it gives an e=something like:
$ [ 94.384435] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver
$ [ 94.384481] [ERROR]Aborting because fallback start is disabled.
There is however a work around hack, installing the acpi-handle-hack module.
First dl and install the hack (taken from here):
$ git clone git://github.com/Bumblebee-Project/bbswitch.git -b hack-lenovo
$ cd bbswitch
$ sudo mkdir /usr/src/acpi-handle-hack-0.0.1
$ sudo cp Makefile acpi-handle-hack.c /usr/src/acpi-handle-hack-0.0.1
$ sudo cp dkms/acpi-handle-hack.conf /usr/src/acpi-handle-hack-0.0.1/dkms.conf
$ sudo dkms add acpi-handle-hack/0.0.1
$ sudo dkms build acpi-handle-hack/0.0.1
$ sudo dkms install acpi-handle-hack/0.0.1
Next get the hack to load on boot:
$ echo acpi-handle-hack | sudo tee -a /etc/modules
$ sudo update-initramfs -u
Now Install bumblebee and drivers
$ sudo apt-get install -y bumblebee bumblebee-nvidia nvidia-current
Reboot to get it all loaded
$ sudo reboot
Now if you try
$ optirun glxspheres
You should get something like:
$ [ 128.872061] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(0): Failed to initialize the NVIDIA GPU at PCI:1:0:0. Please
$ [ 128.872091] [ERROR]Aborting because fallback start is disabled.
The answer to this one I got here, and that is to edit /etc/bumblebee/xorg.conf.nvidia and change the Option "ConnectedMonitor" "DFP" line to Option "UseDisplayDevice" "none" and restart bumblebee:
$ sudo restart bumblebee
Then try:
$ glxspheres
and
$ optirun glxspheres
You should see the difference! I go from ~20fps to ~170fps, now that's what I'm talking about!
Now to install CUDA you can see my previous post, noting that you can skip the driver install as it should be already done.
You will have to install gcc 4.4
$ sudo apt-get install -y gcc-4.4 g++-4.4
$ sudo ln -s /usr/bin/gcc-4.4 /usr/local/cuda/bin/gcc
And tell nvcc to use it with the directive: --compiler-bindir=/usr/local/cuda/bin
So I installed various Ubuntu and Kubuntu versions and kernel and found the one that works is kernel 3.5.0-17 or greater, so I installed Kubuntu 12.10 and updated to the latest kernel.
$ sudo apt-get -y update
$ sudo apt-get -y install linux-headers-generic
$ sudo apt-get -y upgrade
So the Y580 uses NVIDIA's Optimus technology which works great on Windows but is not directly supported on Linux. However using Bumblebee and optirun one can asses the discreet NVIDIA 660M
A possible solution is to install Bumblebee and to access the card with optirun. There is however a bug in the kernel which means Bumblebee will not work, it gives an e=something like:
$ [ 94.384435] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver
$ [ 94.384481] [ERROR]Aborting because fallback start is disabled.
There is however a work around hack, installing the acpi-handle-hack module.
First dl and install the hack (taken from here):
$ git clone git://github.com/Bumblebee-Project/bbswitch.git -b hack-lenovo
$ cd bbswitch
$ sudo mkdir /usr/src/acpi-handle-hack-0.0.1
$ sudo cp Makefile acpi-handle-hack.c /usr/src/acpi-handle-hack-0.0.1
$ sudo cp dkms/acpi-handle-hack.conf /usr/src/acpi-handle-hack-0.0.1/dkms.conf
$ sudo dkms add acpi-handle-hack/0.0.1
$ sudo dkms build acpi-handle-hack/0.0.1
$ sudo dkms install acpi-handle-hack/0.0.1
Next get the hack to load on boot:
$ echo acpi-handle-hack | sudo tee -a /etc/modules
$ sudo update-initramfs -u
Now Install bumblebee and drivers
$ sudo apt-get install -y bumblebee bumblebee-nvidia nvidia-current
Reboot to get it all loaded
$ sudo reboot
Now if you try
$ optirun glxspheres
You should get something like:
$ [ 128.872061] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(0): Failed to initialize the NVIDIA GPU at PCI:1:0:0. Please
$ [ 128.872091] [ERROR]Aborting because fallback start is disabled.
The answer to this one I got here, and that is to edit /etc/bumblebee/xorg.conf.nvidia and change the Option "ConnectedMonitor" "DFP" line to Option "UseDisplayDevice" "none" and restart bumblebee:
$ sudo restart bumblebee
Then try:
$ glxspheres
and
$ optirun glxspheres
You should see the difference! I go from ~20fps to ~170fps, now that's what I'm talking about!
Now to install CUDA you can see my previous post, noting that you can skip the driver install as it should be already done.
You will have to install gcc 4.4
$ sudo apt-get install -y gcc-4.4 g++-4.4
$ sudo ln -s /usr/bin/gcc-4.4 /usr/local/cuda/bin/gcc
And tell nvcc to use it with the directive: --compiler-bindir=/usr/local/cuda/bin
16 Comments:
Great tutorial! I tried almost everything, and your solution was the only one that worked for me. Thanks!
Happy to make someone's life a bit easier!
ALOT easier ;) thank you so much!
Perfect! This is the first tutorial I've encountered that actually worked. Thanks so much!
Perfect! This is the first tutorial I've encountered that actually worked. Thanks so much!
I've done everything step by step and yet I still got the error. I adjusted it for generic kernel 23 and I don't know why doesn't it work
This comment has been removed by the author.
Thanks Chris for this great tutorial. Worked like charm on Ubuntu 12.10.
Hint:
You might also find this link useful:
https://wiki.ubuntu.com/Bumblebee
It helped me :)
Worked perfectly ! My unity was completely screwed up and this fixed... thanks a ton.
Perfect! Thanks for the post - worked like a charm on my y580 running 12.10x64... This lappy is a beast with a 256Gb mSATA tossed in... Thanks again, Chris!
Perfect! Thanks for the post - worked like a charm on my y580 running 12.10x64... This lappy is a beast with a 256Gb mSATA tossed in... Thanks again, Chris!
Thank you! Yours was the only solution that worked for me. Will recommend to others.
Thank you so much dude!
Thank you so much dude!
This comment has been removed by the author.
Thanks
Post a Comment
<< Home