https://wiki.archlinux.org/api.php?action=feedcontributions&user=Daphron&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:48:05ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Media_Transfer_Protocol&diff=357671Media Transfer Protocol2015-01-22T21:05:25Z<p>Daphron: Made directory names in the command match the directory names in the description</p>
<hr />
<div>[[Category:Sound]]<br />
[[Category:Imaging]]<br />
[[Category:Storage]]<br />
[[Category:Mobile devices]]<br />
[[ja:MTP]]<br />
[[ru:MTP]]<br />
[[zh-CN:MTP]]<br />
{{Related articles start}}<br />
{{Related|USB storage devices}}<br />
{{Related articles end}}<br />
[[Wikipedia:MTP|MTP]], or the ''Media Transfer Protocol'', is a USB device class which is used by many mobile phones (e.g. Samsung Galaxy S4) and media players (e.g. Creative Zen).<br />
<br />
== Installation ==<br />
<br />
=== Functionality ===<br />
<br />
Linux MTP support is provided by [http://libmtp.sourceforge.net/ libmtp] which can be installed with {{Pkg|libmtp}} from the [[official repositories]]. It can be installed on its own and used to access devices. However, a number of packages are available that use it as a dependency and add additional convenience (e.g. filemanager) functionalities and compatibility with particular device types - which includes improving transfer access speeds. <br />
<br />
These packages to choose from all implement a [[Wikipedia:Filesystem in Userspace]]: <br />
<br />
* {{Pkg|mtpfs}}<br />
* {{AUR|jmtpfs}} - is reported to work well for newer Android 4+ devices <br />
* {{AUR|go-mtpfs-git}} - is reported to work well for newer Android 3+ devices <br />
* {{AUR|simple-mtpfs}}<br />
<br />
All of them aim at better functionality and performance over {{ic|libmtp}}. Since there are a lot of different USB devices, you might want to research first which one looks most suitable for yours. <br />
<br />
{{Note|It is always recommend to reboot your computer after installing MTP functionality providing packages.}}<br />
<br />
=== Integration with file managers ===<br />
<br />
To view the contents of your Android device's storage via MTP in your file manager, install the corresponding plugin:<br />
<br />
* For file managers that use [[GVFS]] ([[GNOME Files]], Xfce's [[Thunar]]), install {{Pkg|gvfs-mtp}} for MTP or {{Pkg|gvfs-gphoto2}} for PTP support.<br />
* For file managers that use KIO (KDE's Dolphin), install {{Pkg|kio-mtp}} (PTP support is included by default).<br />
<br />
After installing the required package, the device should show up in the file manager automatically and be accessible via an URL, for example {{ic|mtp://[usb:002,013]/}}.<br />
<br />
== Usage ==<br />
<br />
It might be required to create a mount-point directory first. The directory {{ic|~/mnt}} is used as an example below. Also do not forget to unlock your phone's screen before connecting it to the computer.<br />
<br />
=== libmtp ===<br />
<br />
Detect your device:<br />
<br />
# mtp-detect<br />
<br />
If an error is returned, see [[#libmtp 2|troubleshooting libmtp]]. <br />
<br />
{{Note|Your regular user must be in the {{ic|uucp}} group.}}<br />
<br />
Connect to your device:<br />
# mtp-connect<br />
<br />
If connection is successful, there are several switch options to use in conjunction with ''mtp-connect'' to access data on the device. You might want to use some stand alone commands:<br />
mtp-albumart mtp-emptyfolders mtp-getplaylist mtp-reset mtp-trexist<br />
mtp-albums mtp-files mtp-hotplug mtp-sendfile<br />
mtp-connect mtp-folders mtp-newfolder mtp-sendtr<br />
mtp-delfile mtp-format mtp-newplaylist mtp-thumb<br />
mtp-detect mtp-getfile mtp-playlists mtp-tracks<br />
{{Warning | Some commands may be harmful to your MTP device!}}<br />
<br />
=== mtpfs ===<br />
<br />
{{Note | The following is likely to not work and you might have to resort to [[Digital_Cameras#libgphoto2|gphoto2]] or a file manager with gvfs support like [[PCManFM]]. }}<br />
<br />
First edit your {{ic|/etc/fuse.conf}} and uncomment the following line:<br />
user_allow_other<br />
<br />
Mount your device on {{ic|~/mnt}}:<br />
$ mtpfs -o allow_other ~/mnt<br />
<br />
Unmount device mounted on {{ic|~/mnt}}:<br />
$ fusermount -u ~/mnt<br />
<br />
=== jmtpfs ===<br />
<br />
Mount device on {{ic|~/mnt}}:<br />
$ jmtpfs ~/mnt<br />
<br />
Unmount device mounted on {{ic|~/mnt}}:<br />
$ fusermount -u ~/mnt<br />
<br />
=== go-mtpfs ===<br />
<br />
{{Note|Mounting with {{ic|go-mtpfs}} fails if external SD Card is present. If you have also external SD Card please remove it and then try mounting again.}}<br />
<br />
Install {{Pkg|android-udev}}, which will allow you to edit {{ic|/usr/lib/udev/rules.d/51-android.rules}} and apply to your {{ic|idVendor}} and {{ic|idProduct}}, which you can see after running ''mtp-detect''. To the end of the line, add your user {{ic|<nowiki>OWNER="<user>"</nowiki>}}. First, create the {{ic|fuse}} group if it doesn't exist:<br />
# groupadd fuse<br />
<br />
Add yourself to the {{ic|fuse}} group:<br />
# gpasswd -a <user> fuse<br />
Reboot might be required.<br />
<br />
Mount device on {{ic|~/mnt}}:<br />
$ go-mtpfs ~/mnt<br />
<br />
Unmount device mounted on {{ic|~/mnt}}:<br />
$ fusermount -u ~/mnt<br />
<br />
=== simple-mtpfs ===<br />
<br />
List MTP devices:<br />
$ simple-mtpfs --list-devices<br />
<br />
Mount your device on {{ic|~/mnt}}:<br />
$ simple-mtpfs ~/mnt<br />
<br />
Unmount device mounted on {{ic|~/mnt}}:<br />
$ fusermount -u ~/mnt<br />
<br />
=== Media players ===<br />
<br />
You can also use your MTP device in music players such as Amarok. To achieve this, you might have to edit {{ic|/usr/lib/udev/rules.d/51-android.rules}} (the MTP device used in the following example is a Galaxy Nexus). <br />
Run:<br />
$ lsusb<br />
<br />
Search for your device. It should be something like that:<br />
Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]<br />
<br />
And entry to {{ic|/usr/lib/udev/rules.d/51-android.rules}} will be this:<br />
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"<br />
<br />
Also reload udev rules:<br />
# udevadm control --reload<br />
<br />
== Troubleshooting ==<br />
<br />
=== libmtp ===<br />
<br />
If you see a message like:<br />
<br />
Device 0 (VID=XXXX and PID=XXXX) is UNKNOWN.<br />
Please report this VID/PID and the device model to the libmtp development team<br />
<br />
You should check whether your device is listed in the [http://sourceforge.net/p/libmtp/code/ci/HEAD/tree/src/music-players.h Supported devices list]. If it is not, you should report it to the developers team. If it is, your {{ic|libmtp}} might be slightly outdated. To allow it to be properly used by {{ic|libmtp}}, you can add your device to:<br />
/usr/lib/udev/rules.d/69-libmtp.rules<br />
<br />
=== gvfs-mtp ===<br />
<br />
{{Merge|udev}}<br />
<br />
If you have installed the {{Pkg|gvfs-mtp}} package, and your device doesn't show up in the file manager, you might need to write a udev rule in order to auto-mount the device.<br />
<br />
Plug your device and get the vendor-id and product-id,respectively:<br />
<br />
$ lsusb<br />
Bus 001 Device 007: ID 0421:0661 Nokia Mobile Phones Lumia 920<br />
(...)<br />
<br />
The two numbers after ID are ''vendorId'' : ''productID''<br />
<br />
Then make a udev rule, e.g.<br />
<br />
# nano /usr/lib/udev/rules.d/51-android.rules<br />
<br />
and type this rule:<br />
<br />
ATTR{idVendor}=="YOUR VENDOR ID HERE", ATTR{idProduct}=="YOUR PRODUCT ID HERE", SYMLINK+="libmtp", MODE="660", ENV{ID_MTP_DEVICE}="1"<br />
<br />
Reload the udev rules.<br />
<br />
# udevadm control --reload<br />
<br />
And reboot the system. Now file managers (like Thunar) should be able to automount the MTP Device. [https://bbs.archlinux.org/viewtopic.php?id=180719]<br />
<br />
=== kio-mtp ===<br />
<br />
If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file {{ic|/usr/share/apps/solid/actions/solid_mtp.desktop}}.<br />
<br />
Change the line<br />
Exec=kioclient exec mtp:udi=%i/<br />
To<br />
Exec=dolphin "mtp:/"</div>Daphronhttps://wiki.archlinux.org/index.php?title=Wicd&diff=263658Wicd2013-06-20T15:56:39Z<p>Daphron: Shows dots instead of the password for the eduroam configuration.</p>
<hr />
<div>[[de:Wicd]]<br />
[[es:Wicd]]<br />
[[fr:Wicd]]<br />
[[it:Wicd]]<br />
[[tr:Wicd]]<br />
[[zh-CN:Wicd]]<br />
[[Category:Networking]]<br />
[[Category:Wireless Networking]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers installation and configuration of Wicd &ndash; an open source wired and wireless network manager for Linux which aims to provide a simple interface to connect to networks with a wide variety of settings.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Networking overview}}}}<br />
{{Article summary end}}<br />
<br />
[http://www.wicd.net/ Wicd] is a network connection manager that can manage wireless and wired interfaces, similar and an alternative to [[NetworkManager]]. Wicd is written in [[Python]] and [[GTK+]], requiring fewer dependencies than other network managers. Alternatively, a version of Wicd for [[KDE]], written in [[Qt]], is available from the [[Arch User Repository]]. Wicd can also run from the terminal in a curses interface, requiring no X server session or task panel (see [[#Running Wicd]]).<br />
<br />
== Installation ==<br />
<br />
=== Base package ===<br />
<br />
[[pacman|Install]] {{Pkg|wicd}}, available in the [[official repositories]]. It includes everything needed to run the wicd daemon and the {{ic|wicd-cli}} and {{ic|wicd-curses}} interfaces.<br />
<br />
=== GTK+ client ===<br />
<br />
For a GTK+ front-end, install {{Pkg|wicd-gtk}}, available in the official repositories. It includes everything needed to run the GTK interface of wicd and the autostart file for the client to appear in the system tray.<br />
<br />
=== KDE client ===<br />
<br />
For a KDE front-end, install {{AUR|wicd-kde}}, available in the [[AUR]]. <br />
<br />
=== Notifications ===<br />
<br />
To enable visual notifications about network status, you need to install the {{Pkg|notification-daemon}}.<br />
<br />
If you are not using [[GNOME]], you will want to install {{Pkg|xfce4-notifyd}} instead of the notification-daemon, because it pulls a lot of unnecessary GNOME packages.<br />
<br />
=== Alternative ===<br />
<br />
The {{AUR|wicd-bzr}} buildscript is available in the [[AUR]], which should build the latest development branch.<br />
If you need an alternative version or you just want to roll your own package, you can easily build it using [[ABS]].<br />
<br />
== Getting started ==<br />
<br />
=== Initial setup ===<br />
<br />
Wicd provides a daemon that must be started. <br />
<br />
{{Warning | Running multiple network managers ''will'' cause problems, so it is important to ''disable all other network management daemons''.}}<br />
<br />
First, stop all previously running network daemons (like netctl, netcfg, dhcpcd, NetworkManager).<br />
<br />
Disable any existing network management services, including {{ic|netctl}}, {{ic|netcfg}}, {{ic|dhcpcd}}, and {{ic|networkmanager}}. Refer to [[Systemd#Using_units]].<br />
<br />
{{Note|You might need to stop and disable the '''network''' daemon instead of '''netctl''', which is a current replacement for '''network''' service. If unsure, try disabling both.}}<br />
<br />
Start the '''wicd''' [[systemd ]] [[daemon]] and enable it at system start up.<br />
<br />
Add your account to '''users''' group:<br />
<br />
# gpasswd -a USERNAME users<br />
<br />
{{Note|The Unix group that dbus allows to access '''wicd''' is subject to change, and may be different than ''users''. Check which policy group is specified in {{ic|/etc/dbus-1/system.d/wicd.conf}}, and add your user to that group.}}<br />
<br />
If you added your user to a new group, log out and then log in.<br />
<br />
=== Running Wicd ===<br />
<br />
To load Wicd, run:<br />
<br />
$ wicd-client<br />
<br />
To force it to start minimized in the notification area, run:<br />
<br />
$ wicd-client --tray<br />
<br />
If your desktop environment does not have a notification area, run:<br />
<br />
$ wicd-client -n<br />
<br />
The above commands will only work if you have installed the {{pkg|wicd-gtk}}. If you did not install {{pkg|wicd-gtk}} then use wicd-cli or wicd-curses:<br />
<br />
$ wicd-curses<br />
<br />
{{Note | Wicd does not prompt you for a passkey. To use encrypted connections (WPA/WEP), expand the network you want to connect to, click '''Advanced''' and enter the needed info.}}<br />
<br />
==== Autostart ====<br />
<br />
The {{Pkg|wicd-gtk}} package puts a file in {{ic|/etc/xdg/autostart/wicd-tray.desktop}}, which will autostart {{ic|wicd-client}} upon login to your DE/WM. If so, enabling the service with {{ic|systemctl}} is sufficient. <br />
<br />
If {{ic|/etc/xdg/autostart/wicd-tray.desktop}} does not exist, you can add '''wicd-client''' to your DE/WM startup to have the application start when you log in.<br />
<br />
{{Note|If '''wicd-client''' is added to DE/WM startup when {{ic|/etc/xdg/autostart/wicd-tray.desktop}} exists, you will have an issue of two {{ic|wicd-client}} instances running.}}<br />
<br />
=== Scripts ===<br />
<br />
Wicd has the ability to run scripts during all stages of the connection process (post/pre connect/disconnect).<br />
Simply place a script inside the relevant stage folder within {{ic|/etc/wicd/scripts/}} and make it executable.<br />
<br />
The scripts are able to receive three parameters, these being: <br />
$1 - the connection type (wireless/wired).<br />
$2 - the ESSID (network name).<br />
$3 - the BSSID (gateway MAC).<br />
<br />
==== Stop ARP spoofing attacks ====<br />
<br />
The script below can be used to set a static ARP, to stop ARP spoofing attacks.<br />
Simply change the values within the case statement to match those of the networks you want to set static ARP entries for. Launch it as root:<br />
<br />
#!/bin/bash<br />
#Set the parameters passed to this script to meaningful variable names.<br />
connection_type="$1"<br />
essid="$2"<br />
bssid="$3"<br />
<br />
if [ "${connection_type}" == "wireless" ]; then<br />
<br />
#Change below to match your networks.<br />
case "$essid" in<br />
YOUR-NETWORK-NAME-ESSID)<br />
arp -s 192.168.0.1 00:11:22:33:44:55<br />
;;<br />
Netgear01923)<br />
arp -s 192.168.0.1 10:11:20:33:40:50<br />
;;<br />
ANOTHER-ESSID)<br />
arp -s 192.168.0.1 11:33:55:77:99:00<br />
;;<br />
*)<br />
echo "Static ARP not set. No network defined."<br />
;;<br />
esac<br />
fi<br />
<br />
==== Change MAC using macchanger ====<br />
<br />
See the [[MAC_Address_Spoofing#Systemd_unit_using_random_address|relative article]].<br />
<br />
The script below can be used to change the MAC address of your network interfaces.<br />
<br />
To change the MAC whenever you connect to a network, place this script under {{ic|/etc/wicd/scripts/preconnect/}}.<br />
<br />
Take a look at {{ic|macchanger --help}} to adjust the macchanger command to your liking.<br />
<br />
{{bc|<nowiki><br />
#!/usr/bin/env bash<br />
<br />
connection_type="$1"<br />
<br />
if [[ "${connection_type}" == "wireless" ]]; then<br />
ip link set wlp2s0 down<br />
macchanger -A wlp2s0<br />
ip link set wlp2s0 up<br />
elif [[ "${connection_type}" == "wired" ]]; then<br />
ip link set enp1s0 down<br />
macchanger -A enp1s0<br />
ip link set enp1s0 up<br />
fi<br />
</nowiki>}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Failed to get IP address ===<br />
<br />
If wicd repeatedly fails to get an IP address using the default dhcpcd client, try installing and using {{Pkg|dhclient}} instead. Do not forget to select dhclient as the primary dhcp client in wicd options afterwards!<br />
<br />
If wicd can get an IP address for a wired interface and is unable to get an IP address for a wireless interface, try disabling the wireless card's powersaving features:<br />
# iwconfig wlp2s0 power off<br />
<br />
=== Random disconnecting ===<br />
<br />
==== Cause #1 ====<br />
<br />
If dmesg says {{ic|1=wlp2s0: deauthenticating from MAC by local choice (reason=3)}} and you lose your Wi-Fi connection, it is likely that you have a bit too aggressive power-saving on your Wi-Fi card[http://us.generation-nt.com/answer/gentoo-user-wireless-deauthenticating-by-local-choice-help-204640041.html]. Try disabling the wireless card's power-saving features:<br />
# iwconfig wlp2s0 power off<br />
<br />
If you have the package {{Pkg|pm-utils}} installed, it may be the reason power-saving is on in your system[http://uselessuseofcat.com/?p=67]. You can put:<br />
<br />
{{bc|<br />
#!/bin/sh<br />
/usr/bin/iwconfig wlp2s0 power off<br />
}}<br />
<br />
into the file {{ic|/etc/pm/power.d/wireless}} (create it if it does not exist and make it executable) and see if things get better.<br />
<br />
If your card does not support {{ic|# iwconfig wlp2s0 power off}}, check the '''BIOS''' for power management options. Disabling PCI-Express power management in the BIOS of a Lenovo W520 resolved this issue.<br />
<br />
==== Cause #2 ====<br />
<br />
If you are experiencing frequent disconnections with wireless and dmesg shows messages such as <br />
<br />
{{ic|1=ieee80211 phy0: wlp2s0: No probe response from AP xx:xx:xx:xx:xx:xx after 500ms, disconnecting}}<br />
<br />
try changing the channel bandwidth to {{ic|20MHz}} through your router's settings page.<br />
<br />
=== Importing pynotify failed, notifications disabled ===<br />
<br />
In case the {{pkg|python2-notify}} package did not get installed automatically. You can [[pacman|install]] it from [[Official Repositories]].<br />
<br />
=== Dbus connection error message ===<br />
<br />
If wicd suddenly stopped working and it complains about dbus, it is quite likely that you just need to remove wicd fully, including and all its configuration files, and re-install it from scratch:<br />
# pacman -R wicd<br />
# rm -rf /etc/wicd /var/log/wicd /etc/dbus-1/system.d/wicd*<br />
# pacman -S wicd<br />
Check this link for more details: https://bbs.archlinux.org/viewtopic.php?pid=577141#p577141<br />
<br />
Wicd-client also throws a dbus connection error message ("Could not connect to wicd's D-Bus interface.") when wicd is not running due to a problem with a config file. It seems that sometimes an empty account gets added to /etc/wicd/wired-settings.conf in which case you simply have to remove the<br />
[] <br />
and restart wicd.<br />
<br />
=== Problems after package update ===<br />
<br />
Sometimes the wicd client fails to load after a package update due to D-Bus errors. <br />
<br />
A solution is to remove the config files in the {{ic|/etc/wicd/}} directory. <br />
# systemctl stop wicd<br />
# rm /etc/wicd/*.conf<br />
# systemctl start wicd<br />
<br />
=== Note about graphical sudo programs ===<br />
<br />
If you are receiving an error about wicd failing to find a graphical sudo program, install one of {{Pkg|gksu}}, {{AUR|ktsuss}}, or {{Pkg|kdebase-runtime}}, then use the relative command:<br />
<br />
$ ktsuss wicd-client -n<br />
<br />
$ gksudo wicd-client -n<br />
<br />
$ kdesu wicd-client -n<br />
<br />
=== Making eduroam work with wicd ===<br />
<br />
{{Note|You may try the AUR package {{AUR|wicd-eduroam}} first. It will appear in wicd as "eduroam". If it does not work for you, try the following.}}<br />
<br />
This profile will only work for eduroam institutions which use TTLS and will not work for PEAP (you can find a PEAP profile here: [http://csclub.uwaterloo.ca/~mtahmed/article/eduroam_wicd Eduroam wicd]).<br />
<br />
Save the following as {{ic|/etc/wicd/encryption/templates/ttls-80211}}<br />
{{hc|/etc/wicd/encryption/templates/ttls-80211|<nowiki><br />
name = TTLS for Wireless<br />
author = Alexander Clouter<br />
version = 1<br />
require anon_identity *Anonymous_Username identity *Identity password *Password <br />
protected password *Password<br />
optional ca_cert *Path_to_CA_Cert cert_subject *Certificate_Subject<br />
-----<br />
ctrl_interface=/var/run/wpa_supplicant<br />
network={<br />
ssid="$_ESSID"<br />
scan_ssid=$_SCAN<br />
<br />
key_mgmt=WPA-EAP<br />
eap=TTLS<br />
<br />
ca_cert="$_CA_CERT"<br />
subject_match="$_CERT_SUBJECT"<br />
<br />
phase2="auth=MSCHAPv2 auth=PAP"<br />
<br />
anonymous_identity="$_ANON_IDENTITY"<br />
identity="$_IDENTITY"<br />
password="$_PASSWORD"<br />
}<br />
</nowiki>}}<br />
<br />
Open a terminal<br />
<br />
# echo ttls-80211 >> /etc/wicd/encryption/templates/active<br />
<br />
Open wicd, choose TTLS for Wireless in the properties of eduroam, and enter the appropriate settings for your institution. The format of the subject match should be something like "/CN=server.example.com".<br />
<br />
NB. This only works in my institution by commenting {{ic|subject_match}}, which is not secure, but at least it connects.<br />
<br />
=== Two instances of wicd-client (and possibly two icons in tray) ===<br />
<br />
See the note in [[Wicd#Running_Wicd]] about the autostart file in {{ic|/etc/xdg/autostart}} and the forum post and bug report provided in [[Wicd#External_Links]]. Essentially, if {{ic|/etc/xdg/autostart/wicd-tray.desktop}} exists, remove it. You only need the {{ic|wicd}} service enabled in systemd.<br />
<br />
=== Bad password using PEAP with TKIP/MSCHAPV2 ===<br />
<br />
The connection template PEAP with TKIP/MSCHAPV2 requires the user to enter the path to a CA certificate besides entering username and password. However this can cause troubles resulting in a error message of a bad password [https://bbs.archlinux.org/viewtopic.php?pid=990385 *]. A possible solution is the usage of PEAP with GTC instead of TKIP/MSCHAPV2 which does not require to enter the path of the CA cert.<br />
<br />
=== Wicd skips obtaining IP address on wlp ===<br />
<br />
This can be caused by dhcpcd running alongside wicd as systemd service. A solution would be to stop/disable '''dhcpcd'''.<br />
<br />
== See also ==<br />
<br />
* [http://www.wicd.net/download.php Note on interfaces at the official site]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=114803 Forum post] about two instances of wicd-client and {{ic|/etc/xdg/autostart}}<br />
* [https://bugs.archlinux.org/task/22423 Bug report mentioning /etc/xdg/autostart and wicd-client behavior]</div>Daphronhttps://wiki.archlinux.org/index.php?title=Lenovo_IdeaPad_Y580&diff=257812Lenovo IdeaPad Y5802013-05-19T15:49:34Z<p>Daphron: Added missing fi to the bash script for enabling CUDA devices</p>
<hr />
<div>[[Category:Lenovo]]<br />
The Lenovo IdeaPad Y580 started shipping in June 2012. It is a fairly powerful machine, but it has its own compatibility issues. The purpose of this article is to help with setting up Arch Linux on this machine.<br />
<br />
==Installation==<br />
<br />
Install Arch on the machine if you have not done it already. Read [[Installation Guide]] for more information.<br />
<br />
== Ethernet ==<br />
If you cannot get ethernet working, you can get a 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. The links from QCA upstream [https://www.kernel.org/pub/linux/kernel/projects/backports/2013/03/04/compat-drivers-2013-03-04-u.tar.bz2 alx source files] works for current 3.8.x kernels.<br />
This sources is found to work for both AR8161 and AR8162 ethernet devices.<br />
Copy the tarball to a flash drive, boot the live cd, mount the flash drive, cd to the directory with the tarball and use:<br />
<br />
tar -xjvf compat*<br />
cd compat*<br />
./scripts/driver-select alx <br />
make<br />
sudo make install <br />
<br />
After this, load the module (modprobe alx) and you should be able to get ethernet working easily. As a alternative you can install dkms-alx from [https://aur.archlinux.org/packages/dkms-alx/ AUR] and it will recompile the module every reboot after a kernel upgrade.<br />
<br />
The machine comes with Windows and some Lenovo partitions that may be important if you need to recover the Windows install. <br />
<br />
In case you do not need to restore the machine to their original state, you can just delete the existing partition. Other way, backup the partions before erasing them<br />
<br />
Also, this laptop can use UEFI. If you want to use it, you need to a GPT partition (see below).<br />
<br />
==UEFI==<br />
Even thought its easier to switch from UEFI to legacy mode BIOS in this laptop and install Arch Linux on mSATA SSD and without disturbing factory installed windows 8 located on the HDD, this section will guide you to install Arch Linux with UEFI. UEFI is complicated and so proper understanding is advised before you start.<br />
<br />
Read these pages: [http://www.rodsbooks.com/bios2uefi/index.html Rod smith's UEFI guide] [[Unified Extensible Firmware Interface]] and [[GRUB2]].<br />
<br />
Among other things, you need a gpt partition and grub2. <br />
<br />
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.<br />
<br />
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:<br />
<br />
mkfs.vfat -F32 /dev/sda3 <br />
<br />
After you have your base system up and running, install the grub 2 firmware:<br />
<br />
pacman -S grub2-efi-x86_64<br />
<br />
Mount the system partition at /boot/efi:<br />
<br />
mkdir /boot/efi<br />
mount -t vfat /dev/sda3 /boot/efi<br />
<br />
Install grub2 efi app (grubx64.efi) to /boot/efi/EFI/arch_grub, and its modules to /boot/efi/EFI/grub/x86_64-efi:<br />
<br />
grub-install --directory=/usr/lib/grub/x86_64-efi --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --boot-directory=/boot/efi/EFI --recheck --debug<br />
mkdir -p /boot/efi/EFI/grub/locale<br />
cp /usr/share/locale/en@quot/LC_MESSAGES/grub.mo /boot/efi/EFI/grub/locale/en.mo<br />
<br />
The grub2 wiki page says to copy the app to other places. This is probably not necessary, but you may want to use:<br />
<br />
mkdir /boot/efi/EFI/tools<br />
cp /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/shellx64.efi<br />
cp /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/EFI/shellx64.efi<br />
cp /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/EFI/tools/shellx64.efi <br />
<br />
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:<br />
<br />
mount /dev/sdc1 /media<br />
mkdir -p /media/efi/boot<br />
cd /media/efi/boot<br />
wget https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi<br />
mv Shell.efi bootx64.efi<br />
cd /<br />
umount /media <br />
<br />
The code creates a directory /efi/boot in the flash drive, downloads the shell, copies it to /efi/boot and renames it as bootx64.efi. The shell is downloaded from the link given here: https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#UEFI_Shell. Note that you need a 2.0 shell, otherwise you will not be able to add an entry to the menu. <br />
<br />
Note that it is also possible to simply place the UEFI shell in your UEFI system partition if you do not have a flash drive at hand:<br />
wget https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi<br />
mkdir -p /boot/efi/EFI/boot<br />
mv Shell.efi /boot/efi/EFI/boot/bootx64.efi<br />
<br />
This will cause the ideapad UEFI firmware to automatically add a new boot option named "EFI HDD Device" which will by default come first.<br />
<br />
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/<br />
<br />
For now, you just need the command bcfg. To add Arch to the first entry of the menu, use:<br />
<br />
bcfg boot add 0 fs1:\EFI\arch_grub\grubx64.efi "Arch Linux" <br />
<br />
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. <br />
<br />
To see the menu entries, use:<br />
<br />
bcfg boot dump -v<br />
<br />
To delete, say the 3rd entry:<br />
<br />
bcfg boot rm 3<br />
<br />
Once you are happy with the menu entries, reboot and you should be able to boot into Arch.<br />
<br />
==Dual-Boot With Windows 8==<br />
<br />
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).<br />
<br />
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. In this example, Windows is going to be added to grub2.<br />
<br />
To do this, from Arch, mount the Windows system partition and find its UUID:<br />
<br />
mount /dev/sdb1 /mnt<br />
grub-probe --target=fs_uuid /media/EFI/Microsoft/Boot/bootmgfw.efi <br />
<br />
Take note of the output (something like 1ce5-7f28). Now copy the output of:<br />
<br />
grub-probe --target=hints_string /media/EFI/Microsoft/Boot/bootmgfw.efi<br />
<br />
Then, add something like this to /etc/grub.d/0_custom:<br />
<br />
menuentry "Microsoft Windows 8 x86_64 UEFI-GPT" {<br />
insmod part_gpt<br />
insmod fat<br />
insmod search_fs_uuid<br />
insmod chain<br />
search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 1ce5-7f28<br />
chainloader /efi/Microsoft/Boot/bootmgfw.efi<br />
}<br />
<br />
Finally generate the grub2 configuration file (grub.cfg):<br />
<br />
grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg<br />
<br />
Now you should be able to see an entry for Windows 8 on grub2.<br />
<br />
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):<br />
<br />
pacman -S os-prober<br />
==DISPLAY==<br />
Since the arrival of 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.<br />
===NVIDIA Card===<br />
<br />
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.<br />
<br />
===Nvidia Bumblebee support===<br />
In Linux currently [https://wiki.archlinux.org/index.php/Bumblebee 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 [https://wiki.archlinux.org/index.php/Bumblebee#Bumblebee:_Optimus_for_Linux bumblebee].<br />
<br />
===Driver===<br />
<br />
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.<br />
{{Note|The only exception being the 302.17}}<br />
<br />
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. <br />
<br />
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. <br />
<br />
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).<br />
<br />
===nvidia-utils PKGBUILD===<br />
{{bc|<nowiki><br />
# $Id$<br />
# Maintainer: Thomas Baechler <thomas@archlinux.org><br />
# Contributor: James Rayner <iphitus@gmail.com><br />
pkgbase=nvidia-utils<br />
pkgname=('nvidia-utils' 'opencl-nvidia')<br />
pkgver=304.60<br />
pkgrel=1<br />
arch=('i686' 'x86_64')<br />
url="http://www.nvidia.com/"<br />
license=('custom')<br />
options=('!strip')<br />
<br />
if [ "$CARCH" = "i686" ]; then<br />
_arch='x86'<br />
_pkg="NVIDIA-Linux-${_arch}-${pkgver}"<br />
source=("ftp://download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")<br />
md5sums=('42b9887076b2ebcf1af5ee13bc332ccb')<br />
elif [ "$CARCH" = "x86_64" ]; then<br />
_arch='x86_64'<br />
_pkg="NVIDIA-Linux-${_arch}-${pkgver}-no-compat32"<br />
source=("ftp://download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")<br />
md5sums=('7248399a125808e3bbc9c66da99a098d')<br />
fi<br />
<br />
create_links() {<br />
# create soname links<br />
while read -d '' _lib; do<br />
_soname="$(dirname "${_lib}")/$(readelf -d "${_lib}" | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')"<br />
[[ -e "${_soname}" ]] || ln -s "$(basename "${_lib}")" "${_soname}"<br />
[[ -e "${_soname/.[0-9]*/}" ]] || ln -s "$(basename "${_soname}")" "${_soname/.[0-9]*/}"<br />
done < <(find "${pkgdir}" -type f -name '*.so*' -print0)<br />
}<br />
<br />
build() {<br />
cd "${srcdir}"<br />
sh "${_pkg}.run" --extract-only<br />
}<br />
<br />
package_opencl-nvidia() {<br />
pkgdesc="OpenCL implemention for NVIDIA"<br />
depends=('libcl' 'zlib')<br />
optdepends=('opencl-headers: headers necessary for OpenCL development')<br />
cd "${srcdir}/${_pkg}"<br />
<br />
# OpenCL<br />
install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"<br />
install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"<br />
install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"<br />
<br />
create_links<br />
}<br />
<br />
package_nvidia-utils() {<br />
pkgdesc="NVIDIA drivers utilities and libraries."<br />
depends=('xorg-server' 'libxvmc')<br />
optdepends=('gtk2: nvidia-settings' 'pkg-config: nvidia-xconfig'<br />
'opencl-nvidia: OpenCL support')<br />
conflicts=('')<br />
provides=('libgl')<br />
cd "${srcdir}/${_pkg}"<br />
<br />
# X driver<br />
install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"<br />
# GLX extension module for X<br />
#install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.${pkgver}"<br />
#ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" # X does not find glx otherwise<br />
# OpenGL library<br />
#install -D -m755 "libGL.so.${pkgver}" "${pkgdir}/usr/lib/libGL.so.${pkgver}"<br />
# OpenGL core library<br />
install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"<br />
# XvMC<br />
install -D -m644 libXvMCNVIDIA.a "${pkgdir}/usr/lib/libXvMCNVIDIA.a"<br />
install -D -m755 "libXvMCNVIDIA.so.${pkgver}" "${pkgdir}/usr/lib/libXvMCNVIDIA.so.${pkgver}"<br />
# VDPAU<br />
install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"<br />
# nvidia-tls library<br />
install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"<br />
install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"<br />
<br />
install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"<br />
# CUDA<br />
install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"<br />
install -D -m755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"<br />
<br />
# nvidia-xconfig<br />
install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"<br />
install -D -m644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"<br />
# nvidia-settings<br />
install -D -m755 nvidia-settings "${pkgdir}/usr/bin/nvidia-settings"<br />
install -D -m644 nvidia-settings.1.gz "${pkgdir}/usr/share/man/man1/nvidia-settings.1.gz"<br />
install -D -m644 nvidia-settings.desktop "${pkgdir}/usr/share/applications/nvidia-settings.desktop"<br />
install -D -m644 nvidia-settings.png "${pkgdir}/usr/share/pixmaps/nvidia-settings.png"<br />
sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i "${pkgdir}/usr/share/applications/nvidia-settings.desktop"<br />
# nvidia-bug-report<br />
install -D -m755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"<br />
# nvidia-smi<br />
install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"<br />
install -D -m644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"<br />
<br />
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/nvidia/LICENSE"<br />
ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-utils"<br />
install -D -m644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"<br />
install -D -m644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"<br />
ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"<br />
<br />
create_links<br />
}<br />
<br />
</nowiki>}}<br />
<br />
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).<br />
<br />
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.<br />
<br />
===CUDA Toolkit===<br />
<br />
Install the package from community (https://www.archlinux.org/packages/community/x86_64/cuda/).<br />
<br />
===Configurations===<br />
<br />
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:<br />
<br />
{{bc|<nowiki><br />
/sbin/modprobe acpi-handle-hack<br />
/sbin/modprobe nvidia<br />
<br />
if [ "$?" -eq 0 ]; then<br />
<br />
# Count the number of NVIDIA controllers found.<br />
<br />
N3D=`lspci | grep -i NVIDIA | grep "3D controller" | wc -l`<br />
<br />
NVGA=`lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`<br />
<br />
N=`expr $N3D + $NVGA - 1`<br />
<br />
for i in `seq 0 $N`; do<br />
mknod -m 666 /dev/nvidia$i c 195 $i<br />
done<br />
<br />
mknod -m 666 /dev/nvidiactl c 195 255<br />
else<br />
exit 1<br />
fi<br />
</nowiki>}}<br />
<br />
If you are using systemd, you can get the /etc/rc.local loaded at boot by adding a new service. Create the following file:<br />
<br />
{{bc|1=<br />
#/etc/systemd/system/rc-local.service<br />
<br />
[Unit]<br />
Description=/etc/rc.local Compatibility<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/etc/rc.local<br />
TimeoutSec=0<br />
StandardInput=tty<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Then make this service load at boot with:<br />
<br />
systemctl enable rc-local.service<br />
<br />
===Testing it===<br />
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:<br />
<br />
cd /opt/cuda/samples/1_Utilities/deviceQuery<br />
make<br />
./deviceQuery<br />
<br />
Alternatively, you can compile your own code and run it. To compile, say hello.cu, use:<br />
<br />
nvcc hello.cu<br />
<br />
Now you can run the executable:<br />
<br />
./a.out<br />
<br />
If this works without errors, you are all set!<br />
<br />
==Other Distributions==<br />
<br />
1.The above setup not only works only with Arch Linux 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: <br />
<br />
apt-get install nvidia-current<br />
<br />
2. For Debian wheezy you shall need the lenovo-hack as described above and additional packages from [http://suwako.nomanga.net/ suwako repos] which has dkms-bbswtich bumblebee and bumblebee-nvidia.The easiest option is available from Debian. No need to blacklist anything. The ethernet alx driver is included in Debian kernel since linux-image-3.2.39.1.<br />
<br />
3. For Fedora, RHEL 6.X series and its clones the external repos from [http://techies.ncsu.edu/wiki/bumblebee ncsu.edu] with installation of non-free nvidia from their non-free repos at [http://techies.ncsu.edu/wiki/bumblebee-nvidia bumblebee-nvidia] is necessary. Installing nvidia from rpmfusion shall break your X. You will have to edit the connected monitor section to "CRT-0" from "FDP" in Fedora 18 in case if the default configuration does not work. You will have to blacklist nouvea drivers at kernel command line to (xdriver=vesa nouveau.modeset=0 rd.driver.blacklist=nouveau).<br />
<br />
4. Starting from 3.8.5 kernel you will not need to patch the kernel for proper acpi handling for any distro.</div>Daphron