Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
93 views
Adb is giving an undefined symbol: libusb_get_ssplus_usb_device_capability_descriptor error, and I am unsure how to solve this?
I am trying to run `adb`, in order to backup my android device. I installed android tools via dnf (`sudo dnf install android-tools`), but adb is giving a symbol error, specifically: `adb: symbol lookup error: adb: undefined symbol: libusb_get_ssplus_usb_device_capability_descriptor`. I have tried to...
I am trying to run adb, in order to backup my android device. I installed android tools via dnf (sudo dnf install android-tools), but adb is giving a symbol error, specifically: adb: symbol lookup error: adb: undefined symbol: libusb_get_ssplus_usb_device_capability_descriptor. I have tried to look online if others have experienced this as well, but was unable to find anything. From what I've been able to gather, this symbol should be present in all libusb version greater then 1.0.26, but mine is greater but still gives the error.
$ rpm -q libusb1

> libusb1-1.0.27-9.fc41.x86_64
> libusb1-1.0.27-9.fc41.i686
> libusb1-1.0.28-2.fc41.x86_64
> libusb1-1.0.28-2.fc41.i686
I also checked that adb indeed does link to my system libraries, which it does.
$ ldd $(which adb)

> ...
> libusb-1.0.so.0 => /lib64/libusb-1.0.so.0 (0x00007f07c835f000)
> ...
I'm not fully sure what to try next, or how to get adb to run succesfully. Any call to adb gives this lookup error (even simply calling it as adb --help). I am running: - Fedora 41 (KDE Plasma) - Kernel 6.14.11 - with an Intel i7 mobile cpu, in case that might matter.
Brendan Mesters (111 rep)
Jun 21, 2025, 11:45 AM • Last activity: Jul 2, 2025, 06:44 PM
1 votes
1 answers
5689 views
Uninstall Android Studio + SDK
I am using linux arch. I installed android according to [ArchWiki](https://wiki.archlinux.org/index.php/Android). I uninstalled every skd component and android studio using `pacman -Rs`. Also, I removed every hidden folder in the home directory that had something to do with android such `.android`,...
I am using linux arch. I installed android according to [ArchWiki](https://wiki.archlinux.org/index.php/Android) . I uninstalled every skd component and android studio using pacman -Rs. Also, I removed every hidden folder in the home directory that had something to do with android such .android, .gradle, AndroidStudio. But the environment variable ANDROID_HOME is still set and the following command ps aux | grep 'adb' returns adb -L tcp:5037 fork-server server --reply-fd 4 Where is the environment variable ANDROID_HOME set and what means adb -L tcp:5037 fork-server server --reply-fd 4? Is android not properly uninstalled? The command adb returns bash: adb: command not found EDIT: In a */proc/pid/environ*, there are still things like */opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin*
user119589
Jun 21, 2017, 07:51 PM • Last activity: May 23, 2025, 05:04 PM
1 votes
1 answers
452 views
Use adb (android debug bridge) in systemd-nspawn container
I would like to use adb inside an systemd-nspawn container. Unfortunately I cannot access the phone inside the container (connected via USB). pi@debian-buster-64:~ $ export ADB_TRACE=usb pi@debian-buster-64:~ $ adb devices List of devices attached * daemon not running; starting now at tcp:5037 * dae...
I would like to use adb inside an systemd-nspawn container. Unfortunately I cannot access the phone inside the container (connected via USB). pi@debian-buster-64:~ $ export ADB_TRACE=usb pi@debian-buster-64:~ $ adb devices List of devices attached * daemon not running; starting now at tcp:5037 * daemon started successfully pi@debian-buster-64:~ $ Here is the container setup /etc/systemd/nspawn/debian-buster-64.nspawn: [Exec] PrivateUsers=no Capability=CAP_NET_ADMIN [Files] Bind=/home Bind=/run/user:/run/host-user/ BindReadOnly=/etc/resolv.conf [Network] Private=no VirtualEthernet=no Here is the output from lsusb from inside the container: pi@debian-buster-64:~ $ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 009: ID 045e:07b2 Microsoft Corp. 2.4GHz Transceiver v8.0 used by mouse Wireless Desktop 900 Bus 001 Device 010: ID 18d1:4ee7 Google Inc. Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Output of lsusb is identical to the output on the host and the phone (Google Inc.) is visible. I want to use adb inside the container because the container is 64bit (host is only 32bit). Unfortunately, adb on 32bit has limitations. Access with adb works on the host (with said 32bit limitations). Any ideas how to get this working inside the container?
alex1452 (11 rep)
Dec 11, 2020, 04:49 AM • Last activity: May 2, 2025, 12:03 PM
0 votes
0 answers
299 views
Can't enable IPv4 forwarding via adb shell
I've got a rooted Android phone and am trying to enable IPv4 forwarding via `adb shell`. If I do ```sh host$ adb shell phone$ su -c "echo 1 > /proc/sys/net/ipv4/ip_forward" ``` then it works just fine. However, ```sh host$ adb shell su -c "echo 1 > /proc/sys/net/ipv4/ip_forward" ``` produces ```plai...
I've got a rooted Android phone and am trying to enable IPv4 forwarding via adb shell. If I do
host$ adb shell
phone$ su -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
then it works just fine. However,
host$ adb shell su -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
produces
/system/bin/sh: can't create /proc/sys/net/ipv4/ip_forward: Permission denied
even though adb shell cat /proc/sys/net/ipv4/ip_forward shows that the file already exists.
August Vrubel (59 rep)
Feb 16, 2023, 04:43 PM • Last activity: Apr 12, 2025, 09:01 AM
0 votes
1 answers
77 views
Connect QEMU to host via USB
I am trying to connect the host PC to the guest over USB, however QEMU has many features to connect emulated devices like mice but I need raw USB. My VM is running android x86 and I want to be able to use USB debugging, which is none of the options. How can I do this. My current setup: ```sh /usr/bi...
I am trying to connect the host PC to the guest over USB, however QEMU has many features to connect emulated devices like mice but I need raw USB. My VM is running android x86 and I want to be able to use USB debugging, which is none of the options. How can I do this. My current setup:
/usr/bin/qemu-system-x86_64 \
    -monitor stdio \
    -smp 2 \
    -cpu host \
    -machine accel=kvm \
    -m 16384 \
    -hda "/home/playerxyt/.aqemu/hdd/Android.qcow2" \
    -boot once=c,menu=off \
    -net nic \
    -net user \
    -rtc base=localtime \
    -name "Android"
The script was generated by aqemu
Player_X_YT (11 rep)
Jan 14, 2025, 05:17 PM • Last activity: Jan 14, 2025, 05:30 PM
0 votes
0 answers
21 views
adbd daemon did NOT work after system wakeup
I am working on an embedded Linux system (kernel5.19.10), and adbd is running in the device in background. I can run `adb shell` and `adb push` `adb pull` command from PC to the device. Now I found when the device is woken up from `hibernate` state, the `adb` commands in the PC did NOT work any more...
I am working on an embedded Linux system (kernel5.19.10), and adbd is running in the device in background. I can run adb shell and adb push adb pull command from PC to the device. Now I found when the device is woken up from hibernate state, the adb commands in the PC did NOT work any more unless the adbd in the device is restarted. So I have 2 questions: 1. Why adbd did NOT work after the device is suspend/resumed, can it be fixed? 2. How can the userspace know there is a system wakeup event happened (system is woken up), is there any notification or interface exposed to the user space to know the power management events?
wangt13 (631 rep)
Sep 11, 2024, 12:47 AM
-1 votes
1 answers
302 views
What is this permission problem with adb?
I would like to transfer files between a phone (Harmony 2.0.0) and a Linux laptop with USB connection between them. I try to use adb by following https://www.reddit.com/r/linuxquestions/comments/hde7f4/enable_linux_mounting_of_android_usb_device_for/fvl8gyp/, but why do I have the permission problem...
I would like to transfer files between a phone (Harmony 2.0.0) and a Linux laptop with USB connection between them. I try to use adb by following https://www.reddit.com/r/linuxquestions/comments/hde7f4/enable_linux_mounting_of_android_usb_device_for/fvl8gyp/ , but why do I have the permission problem? $ adb devices * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached A7Q0218123000244 no permissions; see [http://developer.android.com/tools/device.html] $ adb shell adb: insufficient permissions for device See [http://developer.android.com/tools/device.html] for more information I can't find anything useful in the link http://developer.android.com/tools/device.html
Tim (106420 rep)
Jul 3, 2024, 12:56 PM • Last activity: Jul 3, 2024, 01:49 PM
3 votes
3 answers
5777 views
Fastboot recognizes device but unable to flash (stuck with no output) on Ubuntu based systems
I'm trying to flash a custom ROM on my Android smartphone using `fastboot` on the Ubuntu based Pop!_OS. When trying to flash the recovery, the command does not output anything and is stuck. However I don't face this issue when using Windows 10 with the same hardware. ``` ./fastboot flash recovery re...
I'm trying to flash a custom ROM on my Android smartphone using fastboot on the Ubuntu based Pop!_OS. When trying to flash the recovery, the command does not output anything and is stuck. However I don't face this issue when using Windows 10 with the same hardware.
./fastboot flash recovery recovery.img
Environment: ------------ - ROM: PixelExperience 11 (Plus) (Official for X00TD) - Recovery: Supplied with the ROM - Smartphone: Asus Zenfone Max Pro M1 (X00TD / ZB601KL Variant) - PC:
/////////////                user@pop-os 
             /////////////////////            ------------- 
          ///////*767////////////////         OS: Pop!_OS 20.04 LTS x86_64 
        //////7676767676*//////////////       Host: 80F6 Lenovo B40-80 
       /////76767//7676767//////////////      Kernel: 5.15.8-76051508-generic 
      /////767676///*76767///////////////     Uptime: 54 mins 
     ///////767676///76767.///7676*///////    Packages: 1896 (dpkg), 27 (flatpak) 
    /////////767676//76767///767676////////   Shell: bash 5.0.17 
    //////////76767676767////76767/////////   Resolution: 1366x768 
    ///////////76767676//////7676//////////   DE: GNOME 
    ////////////,7676,///////767///////////   WM: Mutter 
    /////////////*7676///////76////////////   WM Theme: Pop 
    ///////////////7676////////////////////   Theme: Pop-dark [GTK2/3] 
     ///////////////7676///767////////////    Icons: Pop [GTK2/3] 
      //////////////////////'////////////     Terminal: gnome-terminal 
       //////.7676767676767676767,//////      CPU: Intel i5-5200U (4) @ 2.700GHz 
        /////767676767676767676767/////       GPU: Intel HD Graphics 5500 
          ///////////////////////////         Memory: 2679MiB / 7865MiB 
             /////////////////////
                 /////////////
(Also tried, unsuccessfully in the older **Kubuntu 18.04**, with the same result) I've tried using both the system supplied (Ubuntu repository) version of fastboot and the one shipped with Android's platform tools . Installed the system version with sudo apt install android-tools-adb android-tools-fastboot. fastboot Versions: -------------------
user@pop-os:~$ fastboot --version
fastboot version 1:8.1.0+r23-5ubuntu2
Installed as /usr/lib/android-sdk/platform-tools/fastboot
user@pop-os:~/Android/platform-tools$ ./fastboot --version
fastboot version 31.0.3-7562133
Installed as /home/user/Android/platform-tools/fastboot
Prerequisites: -------------- Have configured udev rules as shown below (to avoid "no permission" error when running fastboot without sudo)
#/etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
And added current user to the 'plugdev' group with sudo usermod -aG plugdev $LOGNAME Issue: ------ After rebooting into fastboot mode through either the hardware keys (VOLUME UP + POWER) or the command ./adb reboot bootloader, my device is recognized by fastboot.
user@pop-os:~/Android/platform-tools$ ./fastboot devices
XXXXXXXX04HP	fastboot
**But when I try to flash the recovery, the command gives no output and is stuck**
user@pop-os:~/Android/platform-tools$ ./fastboot flash recovery recovery.img
And just when I unplug the device from the PC, it gives an error
user@pop-os:~/Android/platform-tools$ ./fastboot flash recovery recovery.img
Sending 'recovery' (21517 KB)                      FAILED (Write to device failed (No such device))
fastboot: error: Command failed
Conclusion: ----------- As recommended in the hyperlinked guide and many other resources, I have tried using different USB ports (both 2.0 & 3.0), different cables and, as mentioned, different PC and version of Ubuntu. Nothing resolved the issue. **However, using Windows 10 with the same PC (its dual-booted), USB port, cable and the mobile device, I was able to successfully flash the recovery and, later, also the ROM.** There are similar questions to this one on other StackExchange sites, with some whose accepted answers are not very helpful and most of them are old. Besides, as advised by [@alecxs](https://unix.stackexchange.com/users/237864/alecxs) here , this issue seems to be specific to Linux based systems. I would really appreciate some help with this. Thanks in advance for your inputs. Attachments: ------------ 1. [dmesg grep usb](https://pastebin.com/THgdQPiG) 2. [dmesg alert,crit,err,warn](https://pastebin.com/zCNEAUGm)
Syed Adil (31 rep)
Dec 30, 2021, 10:57 PM • Last activity: May 24, 2024, 02:26 AM
0 votes
3 answers
523 views
How to make 'adb shell' to read /etc/profile or other configuration files?
I am working on an embedded Linux system (kernel-5.10.24), and it uses `ash` from `busybox` as `/bin/sh`. The system support login from serial console and `adb shell` from PC. Now I found the `shell` started from serial console did read the environments defined in `/etc/profile`, but the `shell` sta...
I am working on an embedded Linux system (kernel-5.10.24), and it uses ash from busybox as /bin/sh. The system support login from serial console and adb shell from PC. Now I found the shell started from serial console did read the environments defined in /etc/profile, but the shell started by adb shell does NOT. For example, the /etc/profile is as follows,
# cat /etc/profile
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"

if [ "$PS1" ]; then
        if [ "id -u" -eq 0 ]; then
                export PS1='# '
        else
                export PS1='$ '
        fi
fi
in serial console,
# echo $HOME
/root
# echo $ENV

# echo $PATH
/bin:/sbin:/usr/bin:/usr/sbin
But in adb shell,
/sys/kernel/config/usb_gadget # echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin
/sys/kernel/config/usb_gadget # echo $HOME
/
The shell started by adb shell is launched by adbd in target Linux, so is there a way to make the shell started by adb shell to read /etc/profile or other configuration files for its environments?
wangt13 (631 rep)
Aug 25, 2023, 03:11 AM • Last activity: Mar 2, 2024, 11:13 AM
0 votes
1 answers
73 views
Displays a user input pop-up on the Android screen
Currently I'm interested in **Bash** and also the Android phone I have... I'm wondering if there is a way to display popup as text input on the android screen and then receive data from that user-submitted input using `adb` or using a root shell/bash script? For example, I created a bash script that...
Currently I'm interested in **Bash** and also the Android phone I have... I'm wondering if there is a way to display popup as text input on the android screen and then receive data from that user-submitted input using adb or using a root shell/bash script? For example, I created a bash script that will display the output Hello $userinput !! When I run this bash script, a dialog will appear entitled ***What's Your Name?*** and I can fill it directly without going through the *terminal*... Does anyone know how to do it? **It would be nice if you could also tell it the same way but this is only for normal popup that don't contain any input boxes, but just like regular popup on Android* 😃 I'm currently very curious about things like this, I mean bash script, root shell or adb shell command that can interact directly with user using the Android screen. I'm using an Android 13 and have *root access* using Magisk, the ROM installed is MIUI 14
TuanHaxor (73 rep)
Feb 3, 2024, 04:26 PM • Last activity: Feb 3, 2024, 07:32 PM
0 votes
1 answers
4819 views
Android Studio: Running application in emulator not working
Yesterday I downloaded Android Studio for my Debian Testing system. I wanted to run a HelloWorld application (just a blank activity) but weren't able to run it. With adb I can install it without having any problems. However, if I try to do it with Android Studio, it gets stuck on 'Installing APKs'....
Yesterday I downloaded Android Studio for my Debian Testing system. I wanted to run a HelloWorld application (just a blank activity) but weren't able to run it. With adb I can install it without having any problems. However, if I try to do it with Android Studio, it gets stuck on 'Installing APKs'. The same happens when I try to start it in an emulator (gets stuck on 'Waiting for target device to come online'). My device is a Samsung Galaxy S3 with LineageOS (Android 7.1.2) and root permissions. Android Studio recognizes my phone properly. What I've already done: - installed with openjdk - installed with oracle jdk - set android_home - installed all the SDK-platforms since Android 4.3 and Android Emulator from SDK tool - installed everything from SDK tool - enabled USB-debugging - tried with MTP and PTP - tried another emulated phone - installed lib32stdc++6 - restarted my computer - created new blank activity - reinstalled everything: JDK, Android SDK and Android Studio - and probably much more I do not get any error. Today I managed to have the emulator start by setting graphics to software but it just shows a black screen and doesn't power on. I tried to do it until now and couldn't find a solution. I have never experienced anything close to this on other systems. I really would like to get it running on Debian because I do not want to install Windows for this. I remember that I was able to run it on LMDE2 some time ago. So why doesn't it work on Debian Testing now? Did I forget something? Thank you in advance. **EDIT:** I am now able to use my phone to run the android application by using USB 2.0 instead of USB 3.0! Is that a normal behavior since it works with native adb? I mean, if I buy a new PC after some years which has got only USB 3.0 ports, will I not be able to use phone debugging with Android Studio or is this just an issue? It is still known since 2014 (https://stackoverflow.com/a/9548311/8292104) . However, I still cannot get the app running on an ADV. I changed graphics to software, now it shows the phone but the screen remains black and the phone won't start. What can I do to fix it?
tavkomann (103 rep)
Jul 12, 2017, 04:45 PM • Last activity: Dec 21, 2023, 05:37 PM
0 votes
1 answers
630 views
How to create ADB Gadget configuration?
I am reading the [Gadget Configuration Documentation][1]. I am also using a working Android device to reference and copy configurations in `/config/usb_gadget/g1`. I am now booting an initramfs and trying to start the device as an adb device without running any Linux flavor. I extracted the kernel f...
I am reading the Gadget Configuration Documentation . I am also using a working Android device to reference and copy configurations in /config/usb_gadget/g1. I am now booting an initramfs and trying to start the device as an adb device without running any Linux flavor. I extracted the kernel from the device's boot.img, changed the ramdisk.cpio.gz with the following init script
#!/usr/bin/bash
PATH=/usr/bin:/usr/sbin
mount -a #mount dev sys proc and configfs
create_devices #make all necessary nodes
mkdir -p /config/usb_gadget/g1/strings/0x409
mkdir -p /config/usb_gadget/g1/functions/ffs.adb
mkdir -p /config/usb_gadget/g1/functions/configs/b.1/strings/0x409
ln -s /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
echo "0x0e8d" > /config/usb_gadget/g1/idVendor
echo "0x201c" > /config/usb_gadget/g1/idProduct
echo "0123456789101112" > /config/usb_gadget/g1/strings/0x409/serialnumber
echo "TECNO" > /config/usb_gadget/g1/strings/0x409/manufacturer
echo "TECNO KI7" > /config/usb_gadget/g1/strings/0x409/product
echo adb > /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration
echo "0x80" > /config/usb_gadget/g1/configs/b.1/bmAttributes
echo musb-hdrc > /config/usb_gadget/g1/UDC
echo "0x00" > /config/usb_gadget/g1/bDeviceClass
echo "0x00" > /config/usb_gadget/g1/bDeviceProtocol
echo "0x00" > /config/usb_gadget/g1/bDeviceSubClasss
echo "0x0404" > /config/usb_gadget/g1/bcdDevice
echo "0x0200" > /config/usb_gadget/g1/bcdUSB
echo "0x40" > /config/usb_gadget/g1/bMaxPacketSize0
The device boots fine but won't start the ADB USB Gadget. Here is an init log
[1.550749] (7) [1:init] gadgets_make name=g1
[1.552088] (7) [1:init] function_make name=ffs.adb
[1.552104] (7) [1:init] file system registered
[1.558890] (1) [1:init] function_make name=configs
[1.558911] (1) [1:init] Unable to locate . in FUNC.INSTANCE
[1.562824] (2) [1:init] gadget_dev_desc_UDC_store write musb-hdrc
[1.562839] (2) [1:init] configfs_composite_bind
[1.562852] (2) [1:init] composite_dev_prepare 0000000037341456
[1.562870] (2) [1:init] Need at least one configuration in g1.
[1.562878] (2) [1:init] composite_dev_cleanup os_desc_req=(null)cdev>req=0000000037341456
[1.562892] (2) [1:init] configfs-gadget musb-hdrc: failed to start g1: -22
I suspected maybe I didn't link the configs folder right but the following has the same result
ln -s /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
It keeps on stating Need at least one configuration in g1. When I run find /config/usb_gadget/g1 it doesn't find any files in /config/usb_gadget/g1/configs but it does list /config/usb_gadget/g1/configs as a possible path. This means any files I try to write to configs aren't being written since /config/usb_gadget/g1/configs/b.1 doesn't exist when I try to find it. How can I write files to /config/usb_gadget/g1/configs?
Bret Joseph (491 rep)
Sep 6, 2023, 03:54 AM • Last activity: Sep 6, 2023, 11:45 AM
-1 votes
1 answers
1538 views
xxx.sh: : not found
I'm debugging a shell script and coming across this error. I have no idea what's going on with my script. #!/system/bin/sh function SetEQ(){ prefFile='/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' # a comment line that was deleted by me, sorry for that. case $1 in speaker) arr...
I'm debugging a shell script and coming across this error. I have no idea what's going on with my script. #!/system/bin/sh function SetEQ(){ prefFile='/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' # a comment line that was deleted by me, sorry for that. case $1 in speaker) array=(0.0 0.0 0.0 -3.64 -10.66 -15.0 -6.49 0.0) ;; samsung) array=(0.0 2.9 0.0 -1.5 -6.4 2.7 0.0 0.0) ;; *) exit ;; esac for i in ${!array[@]}; do sed -ir "s/(\"com.smp.equalizer.$i\" value=\")[^\"]*(\")/\1${array[$i]}\2/" "$prefFile" done } SetEQ samsung When I run the script by: # sh -vx ./test2.sh The debug information is as follows: + SetEQ samsung + prefFile='/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' + set -A array -- 0.0 2.9 0.0 -1.5 -6.4 2.7 0.0 0.0 + sed -ir 's/("com.smp.equalizer.0" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.1" value=")[^"]*(")/\12.9\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.2" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.3" value=")[^"]*(")/\1-1.5\2/' '/mnt/media_rw/6633-353/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.4" value=")[^"]*(")/\1-6.4\2/' '/mnt/media_rw/6633-353/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.5" value=")[^"]*(")/\12.7\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.6" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.7" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found I have to say that the sed lines have no issue when I run them directly in the terminal. The debug information is very vague, what is not found? The command? The script file? The paths given to sed? **EDIT: @Paul_Pedant was right, I forgot to have copyed the sed line to Windows system than paste them back to VI. After re-enter the line by hand, the problem solved!**
preachers (151 rep)
Feb 20, 2023, 02:16 PM • Last activity: Feb 20, 2023, 02:53 PM
0 votes
1 answers
1868 views
Using grep to extract IP through adb shell
I'm trying to create a one-line, platform-independent solution for finding the local IP address of a Android device with `adb shell` and `grep` (the internal grep on my android device). I have a solution that works, but something keeps bothering me. By the way, I'm running my solution from within Po...
I'm trying to create a one-line, platform-independent solution for finding the local IP address of a Android device with adb shell and grep (the internal grep on my android device). I have a solution that works, but something keeps bothering me. By the way, I'm running my solution from within Powershell 7, if that makes any difference. Here's my solution:
> adb shell "ip addr show wlan0 | grep -e 'inet[^6]'"
    inet 192.168.0.19/22 brd 192.168.3.255 scope global wlan0
It works, but I cannot use \d as a character class to filter, which would be preferable. My preferred solution would show JUST the IP address and nothing else. This is the best I could do:
> adb shell "ip addr show wlan0 | grep -o '^    inet [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9]'"
    inet 192.168.0
Android seems to ship with a limited terminal setting and uses 'toybox' to emulate the typical bash tools. They seem quite limited though, and not very much documentation is provided. Since I can't use digit character classes or quantifiers, I can only filter for the line, and using -o is the only way to output information. So, my preferred solution is effectively impossible to do. What can I do to extract just my local IP address with this limited toolset?
Xevion (103 rep)
Jun 8, 2022, 10:14 PM • Last activity: Jun 8, 2022, 11:41 PM
1 votes
1 answers
59 views
HISTTIMEFORMAT messed up adb
I set up earlier this month `HISTTIMEFORMAT` cause I needed to see the time on some of the commands I previously used. However, I most likely messed something up with those commands, because every time I try to use adb for anything (adb kill-server eg.) I get the following error: `bash: /home/user/A...
I set up earlier this month HISTTIMEFORMAT cause I needed to see the time on some of the commands I previously used. However, I most likely messed something up with those commands, because every time I try to use adb for anything (adb kill-server eg.) I get the following error: bash: /home/user/Android/Sdk/platform-tools/adbHISTTIMEFORMAT=%d%m%y: No such file or directory. These are the commands that I used to setup HISTTIMEFORMAT:
1032  20/05/22 19:17:45 echo 'HISTTIMEFORMAT="%d%m%y %T "' >> ~/.bashrc
 1033  20/05/22 19:17:46 history
 1034  20/05/22 19:19:17 source ~/.bashrc
 1035  20/05/22 19:19:19 history
 1036  20/05/22 19:20:22 echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
 1037  20/05/22 19:20:32 source ~/.bashrc
What exactly did I do wrong and how can I fix/revert it?
G. Rann (113 rep)
Jun 3, 2022, 11:58 AM • Last activity: Jun 3, 2022, 09:13 PM
0 votes
1 answers
683 views
Service takes more than a minute to close
I have a Linux based device which is running certain services on boot-up, however one of them seems to be taking over a minute to close as I run `adb shell shutdown -h now` command. Is there a way to tell what's causing this extra delay while the service is being shut down? The following is a part o...
I have a Linux based device which is running certain services on boot-up, however one of them seems to be taking over a minute to close as I run adb shell shutdown -h now command. Is there a way to tell what's causing this extra delay while the service is being shut down? The following is a part of the daemon file that gets invoked as service are getting shut down...
start-stop-daemon -K -n /usr/bin/service
I see the following in logs
A stop job is running for service (1min 8s / 1min 15s)
A stop job is running for service (1min 11s / 1min 15s)
A stop job is running for service (1min 15s / 1min 51s)
...
xyf (141 rep)
May 18, 2022, 09:59 PM • Last activity: May 19, 2022, 03:09 AM
1 votes
2 answers
1045 views
Linux mint freezes after clicking on run button in android studio
[![][1]][1] I have installed android studio in linux mint 18.1. Every thing is working file but whenever I'm clicking on run app button it freezes completely after that I need to restart laptop. My spec is Pentium quad core with 4 gb ram. I have insteed 32 bit library also. [1]: https://i.sstatic.ne...
Image I have installed android studio in linux mint 18.1. Every thing is working file but whenever I'm clicking on run app button it freezes completely after that I need to restart laptop. My spec is Pentium quad core with 4 gb ram. I have insteed 32 bit library also.
Shivashish Singh (11 rep)
Jan 9, 2017, 01:59 PM • Last activity: Jan 28, 2022, 10:49 AM
0 votes
0 answers
1175 views
How to scan for the Pegasus spyware with Debian/KDE & Android: getting " [mvt.android.modules.adb.base] Unable to connect to the device over USB."
On my Debian11/KDE machine I ran `pip3 install mvt --user` then I enabled developer options on my Android smartphone (via tapping on the build-number a few times), enabled USB debugging on it, connected to the computer with the fully functional USB cable that was shipped with the phone, ran `mvt-and...
On my Debian11/KDE machine I ran pip3 install mvt --user then I enabled developer options on my Android smartphone (via tapping on the build-number a few times), enabled USB debugging on it, connected to the computer with the fully functional USB cable that was shipped with the phone, ran mvt-android check-adb and confirmed the popup on the phone asking whether the RSA key of the computer is to be trusted (without checking to always trust it). Basically just like described in the docs here . I also tried after selecting using it as MTP device and mounting it (but MTP should be disabled for this afaik) and also ran adb kill-server before the above command. However, it always fails with this output:
MVT - Mobile Verification Toolkit
                https://mvt.re 
                Version: 1.2.10


         INFO     [mvt.android.cli] Checking Android through adb bridge                                                                                    
         INFO     [mvt.android.cli] Loaded a total of 0 indicators                                                                                         
         INFO     [mvt.android.modules.adb.chrome_history] Running module ChromeHistory...                                                                 
         ERROR    [mvt.android.modules.adb.base] Unable to connect to the device over USB. Try to unplug, plug the device and start again.
Running adb devices does show the device: it shows the id and "unauthorized". Before I ran adb kill-server it showed "device" instead of "unauthorized" (I got CRITICAL [mvt.android.modules.adb.base] Device is busy, maybe run 'adb kill-server' and try again. when running it when it showed "device"). Do I maybe need to run sudo adb start-server or something like that? There always has been an issue with establishing an USB connection with my Android phone and keeping the connection up for long even with another smartphone and other USB cables and other USB ports and another Debian/KDE machine, but it usually works after reconnecting a few times and selecting "Open folder" in the popups of the Dolphin file explorer multiple times (usually not long enough to transfer many files or browse files on the phone conveniently but somewhat good enough). Edit: it usually works if Dolphin is closed before mounting. How to solve this? --- Edit: created an issue here . Now it does run through but shows no results, shows one error and MVT can't be upgraded (another issue there).
mYnDstrEAm (4708 rep)
Aug 26, 2021, 08:44 PM • Last activity: Dec 30, 2021, 04:38 PM
0 votes
1 answers
204 views
Is there any way to delete this garbled folder on a Android device?
*******************The main content of the question** A few months ago, I accidentally disconnected the device during the execution of the adb push instruction and left a folder with more than 30 GB of garbled characters, which contained many garbled files, This caused a lot of waste of storage spac...
*******************The main content of the question** A few months ago, I accidentally disconnected the device during the execution of the adb push instruction and left a folder with more than 30 GB of garbled characters, which contained many garbled files, This caused a lot of waste of storage space. The file management programs on Android (such as RootExplorer, Estrongs, etc.) cannot delete the garbled folder I have tried many ways in many attempts, such as deleting files in adb-shell environment, various methods found on google, and even the busybox terminal program on Android devices, none of them work. The current situation is that I can use the cd command to enter the folder, the rm command with the file name parameter will report an error, the rm command with the inum parameter will not report an error, but the rm command parameter with the inum parameter is invalid after the execution (in the output of the ls command Neither the content nor the Android space status has changed) The sample command prompt (adb) code snippet is as follows
C:\Users\14520>adb shell
c2q:/ $ cd /sdcard/shit
130|c2q:/sdcard/shit $ cd $(find -inum 11939)
c2q:/sdcard/shit/闊 $ ls -il
total 3009874
36369 drwxrwx--- 3 root everybody       3488 2021-09-07 23:27 2001-00-鐣欎綇杩欎竴鍒荤郴鍒?-5[瀛旈泙寤婃繁椋為摱鑺増][WAV]
34351 drwxrwx--- 3 root everybody       3488 2021-09-07 23:29 2001-00-鐣欎綇杩欎竴鍒荤郴鍒?-10[瀛旈泙寤婃繁椋為摱鑺増][WAV]
#...
c2q:/sdcard/shit/闊 $ find -inum 3488 -exec rm -rf {} \;
c2q:/sdcard/shit/闊 $ ls -il
total 3009874
11946 -rw-rw---- 1 root everybody     253384 2020-05-21 20:04 mgsvtpp.[v4.0.6].zip
39450 drwxrwx--- 8 root everybody       3488 2021-09-07 23:36 銆傚師澹板甫
35775 -rw-rw---- 1 root everybody       1089 2020-04-20 21:30 鏃犲嵃鑹搧.lnk
35826 -rw-rw---- 1 root everybody 2277719590 2019-03-11 12:06 缇ゆ槦.-.鎽囨粴涓浗涔愬娍鍔沒.婕斿敱浼?(DVDRip)_9522f.mkv
#...
c2q:/sdcard/shit/闊 $</code></pre>
[Full screenshot of this code snippet
Explanation: The folder with an inum of 11939 is the top level of the garbled folder

Resetting the phone is a bad idea because it costs too much, I don’t want to do it now.

Is there any other way here? If anyone can help me solve this problem(Delete garbled folders without losing other data), I can buy him a(large-large) cup of coffee.

Thanks all the friends here.(My English skills might not be very good, If there are some grammatical problems, forgive me please)

*******************Supplement to what I forgot to say**

·I tried "rm with FOLDER_PATH" and "RM with FOLDER_INODE_NUMBER", after running it will return "not found" and no effect (I discovered this before asking the question, but I forgot to add it to the sample code snippet)
# sample example for the Two usages of command “rm” I used refered above
# rm with folder_name
rm -rR NAME
# rm with inode_number, 11939 is inode_number
cd $(find -inum   )
find -inum 11939 -exec rm -rf {} \;
·All the Android application I knowned cannot delete the garbled folder without root ·The garbled folder is in the internal storage instead of the external storage. ·The model of this device is Samsung Note20 Ultra 12+512G, rooting will cause the loss of data and several functions. The reason I never want to format the partition is that there are too many 504G files to be backed up. *******************Approximate provisional conclusion** The current situation and imformation proves that: to delete garbled folders without root permissions, It is not feasible to use the "rm" console command (either pointing to path or inode-number'). I can only backup and format the entire partition(contains 504G files). I want to ask a question to see if there is any way to delete the garbled folder without losing other data, but it seems that there is no such way. By the way, I have paid less attention to stackoverflow these days and did not reply to your message in time. Sorry. Alas, if there is no other way, I can only format the entire partition (containing 504G files) another day. All in all, thanks to everyone who tried to help me.
Xinge (1 rep)
Nov 14, 2021, 12:38 PM • Last activity: Nov 16, 2021, 09:33 PM
0 votes
1 answers
6110 views
./shell.sh: line 6: [: =~: binary operator expected
I'm trying to execute the following shell script, where I'm trying to keep executing a command in an infinite loop and until the output is not equal to a certain substring checkDeviceStatus=$(adb shell getprop sys.boot_completed 2>&1) function Check_Status () { while [ ! "$checkDeviceStatus" =~ "dev...
I'm trying to execute the following shell script, where I'm trying to keep executing a command in an infinite loop and until the output is not equal to a certain substring checkDeviceStatus=$(adb shell getprop sys.boot_completed 2>&1) function Check_Status () { while [ ! "$checkDeviceStatus" =~ "device offline" ] || [ ! "$checkDeviceStatus" =~ "device still authorizing" ] do if [ ! "$checkDeviceStatus" =~ "device offline" ] || [ ! "$checkDeviceStatus" =~ "device still authorizing" ]; then echo "Device is now up and running!!: '$checkDeviceStatus'" break else echo "'$checkDeviceStatus'" fi; done }; Check_Status but I'm getting the following error ./shell.sh: line 6: [: =~: binary operator expected ./shell.sh: line 8: [: =~: binary operator expected
Amr Kamel (121 rep)
Jul 19, 2021, 02:42 PM • Last activity: Jul 19, 2021, 03:28 PM
Showing page 1 of 20 total questions