Bug 1248836

Summary: Device is offline if adb started via systemd
Product: [Fedora] Fedora EPEL Reporter: Josh Stone <jistone>
Component: android-toolsAssignee: Adam Miller <admiller>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: admiller, extras-qa, ivan.afonichev, redhat, thomas.moschny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 967216 Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 967216    
Bug Blocks:    

Description Josh Stone 2015-07-30 23:49:42 UTC
I have this same problem with android-tools-20130123git98d0789-5.el7.x86_64, and it does work for me to add a HOME to adb.service.

+++ This bug was initially created as a clone of Bug #967216 +++

Description of problem:
When starting adb via systemctl, the connected Android device is always "offline". However, when starting adb directly, the device is reachable.

Version-Release number of selected component (if applicable):

How reproducible:
Always. Tried on two different systems with FC18 installed.

Steps to Reproduce:
1. USB connect an Android device with Android 4.2.2 and USB debugging enabled
2. sudo systemctl start adb
3. adb devices --> will show that the device is attached, but offline
4. sudo systemctl stop adb
5. sudo adb start-server
6. adb devices --> will show that the device is attached and available

Actual results:
Device is always offline when adb was started via systemctl, but available when adb start-server was invoked as root.

Expected results:
Device should be available on both ways.

Additional info:
On both cases, ps shows a process "adb -P 5037 fork-server server" which is owned by root. I cannot find a reason why it shouldn't work with systemctl.

--- Additional comment from Ivan Afonichev on 2013-05-25 10:34:36 PDT ---

It seems adb needs $HOME dir to create .android/ dir and generate public keys here.

What is your opinion where adb should place this data? Should it be /root/ or something else?

Temporary workaround for this bug:
Create /etc/systemd/system/adb.service with contents like here:

[root@van-ssd ~]# cat /etc/systemd/system/adb.service 
.include /lib/systemd/system/adb.service 

--- Additional comment from Richard K├Ârber on 2013-05-26 05:46:09 PDT ---

Thanks for the workaround.

I don't think system services should use /root for storing data. I created /var/lib/adb/ and let the Environment=HOME point there. Now the adb service works fine.

However, as I don't know too much about Linux internas, maybe there is a better location for the adb home directory...

--- Additional comment from Fedora End Of Life on 2013-12-21 05:43:38 PST ---

This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

--- Additional comment from Thomas Moschny on 2014-09-16 06:21:33 PDT ---

Ping, any news here?

--- Additional comment from Fedora Update System on 2015-01-18 14:09:48 PST ---

android-tools-20141219git8393e50-2.fc21 has been submitted as an update for Fedora 21.

--- Additional comment from Fedora Update System on 2015-01-20 13:05:12 PST ---

Package android-tools-20141219git8393e50-2.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing android-tools-20141219git8393e50-2.fc21'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

--- Additional comment from Fedora Update System on 2015-02-14 19:20:29 PST ---

android-tools-20141219git8393e50-2.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.