Wednesday, November 4, 2009

Ubuntu 9.10 and ADT 0.94 tangle

[2010-02-03 Update: The permissions issues are due to changes in the policykit support and the move to udev. The details are here. Go straight to Section 10. It's actually now very easy to set this up. You can add the GROUP="plugdev" parameter to the end of of the SUBSYSTEMS statements....then add your user to the plugdev group. You then do not need to run adb as root.


[2009-11-26 Update: My permissions problems talking to my real HTC Magic phone inexplicably returned after a couple of reboots. I had not changed a thing. Annoyed, I search again for possible solutions. I found these excellent docs, which included the section below. I already have the rules file, but these statements were different to those suggested elsewhere for Ubuntu and different to the single line I had been using. This part fixed my problem with not being able to talk to my phones, allowing me to access them via adb and / or fastboot provided I run the adb server and fastboot using sudo. DDMS is fine, provided adb server was started using sudo.

10d) In Ubuntu, create a new rules file for these vendor:device IDs.

Type this command to create the file.

$ sudo gedit /etc/udev/rules.d/51-android.rules

Add the following blue lines (rules) to it and save the file. If your lsusb command reports other, newer product IDs for vendor 0bb4, add them also to the file.

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c01", MODE="0666" 

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c02", MODE="0666"
If this helps anyone, please let me know in the comments.]


[2009-11-22 Update: I upgraded to Ubuntu 9.10 (Karmic Koala) again today. This time I did NOT remove the packages the upgrade notified as no longer supported. Last time, I had said OK to their removal. This time, everything works fine: adb and ddms can see my phone. Fastboot (run using sudo) is able to load and boot a temporary image. The key - for me - seems to have been to avoid letting the upgrade / update process remove the pre-existing policykit package.]

[2009-11-15 Update: I wiped the drive and reloaded Ubuntu 9.04. I installed the Java SDK, the Android SDK 2.0, ADT 0.94 and Eclipse 3.5. I followed all of my own advice, and that I had gleened from others....and ONLY after I had adjusted the permissions settings using polkit-gnome-authorizations was I finally able to access my phone again via ddms and adb. Given they (Ubuntu) appear to have removed this security configuration app (polkit-gnome-authorizations) from Ubuntu 9.10, I don't recommend upgrading to that unless you are handy with the back end of the permissions policy side of Gnome / polkit and can write your own API-compliant, policy files in XML from scratch. I'm not...and don't want to be. I'm trying to fry other fish.

But I got it going again....







(Original post resumes below) ]

Last night I had a bright idea and upgraded my Android SDK 2.0 system from Ubuntu 9.04 (Jaunty Jackelope) to 9.10 (Karmic Koala).

Everything went (almost) perfectly. The Eclipse 3.5 dev environment runs fine. I can create and run Android 2.0 emulators with no issues. But ddms (the Dalvik VM tool in Android SDK Tools) is no longer able to identify my real android cell  phone. It sees the device, but doesn't pick up any information from it. Instead, I get a string of "???????" where the device ID should be.

I'm assuming it is a security / permissions issue post-Ubuntu upgrade....and hope to sort it out later. I'll update this post if I work it out.....or not.

Be warned that any such upgrade as the one above isn't likely to be seamless.

2009-11-04 - Update: This is definitely a permissions problem. Trying to list the device with adb gives:

List of devices attached 
???????????? no permissions

Now...How to set the permissions? I've set up the policy files. They don't appear to be working. I've seem some bugs listed on Launchpad for Policykit. Not sure how to interpret what I'm reading.

This bug on Launchpad seems to explain things. They appear to have made some changes without regard to usabililty.

https://bugs.launchpad.net/ubuntu/+source/checkbox/+bug/435714

Trying to access the  phone with ddms give me more permissions errors:
55:16 W/ddms: Unable to get frame buffer: device (????????????) request rejected: insufficient permissions for device
55:18 W/ddms: Unable to get frame buffer: device (????????????) request rejected: insufficient permissions for device

I have also tried running it as sudo:

steve@media:~/android-sdk-linux_x86-1.6_r1/tools$ sudo ./adb devices
List of devices attached
????????????    no permissions

No good.

13 comments:

  1. Hi,

    have you tried to start the adb server deamon as root ? This solves the permission problem for me.

    Just use sudo to start the adb for the first time, right after you can work with adb and normal user rights.

    ReplyDelete
  2. Ziggo: I tried "sudo adb devices" and it told me the command wasn't found. I also tried using the complete path to the file and it still said it couldn't find it. It may be that the command is on the PATH for my user, but not for the whole system, so sudo can't see it. Thanks for the idea! I'll try it later. It would be good to have it working again without having to reload / re-install anything.

    ReplyDelete
  3. As Ziggo said starting adb as root solves the problem:

    adb kill-server
    sudo adb start-server
    adb devices

    Thanks Ziggo!

    ReplyDelete
  4. Thanks. Problem solved here too.

    ReplyDelete
  5. I'm feeling lonely. This solution didn't work for me. I wiped the drive and went back to Ubuntu 9.04. I'll upgrade again later when the polkit-1 stuff is sorted out.

    ReplyDelete
  6. I am using Mint Linux 7, based on Ubuntu 9.04.

    $ cd /usr/lib/android/tools
    $ sudo ./adb devices

    Now lists my device correctly, where previously it was a string of question marks.

    ReplyDelete
  7. Wayne K, worked perfectly for me thanks when I started it up that way. Can run ddms or see in eclipse now. Thanks!

    ReplyDelete
  8. Remember to close eclipse if you're running it.

    ReplyDelete
  9. Running as root can't possibly be the real solution to this problem!

    ReplyDelete
  10. SIM: You're right. It isn't necessary to run these as root. I've since learned how it should work and have added an update to this post at the top pointing to the solution.

    ReplyDelete
  11. You need to be administrator and start the adb server.

    Try following commands

    $>sudo adb kill-server
    $>service udev restart
    $>suo adb devices

    This should do the trick. Atleast this worked for me.

    ReplyDelete
  12. Here's what solved the permissions issue for me with Ubuntu 10.04 Lucid Lynx, a Motorola Droid
    1) Ensure USB debugging is enabled on the phone: Settings->Applications->Development->USB Debugging
    2) Add the following line to /etc/udev/rules.d/ (I put it into a file I called "android.rules" in that directory): SUBSYSTEMS=="usb", ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="41db", MODE="0666"

    It looks like Motorola uses separate product ids for the USB debugging interface from the file system interface (or something like that.) The other Droid idProduct value is 41d9 but this solution worked for me when I used 41db.

    ReplyDelete
  13. GUYS I THINK U ARE MISSING ONE POINT U SHOULD SEE FIRST THAT ALL: WHAT VENDOR ID AND PRODUCT ID UR MOTOROLA CLIQ IT HAS, FOLLOW THE LINK ABOVE WHERE IT SAYS "HERE" THE LINK IS http://www.futuredesktop.org/developing_android_apps_on_ubuntu.html, AND LOOK FOR #10c IN LINUX U HAVE TO LOOK FOR THE PRODUCT & VENDOR IDS, I USE lsusb AND THE IDS WERE DIFFERENT THAN THE ONES IN THE POST IT WORKS FOR ME I HAVE UBUNTU 10.4 MOTOROLA CLIQ HOPE UNDERSTAND AND THIS HELPS

    ReplyDelete

Thanks for deciding to share your thoughts here. In commenting on this blog, you can express any opinion you like, though any opinion expressed should make some attempt to be consistent with verifiable reality. Say what you like, confident that I won't delete any comments that are polite and respectful of me and others who may comment here. Civility aside, SPAM comments will be deleted if only because they are usually far too long and selling rubbish anyway. (Comments on posts older than 30 days are moderated. I'll approve them as soon as I can.)