Lenovo IdeaPad Y580

From ArchWiki
Revision as of 03:33, 22 September 2013 by Kynikos (talk | contribs) (categorize, see Help:Style)
Jump to navigation Jump to search


As of the arrival of the 3.7.X series kernel, this machine boots into black screen. You will have to add acpi_backlight=vendor to kernel command line to boot into a visible display. You can alternatively increase the screen brightness during every boot also, since the screen brightness is set to 0 wrongly by the kernel acpi by default.

As of September 2013, this doesn't seem to be an issue anymore, at least not on kernel 3.10.

Intel Card

This machine has two video cards, explained in detail below

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GTX 660M] (rev a1)

In order to get the machine working for basic purposes, simply install xf86-video-intel and use the intel driver. You can leave the nvidia card disabled (and powered down?) just by not installing nvidia-304xx.


The Y580 uses NVIDIA's Optimus technology, which is not officially supported on Linux yet. A possible solution is to install Bumblebee (https://wiki.archlinux.org/index.php/Bumblebee) and to access the card with optirun. However, you can still use CUDA, which is good if you use apps like Blender or if you develop CUDA C programs.

Nvidia Bumblebee support

In Linux currently bumblebee is the easiest option for a optimus like solution. For this laptop you will need bbswitch, Bumblebee, nvidia from official Arch repos. After installation of these packages you will need to add your user name to bumblebee group.You have to start the bumblebeed service manually. A short guide given here bumblebee.


To compile and run CUDA programs, you need a NVIDIA driver and the cuda-toolkit. Any driver with version 295.59 or higher will work.

Note: The only exception being the 302.17

As of 10/24/2012, the newest driver is 304.60. To install it, you need a modified version of the package nvidia-utils from extra. The easiest way to do this is to install the package nvidia-utils-custom from the AUR: https://aur.archlinux.org/packages.php?ID=60991.

Alternatively, you can use ABS and patch the package yourself. If you are not familiar with the process, read the wiki: https://wiki.archlinux.org/index.php/Arch_Build_System. The exact way to rebuild a package depends on your own preferences, one way is to download the source code (in this case, the driver, obtained here: ftp://download.nvidia.com/XFree86/Linux-x86_64/304.60/NVIDIA-Linux-x86_64-304.60-no-compat32.run), copy it to the build directory, edit the PKGBUILD, and then run makepkg.

Edit the PKGBUILD of nvidia-utils. You may need to change the pkgver, the source item, and the md5sum. The most important thing is that nvidia-utils conflicts with libgl, but if you uninstall libgl, Gnome only starts in fallback mode (not sure about other DE). Because of this, you need to modify the PKGBUILD, so that it either does not install certain libraries (libglx.so, libGL.so) or that it installs them in another location. With the PKGBUILD below, those libraries are not installed (note the commented lines for the GLX extension module, and the empty 'conflicts' line).

nvidia-utils PKGBUILD

# $Id$
# Maintainer: Thomas Baechler <thomas@archlinux.org>
# Contributor: James Rayner <iphitus@gmail.com>
pkgname=('nvidia-utils' 'opencl-nvidia')
arch=('i686' 'x86_64')

if [ "$CARCH" = "i686" ]; then
elif [ "$CARCH" = "x86_64" ]; then

create_links() {
    # create soname links
    while read -d '' _lib; do
        _soname="$(dirname "${_lib}")/$(readelf -d "${_lib}" | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')"
        [[ -e "${_soname}" ]] || ln -s "$(basename "${_lib}")" "${_soname}"
        [[ -e "${_soname/.[0-9]*/}" ]] || ln -s "$(basename "${_soname}")" "${_soname/.[0-9]*/}"
    done < <(find "${pkgdir}" -type f -name '*.so*' -print0)

build() {
    cd "${srcdir}"
    sh "${_pkg}.run" --extract-only

package_opencl-nvidia() {
    pkgdesc="OpenCL implemention for NVIDIA"
    depends=('libcl' 'zlib')
    optdepends=('opencl-headers: headers necessary for OpenCL development')
    cd "${srcdir}/${_pkg}"

    # OpenCL
    install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
    install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
    install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"


package_nvidia-utils() {
    pkgdesc="NVIDIA drivers utilities and libraries."
    depends=('xorg-server' 'libxvmc')
    optdepends=('gtk2: nvidia-settings' 'pkg-config: nvidia-xconfig'
                'opencl-nvidia: OpenCL support')
    cd "${srcdir}/${_pkg}"

    # X driver
    install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
    # GLX extension module for X
    #install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.${pkgver}"
    #ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"	# X does not find glx otherwise
    # OpenGL library
    #install -D -m755 "libGL.so.${pkgver}" "${pkgdir}/usr/lib/libGL.so.${pkgver}"
    # OpenGL core library
    install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
    # XvMC
    install -D -m644 libXvMCNVIDIA.a "${pkgdir}/usr/lib/libXvMCNVIDIA.a"
    install -D -m755 "libXvMCNVIDIA.so.${pkgver}" "${pkgdir}/usr/lib/libXvMCNVIDIA.so.${pkgver}"
    # VDPAU
    install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
    # nvidia-tls library
    install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
    install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"

    install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
    # CUDA
    install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
    install -D -m755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"

    # nvidia-xconfig
    install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
    install -D -m644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
    # nvidia-settings
    install -D -m755 nvidia-settings "${pkgdir}/usr/bin/nvidia-settings"
    install -D -m644 nvidia-settings.1.gz "${pkgdir}/usr/share/man/man1/nvidia-settings.1.gz"
    install -D -m644 nvidia-settings.desktop "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
    install -D -m644 nvidia-settings.png "${pkgdir}/usr/share/pixmaps/nvidia-settings.png"
    sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
    # nvidia-bug-report
    install -D -m755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
    # nvidia-smi
    install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
    install -D -m644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"

    install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/nvidia/LICENSE"
    ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-utils"
    install -D -m644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
    install -D -m644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
    ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"


It is not necessary to patch other packages. If you want, you can also install nvidia-custom (https://aur.archlinux.org/packages.php?ID=60981) and opencl-nvidia-custom (https://aur.archlinux.org/packages.php?ID=61443) from the AUR, but they are not much different from the official ones (nvidia and opencl-nvidia from extra).

If you rebuild nvidia-utils yourself, you may want to add it to the IgnorePkg line of your /etc/pacman.conf, so that the next system update does not break your system.

CUDA Toolkit

Install the package from community (https://www.archlinux.org/packages/community/x86_64/cuda/).


Since Linux 3.9, the acpi-handle-hack module is no longer necessary for the Nvidia video adapter to get recognized. Depending on your system, just loading the nvidia module may be enough, but it may be necessary to create devices for CUDA. One way to accomplish this is to add the following to your /etc/rc.local:

/sbin/modprobe nvidia

if [ "$?" -eq 0 ]; then

# Count the number of NVIDIA controllers found.

N3D=`lspci | grep -i NVIDIA | grep "3D controller" | wc -l`

NVGA=`lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`

N=`expr $N3D + $NVGA - 1`

for i in `seq 0 $N`; do
mknod -m 666 /dev/nvidia$i c 195 $i

mknod -m 666 /dev/nvidiactl c 195 255
exit 1

If you are using systemd, you can get the /etc/rc.local loaded at boot by adding a new service. Create the following file:


Description=/etc/rc.local Compatibility



Then make this service load at boot with:

systemctl enable rc-local.service

Testing it

The cuda package includes both the cuda-toolkit and sdk. Before testing it, reboot and it should be working. To compile and run deviceQuery from the sdk:

cd /opt/cuda/samples/1_Utilities/deviceQuery

Alternatively, you can compile your own code and run it. To compile, say hello.cu, use:

nvcc hello.cu

Now you can run the executable:


If this works without errors, you are all set!