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).

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===

===CUDA Toolkit===

Revision as of 21:19, 24 October 2012

Contents

Introduction

The Lenovo IdeaPad Y580 started shipping in June 2012. It is a fairly powerful machine, but it has its own compatibility issues. Hopefully this will help someone who wants to set it up with Arch Linux (it may also work with other distros).

Installation

As of 09/01/2012, Arch Linux does not have an installer anymore. The official way to install the system is to download the latest image: 2012.08.04, the use the Arch install scripts. I have yet to try those, but you can always use this guide: https://wiki.archlinux.org/index.php/Install_from_Existing_Linux to install everything manually.
In theory this can be done from any distro, but it is much easier to do it from the Arch live cd since in this case you do not need to manually install Pacman.

If you cannot get wireless working, you can use an ethernet connection with the help of the driver alx. This driver is not yet part of the Linux kernel, and that is why your ethernet card is not recognized at first. You need to download the driver from the Linux Foundation's website:

After this, load the module (modprobe alx) and you should be able to get ethernet working easily.

My model has a 32GB SSD drive and a 1TB 5400 rpm drive. It comes with Windows 7 and some Lenovo partitions that may be important if you need to recover the Windows install. Since I was positive about only using Linux, I just deleted everything so that I could use the SSD drive to install Arch (and get a faster boot). But you may want to think twice before doing this, or at least backup the partition's contents before erasing them.

Also, this laptop can use UEFI. If you want to use it, you need to a GPT partition (see below).

UEFI

UPDATE: Grub 1 is not officially supported anymore, so if you do a fresh install now, you will get Grub 2 automatically. Thus you should not completely trust the instructions below. They probably still work, but you may have to change one or two things.

Among other things, you need a gpt partition and grub2. You can do these things when you are installing the system, but I suggest that you get a base system working with grub first, and then install grub2. To install Arch on the SSD drive, you need at least two partitions: one small (100 MB) boot partition, and another partition for /. To partition the drives, you can use cgdisk, which you can get by installing the package gpttools.

I suggest that you partition both drives using gpt, but it is even possible to convert a MBR partition table to gpt, which is what I ended up doing. You should also create a third partition (with about 1GB) for EFI. This partition needs to be of EFI system type (code ef00 on gdisk) and it should be formatted as FAT32. If the partition is /dev/sda2, use:

mkfs.vfat -F32 /dev/sda3

After you have your base system up and running, install the grub 2 firmware:

pacman -S grub2-efi-x86_64

Mount the system partition at /boot/efi:

mkdir /boot/efi
mount -t vfat /dev/sda3 /boot/efi

Install grub2 efi app (grubx64.efi) to /boot/efi/EFI/arch_grub, and its modules to /boot/efi/EFI/grub/x86_64-efi:

Now comes the part where the grub2 page is not very clear. You need to add the system to the UEFI menu (the menu that shows up when you press F12 at boot). To do this, you need an UEFI shell. The Y580 does not come with a shell built in, but you can put one in a flash drive and boot from it. To do this, get a bootable flash drive, create a partition (1GB is enough) and format it as FAT32. Assuming that the partition is /dev/sdc1, type the following:

This will cause the ideapad UEFI firmware to automatically add a new boot option named "EFI HDD Device" which will by default come first.

Now reboot, go to the BIOS (press F2), enable UEFI and exit, then press F12 and the flash drive should show up in the menu (you want to choose the UEFI entry). Now you should be in the UEFI shell. There is quite a lot that you can do, but be careful because a mistake can seriously compromise the machine. This guide may be worth looking at: http://software.intel.com/en-us/articles/uefi-shell/

For now, you just need the command bcfg. To add Arch to the first entry of the menu, use:

bcfg boot add 0 fs1:\EFI\arch_grub\grubx64.efi "Arch Linux"

The command assumes that the system partition is installed on the first drive. This partition has the loader (grubx64.efi) and this little program is what loads grub2. If you add Arch to the first entry, you can boot to it without pressing F12.

To see the menu entries, use:

bcfg boot dump -v

To delete, say the 3rd entry:

bcfg boot rm 3

Once you are happy with the menu entries, reboot and you should be able to boot into Arch.

Dual-Boot With Windows 8

To avoid problems with the Arch install, put Windows on the second drive (this means that the second drive should also have a GUID partition table, since Windows 8 only works with one).

Windows 8 uses UEFI, so you can press F12 to choose between Arch and Windows, or just adjust this at the BIOS. Another option is to use the Windows program EasyBCD and add Arch to the Windows boot loader. However, I decided to add Windows to grub2.

To do this, from Arch, mount the Windows system partition and find its UUID:

The Y580 has a huge 1TB second drive, making it easy to install other OS. With grub2, you can install other distros, and then run grub-mkconfig to add the new entry. To make this easier, install os-prober so that grub2 can find other OS automatically (it does not work for Windows 8):

pacman -S os-prober

NVIDIA Card

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

Change your settings so that the module acpi-handle-hack is loaded automatically at boot. With the standard init system, add the module to your /etc/rc.conf file. If you are using systemd, add a file to your /etc/modules-load.d directory. The following command will do it:

echo "acpi-handle-hack" > /etc/modules-load.d/nvidia.conf

Any file with extension .conf will work (something like hack.conf, for example).

Driver

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, with the only exception being the 302.17 that never worked for me (and that unfortunately was the default one on Linux distros when I first wrote this guide).

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 my package nvidia-utils-custom from the AUR: https://aur.archlinux.org/packages.php?ID=60991.

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).

CUDA Toolkit

Configurations

You need to load the acpi-handle-hack module first, then the nvidia module. Depending on your system, this 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:

Testing it

This is not necessary, but you may want to install the community package cuda-sdk:

pacman -S cuda-sdk

The package is installed to /opt/cuda-sdk. To compile the CUDA C samples, use:

cd /opt/cuda-sdk/C
make

Now reboot and CUDA should be working. To test it, run deviceQuery from the sdk:

/opt/cuda-sdk/C/bin/linux/release/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:

./a.out

If this works without errors, you are all set!

Other Distributions

The above setup does not work only with Arch, and it may be even easier with other distros. For example, with Ubuntu 12.04 or Linux Mint 13, install the acpi-handle-hack module and then get the official nvidia-current (no need to patch it) package: