autoadb icon indicating copy to clipboard operation
autoadb copied to clipboard

autoadb with systemd; adb not found(?)

Open horror-vacui opened this issue 5 years ago • 2 comments

I have trouble automatically start autoadb. I know that the error is possibly in my systemd config, but all the error messages come from autoadb, and I hope that you could explain what the error messages exactly mean, to diagnose the issue.

zoltan@aprosag ~/.config/systemd/user $ systemctl --user status autoadb
● autoadb.service - autoadb
   Loaded: loaded (/home/zoltan/.config/systemd/user/autoadb.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-09-02 17:19:49 CEST; 4min 52s ago
 Main PID: 6427 (autoadb)
   CGroup: /user.slice/user-1000.slice/[email protected]/autoadb.service
           └─6427 /home/zoltan/git_repos/autoadb/target/release/autoadb scrcpy -s {}

Sep 02 17:19:49 aprosag systemd[2360]: Started autoadb.
Sep 02 17:19:49 aprosag autoadb[6427]: Detected device 73QDU17107002001
Sep 02 17:19:49 aprosag autoadb[6427]: INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
**Sep 02 17:19:49 aprosag autoadb[6427]: exec: No such file or directory**
Sep 02 17:19:49 aprosag autoadb[6427]: ERROR: Command not found: [/usr/bin/adb], [-s], [73QDU17107002001], [push], [/usr/local/share/scrcpy/scrcpy-server], [/data/local/tmp/scrcpy-server.jar]
Sep 02 17:19:49 aprosag autoadb[6427]: ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
Sep 02 17:19:49 aprosag autoadb[6427]: INFO: You may download and install 'adb' from https://developer.android.com/studio/releases/platform-tools
Sep 02 17:19:49 aprosag autoadb[6427]: ERROR: Could not execute "adb push"
zoltan@aprosag ~/.config/systemd/user $ adb --version
Android Debug Bridge version 1.0.39
Version 1:8.1.0+r23-5~18.04
Installed as /usr/lib/android-sdk/platform-tools/adb
zoltan@aprosag ~/.config/systemd/user $ /usr/bin/adb --version
Android Debug Bridge version 1.0.39
Version 1:8.1.0+r23-5~18.04
Installed as /usr/lib/android-sdk/platform-tools/adb
zoltan@aprosag ~/.config/systemd/user $ cat autoadb.service
[Unit]
Description=autoadb

[Service]
Type=simple
Environment=ADB="/usr/bin/adb"
ExecStart=/home/zoltan/git_repos/autoadb/target/release/autoadb scrcpy -s '{}'

[Install]
WantedBy=default.target

What is strange to me, that there is no /usr/local/share/scrcpy/scrcpy-server file in my system.

zoltan@aprosag ~/.config/systemd/user $ ll /usr/local/share/scrcpy/scrcpy-server
ls: cannot access '/usr/local/share/scrcpy/scrcpy-server': No such file or directory

Starting autoadb from the command line works.

Could you help me pin-pointing what is the issue? autoadb detects the ID of the device, isn't it done with adb? Is the error clearly 'just' that the systemd unit does not find the command even with absolute path?

horror-vacui avatar Sep 02 '20 15:09 horror-vacui

all the error messages come from autoadb

In fact, they come from scrcpy.

Command not found: [/usr/bin/adb]

That's weird, if it exists.

Just to debug, replace:

ExecStart=/home/zoltan/git_repos/autoadb/target/release/autoadb scrcpy -s '{}'

by:

ExecStart=/home/zoltan/git_repos/autoadb/target/release/autoadb adb --version

rom1v avatar Sep 02 '20 15:09 rom1v

I do not get what is happening. adb version is found.

Sep 02 21:16:47 aprosag autoadb[3789]: Android Debug Bridge version 1.0.39
Sep 02 21:16:47 aprosag autoadb[3789]: Version 1:8.1.0+r23-5~18.04
Sep 02 21:16:47 aprosag autoadb[3789]: Installed as /usr/lib/android-sdk/platform-tools/adb
zoltan@aprosag ~ $ systemctl --user cat autoadb
# /home/zoltan/.config/systemd/user/autoadb.service
[Unit]
Description=autoadb
# After=home-zoltan.mount
# Requires=home-zoltan.mount

[Service]
Type=simple
Environment=ADB="/usr/bin/adb"
# User=zoltan
# ExecStart=/home/zoltan/git_repos/autoadb/target/release/autoadb /home/zoltan/bin/autoadb_scrcpy.sh '{}'
# ExecStart=/home/zoltan/git_repos/autoadb/target/release/autoadb scrcpy -s '{}'
ExecStart=/home/zoltan/git_repos/autoadb/target/release/autoadb /usr/bin/adb --version

[Install]
WantedBy=default.target

But when I run scrcpy, I got similar but not the same error as in the first post:

Sep 02 21:21:11 aprosag autoadb[4489]: ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
Sep 02 21:21:11 aprosag autoadb[4489]: INFO: You may download and install 'adb' from https://developer.android.com/studio/releases/platform-tools
Sep 02 21:21:11 aprosag autoadb[4489]: ERROR: Could not execute "adb push"
Sep 02 21:22:27 aprosag autoadb[4489]: Detected device xxxxxxxxxxxxxxxxxxxxx
Sep 02 21:22:27 aprosag autoadb[4489]: INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
Sep 02 21:22:27 aprosag autoadb[4489]: exec: No such file or directory
Sep 02 21:22:27 aprosag autoadb[4489]: ERROR: Command not found: [/usr/bin/adb], [-s], [73QDU17107002001], [push], [/usr/local/share/scrcpy/scrcpy-server], [/data/local/tmp/scrcpy-server.jar]
Sep 02 21:22:27 aprosag autoadb[4489]: ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
Sep 02 21:22:27 aprosag autoadb[4489]: INFO: You may download and install 'adb' from https://developer.android.com/studio/releases/platform-tools
Sep 02 21:22:27 aprosag autoadb[4489]: ERROR: Could not execute "adb push"

horror-vacui avatar Sep 02 '20 19:09 horror-vacui