Genymobile / Genymobile/scrcpy

Suggest adding detection and authorization for 'abd root' to ensure successful Scrcpy

Open
#3,923 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
150k
Forks
13.7k
Avg merge
4d 13h
Merged PRs (30d)
2

Description

Some Chinese mobile phone manufacturers may modify the Android system, resulting in "abd root": add cannot run as root in production builds.

At this point, Scrcpy cannot transfer Scrcpy server to the phone's/data/local/tmp; Scrcpy failed to run!
>adb:error:failed to copy 'D:\Tools\Scr cpy\scr cpy-server'to'/data/local/tmp/scr cpy-server.jar':remote secure_mkdirs failed:Permission denied
ERROR:"adb push" returned with value 1
ERROR:Server connection failed

By using the following method, 'abd root' can be successful: adbd is already running as root
At this point, Scrcpy runs successfully.
1. Need to create a new *. sh script file(I named this file ‘start_adb_root.sh’ );
>#!/system/bin/sh
resetprop ro.adb.secure 0
resetprop ro.secure 0
/data/adb/magisk/busybox pkill -9 adbd
su -c adbd

2. The PC needs to execute the following commands:
>FOR /F "delims=" %%b IN ('forfiles /S /M "start_adb_root.sh" /C "cmd /c echo @path"') DO set start_adb_root=%%b
adb shell magisk su -c sh<%start_adb_root%
timeout /nobreak /t 3 >nul 2>nul

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported adb push failure on an affected production build, then trace the scrcpy server transfer and startup path described in the report. Compare behavior when adbd is already running as root and when the provided shell workaround is used. Done should include a defined response for this device configuration and successful server startup without the manual workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, c, shell
Domain
mobile-dev, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.