Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

After upgrading from 12.10 to 13.04 I am having issues with connecting my Google Nexus to my Ubuntu machine.

I have found this script somewhere on the Internet but it does not seem to work now :

#!/bin/bash

if [ `lsusb |grep Google |wc -l` == 0 ]; then
    echo "plug in the device"
    exit 1
fi

if [ `dpkg -l mtpfs |wc -l` == "0" ]; then
    sudo apt-get update && sudo apt-get install mtpfs
fi

rules_file=/etc/udev/rules.d/60-android.rules
if [ ! -f $rules_file ]; then
    vp=`lsusb|grep Google|cut -d " " -f 6`
    vendor=`echo $vp | cut -d ':' -f 1`
    product=`echo $vp | cut -d ':' -f 2`
    rule="SUBSYSTEM==\"usb\", ATTR{idVendor}==\"$vendor\", ATTR{idProduct}==\"$product\", MODE=\"0600\", GROUP=\"plugdev\" OWNER=\"$USER\""
    sudo bash -c "echo $rule > $rules_file"
fi  

mount_point=/media/nexus
if [ ! -d $mount_point ]; then
    sudo mkdir $mount_point
    sudo chmod 775 $mount_point
fi  
sudo mtpfs -o allow_other $mount_point

After launching it I get :

Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
Device 0 (VID=xxxx and PID=yyyy) is a Google Inc (for LG Electronics/Samsung) Nexus 4/10 (MTP).
   Found 1 device(s):
   Google Inc (for LG Electronics/Samsung): Nexus 4/10 (MTP) (xxxx:yyyy) @ bus 2, dev 4
Attempting to connect device
ignoring libusb_claim_interface() = -6PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
Android device detected, assigning default bug flags
Error 1: Get Storage information failed.
Error 2: PTP Layer error 02fe: get_handles_recursively(): could not get object handles.
Error 2: Error 02fe: PTP: Protocol error, data expected
Listing File Information on Device with name: (NULL)
LIBMTP_Get_Storage() failed:-1
share|improve this question

2 Answers 2

up vote 1 down vote accepted

Try updating mtp?

sudo add-apt-repository ppa:langdalepl/gvfs-mtp
sudo apt-get update

Then, launch Software Updater (previously known as Update Manager) and install the available updates

share|improve this answer

With 13.04, you should not need to use any external scripts, and mtpfs itself doesn't work with modern Android devices like the Nexus 4 anyway.

Assuming you're using the default Unity desktop with Nautilus, then it is sufficient to just plug your device in and it should appear in Nautilus and you can browse it and copy files to/from the device.

If you want to get full access to files, so that normal applications can directly open files on the device, you need a newer version of gvfs, as discussed here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.