Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Android adb command no longer detects phone [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3385

PostPosted: Thu Sep 14, 2017 12:31 am    Post subject: Android adb command no longer detects phone [SOLVED] Reply with quote

The adb command no longer detects my Android phone when it's plugged in.
Code:
$ adb devices
List of devices attached

$


From dmesg:
Code:
[54534.226552] usb 1-5: new high-speed USB device number 13 using ehci-pci
[54534.364423] usb 1-5: New USB device found, idVendor=12d1, idProduct=1052
[54534.364428] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[54534.364430] usb 1-5: Product: Android
[54534.364432] usb 1-5: Manufacturer: Android
[54534.364434] usb 1-5: SerialNumber: GFMDU17415000647
[54534.383709] usb-storage 1-5:1.2: USB Mass Storage device detected
[54534.383923] scsi host5: usb-storage 1-5:1.2
[54534.384717] udevd[2103]: RUN{builtin}: 'uaccess' unknown /lib64/udev/rules.d/73-seat-late.rules:15
[54535.407466] scsi 5:0:0:0: CD-ROM            Linux    File-CD Gadget   0310 PQ: 0 ANSI: 2
[54535.408934] sr 5:0:0:0: [sr1] scsi3-mmc drive: 0x/0x caddy
[54535.409225] sr 5:0:0:0: Attached scsi CD-ROM sr1
[54535.409357] sr 5:0:0:0: Attached scsi generic sg2 type 5


By the way, the vendor/product matches what I see with "lsusb".

Based on suggestions, I added udev rules:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0660", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1052", SYMLINK+="android_adb"
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1052", SYMLINK+="android_fastboot"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0660", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", SYMLINK+="android_adb"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", SYMLINK+="android_fastboot"


And I get the expected devices:
Code:
lrwxrwxrwx 1 root root        15 Sep 13 20:20 libmtp-1-5 -> bus/usb/001/013
lrwxrwxrwx 1 root root        15 Sep 13 20:20 android_fastboot -> bus/usb/001/013
lrwxrwxrwx 1 root root        15 Sep 13 20:20 android_adb -> bus/usb/001/013


By the way, I have enabled USB debugging.

Now here's the thing. For many years, I was successfully flashing CyanogenMod happily onto my Samsung Galaxy S Relay, and in the last half-year of its service life I was building ROM images myself for flashing. But the updates stopped in Nov 2016, CM died at the end of Dec 2016, and that's my last flash, so I quit connecting it.

The other day I got an Honor 5X to replace the Relay, and started preparing to flash it to LineageOS. As I said, adb doesn't detect it. So I grabbed my old Relay and plugged it in. Now adb doesn't find it, either. I tried adding udev rules for it also, to no avail. (That's why there are six rules above, three for the Honor 5X and three for the Relay.)

I also saw that one can put something in ".android/adb_usb.ini", but you're supposed to do that with the "android" command, not by hand. (I tried by hand, anyway, no go.) But though I have "android-sdk-update-manager" installed, and have "adb" and "fastboot", I don't have "android". I've also seen suggestions to disable fastboot, but I need fastboot in order to unlock the phone.

Open to suggestions...
_________________
.sigs waste space and bandwidth


Last edited by depontius on Tue Sep 19, 2017 4:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Thu Sep 14, 2017 6:00 am    Post subject: Re: Android adb command no longer detects phone Reply with quote

depontius wrote:
...grabbed my old Relay and plugged it in. Now adb doesn't find it, either. ...

Most times that happens to me (using dev-util/android-tools ) is caused by
  • bad cable (gets easily solved by using another cable)
  • forgetting to switch the device into recovery mode
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3385

PostPosted: Thu Sep 14, 2017 6:56 am    Post subject: Reply with quote

I've been using android-sdk-update-manager, but I can put android-tools on another computer and try that.

I did have one cable with no response at all, but I put another cable in and the udev response was triggered, at least. I have a third cable I can try.

I never had to put my Relay into recovery in order to talk. In fact, "adb reboot recovery" was usually how I got to recovery.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3385

PostPosted: Fri Sep 15, 2017 1:26 am    Post subject: Reply with quote

Progress...

I've read a bunch of various things, been searching, etc. So I took one short-term diagnostic action, just now. I ran "adb devices" as root. Well, since I'm running from the android-sdk-update-manager, I had to give it a full path, but anyway, I ran it that way.
Code:
# /opt/android-sdk-update-manager/platform-tools/adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
GFMDU***********        unauthorized


So my problem is my udev rules - apparently they're not getting run, or at least part of them.

Now it gets weird.

The new phone is the one that worked for root with "adb devices", but none of the symlinks were created. Then I plugged in my old phone, the one that I flashed on this same computer, back at the end of December, and for a few years before that. For the old phone, the symlinks get created, but root can't find it with "adb devices". I also noticed that tonight and when I began this thread the created symlinks have the group "root", not "plugdev" or "android". Next thing is that I never requested "libmtp-1-5" be created - some other udev rule did that. I appear to have found "/lib/udev/rules.d/69-libmtp.rules" which at least contains the line to create the libmtp symlink for the new phone. But that rule would set the group to "plugdev".

I just noticed that my rule attempts to change the group to "android", while the existing rule attempts to change it to "plugdev". Considering that that conflict might result in no change, I changed mine to "plugdev" as well. No change to symptoms... I didn't rerun adb as root, but the new phone creates no symlinks, the old phone does.

Next question... There is also a file, "/lib/udev/rules.d/80-android.rules" that attempts to change the group of my old phone to "android" - perhaps that group name conflict I mentioned above, and this conflict exists in the Gentoo-shipped rulesets, not mine. However my new phone is not in that rule set, so the conflict should not exist for it. OK, I copied it to /etc/udev/rules.d and tweaked both GROUP and MODE to match the other rules I'd done. Still no symlinks for the new phone, but adb still detects it.

Somewhere in here I noticed that I've been working with idProduct=1052, but now see that lsusb tells me 1054. So I've fixed my rule, but still get no symlinks. I'd expect to not see the libmtp symlink, since it has the wrong product, and there is no rule for the right one.

No solution yet, but at least progress.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 443
Location: Brazil

PostPosted: Fri Sep 15, 2017 2:16 am    Post subject: Reply with quote

I've also had this problem. It always comes down to a bad cable or the phone not working with USB 3.0 ports.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Fri Sep 15, 2017 11:14 am    Post subject: Reply with quote

Usally

Quote:
List of devices attached
GFMDU*********** unauthorized


Means that you have not allowed on your android device, aka phone tablet, give authorization aka permissions to allow connections from other computers via usb cable

=> assuming google nexus products => developer mode => usb developer subsection somewhere hidden
=> my samsung android tablet sm-tm580 is kinda similar

--

could be a messed up home folder, messed up phone
try with a new user + try with a newly flashed android device (or ensure you will be able to redo those permissions) usually you get on samsung tablet for example => device connected via usb => which type you want to use => usb debugging => allow computer xy connection

--

on samsung tablet for example the android debug bridge is heavily locked down, i asked support how to enable it, and only a subset is allowed compared to google nexus 4, google nexus 7 year 2012.

--

i do not need any udev rules with

~amd64 gentoo, openrc + eudev

--

Quote:
ASUS-G75VW roman # emerge -pv android-sdk-update-manager

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] dev-util/android-sdk-update-manager-24.4.1::gentoo 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
ASUS-G75VW roman #


my user roman:

Code:
roman@ASUS-G75VW ~ $ adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
snipp device code ... unauthorized

roman@ASUS-G75VW ~ $


big window pops up on my nexus 4, saying

"allow usb debugging?"

computer RSA key ....

box unchecked, always allow from this computer

set box, click ok

redo in terminal as ordinary user roman

Code:
roman@ASUS-G75VW ~ $ adb devices
List of devices attached
*****   device

roman@ASUS-G75VW ~ $


--

for example, after this:

Code:
adb logcat


prints lots of lines ...

--

also use a new cable when you try to find an error:
sorry for advertisement, rampow cable seems to be expensive but quaity for the ordinary smartphone usb cable type
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3385

PostPosted: Fri Sep 15, 2017 11:44 am    Post subject: Reply with quote

Now that you mention it, I seem to remember the "Authorize this computer" popup, but that was many years ago, the first time I connected my wife's and my Relays. We just got a pair of Huawei Honor 5X phones, so this is bringing up from scratch and ancient memories.

The annoying side... I flashed the Relays to CM11 about as soon as I got them, and kept them up-to-date for years. The last Google update was Nov 2016, and there may have been a few generic CM11 updates that crept in after that. The CM11 maintainer for the Relay was laid off by CM at the end of July, so somewhere in there I learned to be a code-monkey and build my own ROM images. Didn't really know what I was doing, but was able to build from the git pull. That ended in Dec 2016, so it has been over 8 months since my phone has been updated.

Enter the new Huawei phones. I chose them because they're dual-sim for travel, dual-camera for my wife, and planned for Lineage OS Oreo support. Anyway, they came out of the box running Android Lollipop, and upon powering up about the first thing they did was update themselves to Android Marshmallow.

According to "About Phone" the build date for their MM is May, 2016. My Relays have an older Android release, but from a security point of view are more up-to-date than my brand new phones. That's why I insist on Lineage OS support, so I can do this properly, since the manufacturers aren't going to.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 523
Location: Germany

PostPosted: Fri Sep 15, 2017 12:54 pm    Post subject: Reply with quote

In my case, I couldn't see my phone with adb which is part of dev-util/android-tools, but when I've installed adb from Google web-site, that one picked up my phone without any problem.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 22048
Location: here

PostPosted: Fri Sep 15, 2017 1:07 pm    Post subject: Reply with quote

I have the occasional that adb doesn't see my phone, with the same cable used before. My solution is
  • unplug cable from phone
  • disable usb debugging
  • enable usb debugging
  • plug cable to phone

_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3385

PostPosted: Tue Sep 19, 2017 4:07 pm    Post subject: Reply with quote

The SOLUTION...

I'm not sure where in my thrashing I found it, and there may have been some sequence-of-events stuff in here, too. Anyway, I now have:
Code:
$ cat /etc/udev/rules.d/80-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="adbusers"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0664", GROUP="adbusers"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0664", GROUP="adbusers"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="adbusers"
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0660", GROUP="adbusers"


and I'm working. I scabbed this from somewhere else and added the last line to cover my new phone. Now that I look, I see that the permissions I added are just a tweak tighter then those where I got the rule. In addition, I re-discovered why I couldn't see my old Relay. It was a good idea, and I would suggest it to everyone as a security feature.

When you're not doing something yourself with the phone on USB, other than charging it, turn USB debugging off. Let's say your phone is sitting there, securely locked, but with USB enabled. Someone can plug it in and they have immediate access. I don't know if it can be unlocked that way, but they can surely "adb pull" or "adb reboot recovery" and then install their own zipfile. (I went into my Relay, turned USB Debugging back on, and adb could see it again.)
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Tue Sep 19, 2017 4:34 pm    Post subject: Reply with quote

depontius wrote:
When you're not doing something yourself with the phone on USB, other than charging it, turn USB debugging off. Let's say your phone is sitting there, securely locked, but with USB enabled. Someone can plug it in and they have immediate access. I don't know if it can be unlocked that way, but they can surely "adb pull" or "adb reboot recovery" and then install their own zipfile. (I went into my Relay, turned USB Debugging back on, and adb could see it again.)

There should be authorization step before access when plugging it in new computer. Those authorizations can be revoked from phones developer options menu. If you do not select always allow option, it should ask permission every time even in same computer.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Sep 19, 2017 4:52 pm    Post subject: Reply with quote

P.Kosunen wrote:
depontius wrote:
When you're not doing something yourself with the phone on USB, other than charging it, turn USB debugging off. Let's say your phone is sitting there, securely locked, but with USB enabled. Someone can plug it in and they have immediate access. I don't know if it can be unlocked that way, but they can surely "adb pull" or "adb reboot recovery" and then install their own zipfile. (I went into my Relay, turned USB Debugging back on, and adb could see it again.)

There should be authorization step before access when plugging it in new computer. Those authorizations can be revoked from phones developer options menu. If you do not select always allow option, it should ask permission every time even in same computer.


rsa key to be allowed on the phone / tablet side
I assume you use a screensaver + password when you leave your computer

--

more worse is to enable mtp protocol on your tablet / phone. That does not ask for permissions to move / remove / add files (just saw it today ) default for samsung tablet

one more reason to have an access pattern / code for your android device

--

adb reboot recovery

does only work with a rooted device. Does not work with samsung tablet, as there is no software to root it on linux. only fishy windows software which is not really clear, how to obtain, what is really done.

--

when you leave your android nexus 4 phone for example, the google reference hardware alone, anyone can tamper with it, because of the keys how to enter hte bootloader, does not really ask for anything. so basically anyone who has access to a nexus 4 can tamper it.

Well no one leaves his phone / tablet unattended anyway. Possibility of Theft !

--

adb pull

does not matter

mush worse is to pull some files

--

verdict, andrid is not a safe platform, binary firmware, which does not allow to update the kernel version. known risks from qualcom and the other mayor brands. samsung is also not the best platform, no way to secure root, unlock the hardware without windows, not official supported.


--

Someone can plug it in and they have immediate access.

is already the case with the google nexus 4, reference hardware. turn it off, enter the bootloader and do something without any interference!

--
Code:

ASUS-G75VW roman # cat /etc/udev/rules.d/
70-persistent-net.rules  80-net-name-slot.rules   80-net-setup-link.rules  99-keyboard-led.rules 


No idea why you need such udev rules for your phone

when you are paranoid, never leave your hardware alone, set usb mode to charging only.
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Thu Sep 21, 2017 1:35 pm    Post subject: Reply with quote

Roman_Gruber wrote:
more worse is to enable mtp protocol on your tablet / phone. That does not ask for permissions to move / remove / add files (just saw it today ) default for samsung tablet

It has to be enabled each time you plug it from phone/tablet side since Marshmallow, it can't be enabled permanently anymore.

Roman_Gruber wrote:
when you leave your android nexus 4 phone for example, the google reference hardware alone, anyone can tamper with it, because of the keys how to enter hte bootloader, does not really ask for anything. so basically anyone who has access to a nexus 4 can tamper it.

Only if you have unlocked bootloader.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum