Bug 967216

Summary: Device is offline if adb started via systemd
Product: [Fedora] Fedora Reporter: Richard Körber <redhat>
Component: android-toolsAssignee: Ivan Afonichev <ivan.afonichev>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: ivan.afonichev, thomas.moschny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: android-tools-20141219git8393e50-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1248836 (view as bug list) Environment:
Last Closed: 2015-02-15 03:20:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1248836    

Description Richard Körber 2013-05-25 15:24:11 UTC
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):
android-tools-20130123git98d0789-1.fc18.x86_64

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.

Comment 1 Ivan Afonichev 2013-05-25 17:34:36 UTC
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 
[Service]
Environment=HOME=/root/

Comment 2 Richard Körber 2013-05-26 12:46:09 UTC
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...

Comment 3 Fedora End Of Life 2013-12-21 13:43:38 UTC
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.

Comment 4 Thomas Moschny 2014-09-16 13:21:33 UTC
Ping, any news here?

Comment 5 Fedora Update System 2015-01-18 22:09:48 UTC
android-tools-20141219git8393e50-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/android-tools-20141219git8393e50-2.fc21

Comment 6 Fedora Update System 2015-01-20 21:05:12 UTC
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:
https://admin.fedoraproject.org/updates/FEDORA-2015-0938/android-tools-20141219git8393e50-2.fc21
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2015-02-15 03:20:29 UTC
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.