sudo icon indicating copy to clipboard operation
sudo copied to clipboard

Failed to setup SUDO_SHELL_HOME

Open ddCeka opened this issue 3 months ago • 7 comments

I got an error when running sudo su

The '/data/data/com.termux/files/home/.suroot' cannot be used as SUDO_SHELL_HOME
Failed to setup SUDO_SHELL_HOME
Failure while running 'sudo_setup_sudo_shell_home_and_working_environment'

Running with sudo -vvvv su after adding sudo_log 3 "valid_path_under_termux_rootfs_regex=\"$valid_path_under_termux_rootfs_regex\"" as instructed on reddit

$ sudo -vvvv su

Running sudo

Running sudo_set_su_variables
A su binary found at '/sbin/su'
SU='/sbin/su'
SU_BIN_PATH='/sbin'
SU_INTERACTIVE_OPTION_SUPPORTED='0'

Running sudo_set_required_variables
PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/xbin:/system/bin'
CURRENT_WORKING_DIR='/data/data/com.termux/files/home'
SUDO_SHELL_HOME='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_HOME_PARENT_DIR='/data/data/com.termux/files/home'

Running sudo_setup_termux_tmp_dir
The TMPDIR directory already exists at '/data/data/com.termux/files/usr/tmp'
Skipping setting ownership and permission for TMPDIR directory since it was not created

Running sudo_set_priority_dependent_variables with priority 'termux'
PATH_TO_EXPORT='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'
LD_LIBRARY_PATH_TO_EXPORT=''
LD_PRELOAD_COMMAND='export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';'

Running sudo_set_su_env_command
SU_ENV_COMMAND=`/sbin/su --preserve-environment --shell /data/data/com.termux/files/usr/bin/bash -c export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so'; `

Running sudo_set_sudo_shell
SUDO_SHELL='/data/data/com.termux/files/usr/bin/bash'
SUDO_SHELL_BASENAME='bash'
SUDO_SHELL_PARENT_DIR='/data/data/com.termux/files/usr/bin'

Running sudo_set_sudo_shell_rcfile
SUDO_SHELL_RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc'
SUDO_SHELL_RCFILE_PARENT_DIR='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_RCFILE_COMMANDS='export RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc';'
SUDO_SHELL_RCFILE_VALUE=`
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}

`

Running sudo_set_sudo_shell_histfile
SUDO_SHELL_HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history'
SUDO_SHELL_HISTFILE_PARENT_DIR='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_HISTFILE_COMMANDS='export HISTSIZE=1000;
export HISTFILESIZE=1000;
export HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history';'

Running sudo_set_sudo_shell_command
SUDO_SHELL_COMMAND='/data/data/com.termux/files/usr/bin/bash --noprofile --norc'
SUDO_SHELL_INTERACTIVE_COMMAND='/data/data/com.termux/files/usr/bin/bash --rcfile /data/data/com.termux/files/home/.suroot/.bashrc -i'

Running sudo_set_pre_sudo_shell_commands_to_run
Setting PRE_SUDO_SHELL_COMMANDS_TO_RUN with priority to 'termux' bin and library paths for COMMAND_TYPE 'su'



Running sudo_setup_sudo_shell_home_and_working_environment_wrapper stage 1

Running sudo_remount_partitions_for_sudo_shell_homes

Running sudo_setup_sudo_shell_home_and_working_environment
Started sudo_setup_sudo_shell_home_and_working_environment

Running sudo_setup_shell_home for SUDO_SHELL
valid_path_under_termux_rootfs_regex="^[\/]+.+"
SUDO_SHELL_HOME '/data/data/com.termux/files/home/.suroot' matches one of following blacklisted paths:
'/data/data/com.termux/files/home/.{cache,config,local,termux}', '/*'
The '/data/data/com.termux/files/home/.suroot' cannot be used as SUDO_SHELL_HOME
Failed to setup SUDO_SHELL_HOME
Failure while running 'sudo_setup_sudo_shell_home_and_working_environment'

Running sudo_remount_partitions_for_sudo_shell_homes

Magisk version

$ su --version
23.0:MAGISKSU

termux-info

Termux Variables:
TERMUX_API_VERSION=0.53.0
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=4423
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c235,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.3
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c235,c256,c512,c768
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages.termux.dev/apt/termux-main stable main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
All packages up to date
termux-tools version:
1.45.0
Android version:
10
Kernel build information:
Linux localhost 4.9.281-genos-r19-oofgang #6 SMP PREEMPT Fri Aug 27 03:48:24 EDT 2021 aarch64 Android
Device manufacturer:
OnePlus
Device model:
ONEPLUS A6003
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so
Installed termux plugins:
com.termux.api versionCode:1002

ddCeka avatar Oct 16 '25 17:10 ddCeka

Thanks for the report. It seems like TERMUX_ROOTFS is not set in the valid_path_under_termux_rootfs_regex="^[\/]+.+" and TERMUX_PREFIX is not set in '/*' part of blacklisted paths error. However $TERMUX_HOME is set in the same error in '/data/data/com.termux/files/home/.{cache,config,local,termux}'. So my guess is env is being truncated somehow for the root process. Can you add a compgen -v | while read -r v; do echo "${v}=${!v}"; done command in the error if and run again.

https://github.com/agnostic-apollo/sudo/blob/50b2ec4455b63e3a117d8a1ca7025c3cc8923322/sudo#L5191

agnostic-apollo avatar Oct 17 '25 01:10 agnostic-apollo

Hello, after adding compgen -v | while read -r v; do echo "${v}=${!v}"; done on line 5191. I still got the same Failure while running 'sudo_setup_sudo_shell_home_and_working_environment'

while running with sudo -vvvv su

$ sudo -vvvv su

Running sudo

Running sudo_set_su_variables
A su binary found at '/sbin/su'
SU='/sbin/su'
SU_BIN_PATH='/sbin'
SU_INTERACTIVE_OPTION_SUPPORTED='0'

Running sudo_set_required_variables
PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/xbin:/system/bin'
CURRENT_WORKING_DIR='/data/data/com.termux/files/home'
SUDO_SHELL_HOME='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_HOME_PARENT_DIR='/data/data/com.termux/files/home'

Running sudo_setup_termux_tmp_dir
The TMPDIR directory already exists at '/data/data/com.termux/files/usr/tmp'
Skipping setting ownership and permission for TMPDIR directory since it was not created

Running sudo_set_priority_dependent_variables with priority 'termux'
PATH_TO_EXPORT='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'
LD_LIBRARY_PATH_TO_EXPORT=''
LD_PRELOAD_COMMAND='export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';'

Running sudo_set_su_env_command
SU_ENV_COMMAND=`/sbin/su --preserve-environment --shell /data/data/com.termux/files/usr/bin/bash -c export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so'; `

Running sudo_set_sudo_shell
SUDO_SHELL='/data/data/com.termux/files/usr/bin/bash'
SUDO_SHELL_BASENAME='bash'
SUDO_SHELL_PARENT_DIR='/data/data/com.termux/files/usr/bin'

Running sudo_set_sudo_shell_rcfile
SUDO_SHELL_RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc'
SUDO_SHELL_RCFILE_PARENT_DIR='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_RCFILE_COMMANDS='export RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc';'
SUDO_SHELL_RCFILE_VALUE=`
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}

`

Running sudo_set_sudo_shell_histfile
SUDO_SHELL_HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history'
SUDO_SHELL_HISTFILE_PARENT_DIR='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_HISTFILE_COMMANDS='export HISTSIZE=1000;
export HISTFILESIZE=1000;
export HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history';'

Running sudo_set_sudo_shell_command
SUDO_SHELL_COMMAND='/data/data/com.termux/files/usr/bin/bash --noprofile --norc'
SUDO_SHELL_INTERACTIVE_COMMAND='/data/data/com.termux/files/usr/bin/bash --rcfile /data/data/com.termux/files/home/.suroot/.bashrc -i'

Running sudo_set_pre_sudo_shell_commands_to_run
Setting PRE_SUDO_SHELL_COMMANDS_TO_RUN with priority to 'termux' bin and library paths for COMMAND_TYPE 'su'



Running sudo_setup_sudo_shell_home_and_working_environment_wrapper stage 1

Running sudo_remount_partitions_for_sudo_shell_homes

Running sudo_setup_sudo_shell_home_and_working_environment
Started sudo_setup_sudo_shell_home_and_working_environment

Running sudo_setup_shell_home for SUDO_SHELL
valid_path_under_termux_rootfs_regex="^[\/]+.+"
ANDROID_DATA=/data
ANDROID_HOME=/data/data/com.termux/files/home/android
ANDROID_ROOT=/system
ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
ANDROID__BUILD_VERSION_SDK=29
BASH=/data/data/com.termux/files/usr/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
BASHPID=17734
BASH_ALIASES=
BASH_ARGC=0
BASH_ARGV=
BASH_ARGV0=/data/data/com.termux/files/usr/bin/bash
BASH_CMDS=
BASH_COMMAND=echo "${v}=${!v}"
BASH_EXECUTION_STRING=export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so'; source '/data/data/com.termux/files/usr/bin/sudo' || exit $?; sudo_setup_sudo_shell_home_and_working_environment;
BASH_LINENO=3773
BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.
BASH_MONOSECONDS=92210
BASH_REMATCH=/data/data/com.termux/files/home/.suroot
BASH_SOURCE=/data/data/com.termux/files/usr/bin/sudo
BASH_SUBSHELL=1
BASH_VERSINFO=5
BASH_VERSION=5.3.3(1)-release
BAT_THEME=Visual Studio Dark+
BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdC
CDPATH=/data/data/com.termux/files/usr
COLORTERM=truecolor
COMP_WORDBREAKS= 	
"'@><=;|&(:
DEX2OATBOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar
DIRSTACK=/data/data/com.termux/files/home
EDITOR=micro
EPOCHREALTIME=1760677723.070207
EPOCHSECONDS=1760677723
EUID=0
EXTERNAL_STORAGE=/sdcard
FUNCNAME=sudo_validate_path_is_a_whitelisted_path_under_termux_rootfs
FZF_COMPLETION_TRIGGER=,
FZF_CTRL_T_COMMAND=fd -t f -HF -E=.git -E=node_modules
FZF_DEFAULT_COMMAND=fd --hidden --follow --exclude=.git --exclude=node_modules
FZF_TMUX_OPTS=-p 90%
GPG_TTY=/dev/pts/0
GREP_COLOR=1;32
GROUPS=0
HISTCMD=0
HISTCONTROL=ignoreboth:erasedups
HISTSIZE=10000
HOME=/data/data/com.termux/files/home/.suroot
HOSTNAME=localhost
HOSTTYPE=aarch64
IFS= 	

JAVA_HOME=/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk
LANG=en_US.UTF-8
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
LINENO=5191
MACHTYPE=aarch64-unknown-linux-android
MANPAGER=less -R --use-color -Dd+g -Du+b
OPTERR=1
OPTIND=1
OSTYPE=linux-android
PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
PIPESTATUS=0
PPID=749
PREFIX=/data/data/com.termux/files/usr
PS4=+ 
PWD=/data/data/com.termux/files/home
PYTHONPYCACHEPREFIX=/data/data/com.termux/files/home/.cache/Python
RANDOM=14264
REMOVE_PREVIOUS_SUDO_TEMP_FILES=0
SECONDS=0
SETUP_SUDO_TEMP_DIRECTORY=0
SHELL=/data/data/com.termux/files/usr/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=3
SRANDOM=368357805
SSH_AUTH_SOCK=/data/data/com.termux/files/usr/var/run/ssh-agent.socket
SUDO_EDITOR=micro
SUDO_LOG_LEVEL=5
SUDO_POST_SHELL_HISTFILE=
SUDO_SCRIPT_PATH=/data/data/com.termux/files/usr/bin/sudo
SUDO_SHELL_HISTFILE=/data/data/com.termux/files/home/.suroot/.bash_history
SUDO_SHELL_HISTFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME_PARENT_DIR=/data/data/com.termux/files/home
SUDO_SHELL_RCFILE=/data/data/com.termux/files/home/.suroot/.bashrc
SUDO_SHELL_RCFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_RCFILE_VALUE=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


SUDO_SHELL_WORKING_DIR=
SUDO_TEMP_DIRECTORY_PARENT_DIRECTORY=/data/data/com.termux/files/home/.suroot
SUDO_TEMP_DIRECTORY_PREFIX=.sudo.temp
SUDO__VERSION=1.2.0
TERM=xterm-256color
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c235,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_HOME=/data/data/com.termux/files/home
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.3
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TMPDIR=/data/data/com.termux/files/usr/tmp
TZ=Asia/Jakarta
UID=0
USER=ceka
VISUAL=micro
_=v
blacklisted_path_in_termux_rootfs_regex=^(([\/]+data[\/]+data[\/]+com\.termux[\/]+files[\/]+home[\/]+\.(cache|config|local|termux))|()|([\/]+.*))([\/]+)?$
create_shell_home_if_it_does_not_exist=1
label=SUDO_SHELL_HOME
only_set_perms_and_ownership_on_creation_of_shell_home=1
path=/data/data/com.termux/files/home/.suroot
shell_automatically_create_history_file=
shell_automatically_create_rc_file=
shell_histfile=/data/data/com.termux/files/home/.suroot/.bash_history
shell_histfile_parent_dir=/data/data/com.termux/files/home/.suroot
shell_home=/data/data/com.termux/files/home/.suroot
shell_home_file_type_tests=rwx
shell_home_parent_dir=/data/data/com.termux/files/home
shell_home_permission=700
shell_label=SUDO_SHELL
shell_rcfile=/data/data/com.termux/files/home/.suroot/.bashrc
shell_rcfile_parent_dir=/data/data/com.termux/files/home/.suroot
shell_rcfile_value=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


termux_home_escaped=[\/]+data[\/]+data[\/]+com\.termux[\/]+files[\/]+home
termux_prefix_escaped=
termux_rootfs_escaped=
valid_path_under_termux_rootfs_regex=^[\/]+.+
SUDO_SHELL_HOME '/data/data/com.termux/files/home/.suroot' matches one of following blacklisted paths:
'/data/data/com.termux/files/home/.{cache,config,local,termux}', '/*'
The '/data/data/com.termux/files/home/.suroot' cannot be used as SUDO_SHELL_HOME
Failed to setup SUDO_SHELL_HOME

Running sudo_remount_partitions_for_sudo_shell_homes

ddCeka avatar Oct 17 '25 05:10 ddCeka

As expected, TERMUX_ROOTFS and TERMUX_PREFIX and even some other SUDO_ variables are not apparently being exported inside the root shell. Can you also add:

echo "all:"; compgen -v | sort | while read -r v; do echo "${v}=${!v}"; done and echo "exported:"; compgen -e | sort | while read -r v; do echo "${v}=${!v}"; done at https://github.com/agnostic-apollo/sudo/blob/50b2ec4455b63e3a117d8a1ca7025c3cc8923322/sudo#L3587

echo "exported:"; compgen -e | sort | while read -r v; do echo "${v}=${!v}"; done at https://github.com/agnostic-apollo/sudo/blob/50b2ec4455b63e3a117d8a1ca7025c3cc8923322/sudo#L3596

agnostic-apollo avatar Oct 17 '25 07:10 agnostic-apollo

Hello, this is the log after adding those line on sudo

$ sudo -vvvv su

Running sudo

Running sudo_set_su_variables
A su binary found at '/sbin/su'
SU='/sbin/su'
SU_BIN_PATH='/sbin'
SU_INTERACTIVE_OPTION_SUPPORTED='0'

Running sudo_set_required_variables
PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/xbin:/system/bin'
CURRENT_WORKING_DIR='/data/data/com.termux/files/home'
SUDO_SHELL_HOME='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_HOME_PARENT_DIR='/data/data/com.termux/files/home'

Running sudo_setup_termux_tmp_dir
The TMPDIR directory already exists at '/data/data/com.termux/files/usr/tmp'
Skipping setting ownership and permission for TMPDIR directory since it was not created

Running sudo_set_priority_dependent_variables with priority 'termux'
PATH_TO_EXPORT='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'
LD_LIBRARY_PATH_TO_EXPORT=''
LD_PRELOAD_COMMAND='export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';'

Running sudo_set_su_env_command
SU_ENV_COMMAND=`/sbin/su --preserve-environment --shell /data/data/com.termux/files/usr/bin/bash -c export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so'; `

Running sudo_set_sudo_shell
SUDO_SHELL='/data/data/com.termux/files/usr/bin/bash'
SUDO_SHELL_BASENAME='bash'
SUDO_SHELL_PARENT_DIR='/data/data/com.termux/files/usr/bin'

Running sudo_set_sudo_shell_rcfile
SUDO_SHELL_RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc'
SUDO_SHELL_RCFILE_PARENT_DIR='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_RCFILE_COMMANDS='export RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc';'
SUDO_SHELL_RCFILE_VALUE=`
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}

`

Running sudo_set_sudo_shell_histfile
SUDO_SHELL_HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history'
SUDO_SHELL_HISTFILE_PARENT_DIR='/data/data/com.termux/files/home/.suroot'
SUDO_SHELL_HISTFILE_COMMANDS='export HISTSIZE=1000;
export HISTFILESIZE=1000;
export HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history';'

Running sudo_set_sudo_shell_command
SUDO_SHELL_COMMAND='/data/data/com.termux/files/usr/bin/bash --noprofile --norc'
SUDO_SHELL_INTERACTIVE_COMMAND='/data/data/com.termux/files/usr/bin/bash --rcfile /data/data/com.termux/files/home/.suroot/.bashrc -i'

Running sudo_set_pre_sudo_shell_commands_to_run
Setting PRE_SUDO_SHELL_COMMANDS_TO_RUN with priority to 'termux' bin and library paths for COMMAND_TYPE 'su'



Running sudo_setup_sudo_shell_home_and_working_environment_wrapper stage 1

Running sudo_remount_partitions_for_sudo_shell_homes
all:
ADDITIONAL_SUDO_POST_SHELL_POST_COMMANDS_TO_RUN=
ADDITIONAL_SUDO_POST_SHELL_PRE_COMMANDS_TO_RUN=
ADDITIONAL_SUDO_SHELL_POST_COMMANDS_TO_RUN=
ADDITIONAL_SUDO_SHELL_PRE_COMMANDS_TO_RUN=
ANDROID_DATA=/data
ANDROID_HOME=/data/data/com.termux/files/home/android
ANDROID_PATH=/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
ANDROID_PRIORITY_LD_LIBRARY_PATH=
ANDROID_PRIORITY_LD_PRELOAD_COMMAND=unset LD_PRELOAD;
ANDROID_PRIORITY_PATH=/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets
ANDROID_ROOT=/system
ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
ANDROID__BUILD_VERSION_SDK=29
A_FLAG_PASSED=0
BASH=/data/data/com.termux/files/usr/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
BASHPID=3281
BASH_ALIASES=
BASH_ARGC=
BASH_ARGV=
BASH_ARGV0=/data/data/com.termux/files/usr/bin/sudo
BASH_CMDS=
BASH_COMMAND=echo "${v}=${!v}"
BASH_LINENO=545
BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.
BASH_MONOSECONDS=104727
BASH_REMATCH=sudo_trap
BASH_SHELL_PATH=/data/data/com.termux/files/usr/bin/bash
BASH_SOURCE=/data/data/com.termux/files/usr/bin/sudo
BASH_SUBSHELL=1
BASH_VERSINFO=5
BASH_VERSION=5.3.3(1)-release
BAT_THEME=Visual Studio Dark+
BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar
CDPATH=/data/data/com.termux/files/usr
CLEAR_SHELL_AFTER_RUNNING_CORE_SCRIPT=0
COLORTERM=truecolor
COLUMNS=62
COMMAND_TYPE=su
COMMAND_TYPE_PATH_FORCED=0
COMMA_ALTERNATIVE=‚
COMP_WORDBREAKS= 	
"'@><=;|&(:
CORE_SCRIPT_IS_PATH_TO_SCRIPT_FILE=0
CURRENT_WORKING_DIR=/data/data/com.termux/files/home
DECODE_CORE_SCRIPT_CONTENT=0
DEX2OATBOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar
DIRSTACK=/data/data/com.termux/files/home
DISABLE_ARGUMENTS_LOGGING=0
DISABLE_PRESERVE_ENVIRONMENT_FOR_SU=0
DISABLE_STDIN_FOR_CORE_SCRIPT=0
DO_NOT_DELETE_SUDO_TEMP_DIRECTORY_ON_EXIT=0
DO_NOT_REMOUNT_PARTITIONS_BACK_TO_RO_AFTER_SUDO=0
EDITOR=micro
EPOCHREALTIME=1760692127.790584
EPOCHSECONDS=1760692127
EUID=10235
EXEC_SUDO_SHELL=0
EXIT_EARLY_IF_CORE_SCRIPT_FAILS=0
EXTERNAL_STORAGE=/sdcard
FORCE_REMOUNT_PARTITIONS_BACK_TO_RO_AFTER_SUDO=0
FORCE_USE_TEMP_SCRIPT_FILE_FOR_CORE_SCRIPT=0
FUNCNAME=sudo_setup_sudo_shell_home_and_working_environment_wrapper
FZF_COMPLETION_TRIGGER=,
FZF_CTRL_T_COMMAND=fd -t f -HF -E=.git -E=node_modules
FZF_DEFAULT_COMMAND=fd --hidden --follow --exclude=.git --exclude=node_modules
FZF_DEFAULT_OPTS=
--layout=reverse --info=inline --height=80% --multi --cycle --margin=1 --border=rounded
--preview '([[ -f {} ]] && (bat --style=numbers --color=always --line-range=:500 {} || cat {})) || ([[ -d {} ]] && (lsd -ahlT -L=2 -s=extension --group-directories-first --icons --git --git-ignore --no-user {} | less)) || echo {} 2> /dev/null | head -200'
--prompt=' ' --pointer=' ' --marker=' '
--color='hl:148,hl+:154,prompt:blue,pointer:032,marker:010,bg+:000,gutter:000'
--preview-window=right:65%
--bind '?:toggle-preview'
--bind 'ctrl-a:select-all'
--bind 'ctrl-y:execute-silent(echo {+} | )'
--bind 'ctrl-e:execute( micro {+})+reload(fzf)'
FZF_TMUX_OPTS=-p 90%
GENERAL_SHELL_APATH_FUNCTION=
apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}

GENERAL_SHELL_TPATH_FUNCTION=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}

GO_BACK_TO_LAST_ACTIVITY_AFTER_RUNNING_CORE_SCRIPT=0
GO_TO_LAUNCHER_ACTIVITY_AFTER_RUNNING_CORE_SCRIPT=0
GPG_TTY=/dev/pts/0
GREP_COLOR=1;32
GROUPS=10235
HISTCMD=0
HISTCONTROL=ignoreboth:erasedups
HISTFILESIZE=20000
HISTIGNORE=ls:ll:la:l:bg:fg:history:clear:c:help
HISTSIZE=10000
HOLD_AFTER_SUDO=0
HOLD_ONLY_ON_FAILURE=0
HOLD_STRING_AFTER_SUDO=
HOME=/data/data/com.termux/files/home
HOSTNAME=localhost
HOSTTYPE=aarch64
IFS= 	

JAVA_HOME=/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk
LANG=en_US.UTF-8
LD_LIBRARY_PATH=
LD_LIBRARY_PATH_TO_EXPORT=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
LD_PRELOAD_COMMAND=export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';
LINENO=3587
LINES=32
MACHTYPE=aarch64-unknown-linux-android
MANPAGER=less -R --use-color -Dd+g -Du+b
OLD_LD_LIBRARY_PATH=
OLD_PATH=/data/data/com.termux/files/home/android/platform-tools:/data/data/com.termux/files/home/android/cmdline-tools/latest/bin:/data/data/com.termux/files/home/android/build-tools:/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk/bin:/data/data/com.termux/files/usr/bin
OPTERR=1
OPTIND=1
OSTYPE=linux-android
PARSE_COMMANDS_AS_PER_RUN_COMMAND_INTENT_RULES=0
PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/xbin:/system/bin
PATH_PRIORITY=default
PATH_TO_EXPORT=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
PIPESTATUS=0
PPID=1017
PREFIX=/data/data/com.termux/files/usr
PRE_SUDO_SHELL_COMMANDS_TO_RUN=export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin';
export SUDO__TERMUX_PRIORITY_PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin';
export SUDO__ANDROID_PRIORITY_PATH='/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets';
unset LD_LIBRARY_PATH;
unset SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH;
unset SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH;
export TERMUX__ROOTFS='/data/data/com.termux/files';
export TERMUX__HOME='/data/data/com.termux/files/home';
export TERMUX__PREFIX='/data/data/com.termux/files/usr';
export TMPDIR='/data/data/com.termux/files/usr/tmp';
export HOME='/data/data/com.termux/files/home/.suroot';
export TERM='xterm-256color';
export LANG='en_US.UTF-8';
export PS1='# ';
export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';
export SUDO__TERMUX_LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';
export RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc';
export HISTSIZE=1000;
export HISTFILESIZE=1000;
export HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history';
cd -- '/data/data/com.termux/files/home';

PS4=+ 
PWD=/data/data/com.termux/files/home
PYTHONPYCACHEPREFIX=/data/data/com.termux/files/home/.cache/Python
RANDOM=16228
RCFILE_FUNCTIONS=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}

REMOVE_PREVIOUS_SUDO_TEMP_FILES=0
ROOTFS_PARTITION_MM_DEPENDENT_PATHS=
ROOTFS_PARTITION_RW_DEPENDENT_PATHS=
ROOTFS_PREVIOUS_STATE_RO=0
RUN_CORE_SCRIPT_IN_BACKGROUND=0
RUN_INTERACTIVE_POST_SUDO_SHELL_AFTER_RUNNING_CORE_SCRIPT=0
SAME_SUDO_POST_SHELL_AS_SUDO_SHELL=0
SAME_SUDO_POST_SHELL_HOME_AS_SUDO_SHELL_HOME=0
SECONDS=0
SETUP_SUDO_TEMP_DIRECTORY=0
SET_SECONDARY_PATHS=1
SET_SECONDARY_PRIORITY_PATHS=1
SET_SUDO_SHELL_TERMINAL_TITLE=0
SHELL=/data/data/com.termux/files/usr/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHELL_ADDITIONAL_COMMAND_OPTIONS=
SHELL_COMMAND=/data/data/com.termux/files/usr/bin/bash
SHELL_COMMAND_PRINT_FORMAT=%q 
SHELL_HISTFILE=/data/data/com.termux/files/home/.suroot/.bash_history
SHELL_HISTFILE_BASENAME=.bash_history
SHELL_HISTFILE_COMMANDS=export HISTSIZE=1000;
export HISTFILESIZE=1000;
export HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history';
SHELL_HISTFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SHELL_INTERACTIVE_ADDITIONAL_COMMAND_OPTIONS=--rcfile
SHELL_INTERACTIVE_COMMAND=/data/data/com.termux/files/usr/bin/bash
SHELL_INTERACTIVE_COMMAND_PRINT_FORMAT=%q 
SHELL_RCFILE=/data/data/com.termux/files/home/.suroot/.bashrc
SHELL_RCFILE_BASENAME=.bashrc
SHELL_RCFILE_COMMANDS=export RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc';
SHELL_RCFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SHELL_RCFILE_VALUE=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


SHLVL=2
SLEEP_AFTER_SUDO=0
SLEEP_ONLY_ON_FAILURE=0
SLEEP_TIME_AFTER_SUDO=
SRANDOM=3360641825
SSH_AUTH_SOCK=/data/data/com.termux/files/usr/var/run/ssh-agent.socket
SU=/sbin/su
SUDO_ADDITIONAL_LD_LIBRARY_PATHS_TO_EXPORT=
SUDO_ADDITIONAL_PATHS_TO_EXPORT=
SUDO_ARG_MAX_SAFE_LIMIT=122880
SUDO_COMMAND=
SUDO_CONFIG_FILE_PATH=/data/data/com.termux/files/home/.config/sudo/sudo.config
SUDO_CONFIG_FILE_SOURCED=0
SUDO_CORE_SCRIPT_REDIRECT_MODE=
SUDO_CORE_SCRIPT_TEMP_FILENAME=
SUDO_DRY_RUN=0
SUDO_EDITOR=micro
SUDO_EXPORT_ALL_EXISTING_PATHS_IN_LD_LIBRARY_PATH_VARIABLE=0
SUDO_EXPORT_ALL_EXISTING_PATHS_IN_PATH_VARIABLE=0
SUDO_LD_LIBRARY_PATH=
SUDO_LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
SUDO_LOG_ARGS=0
SUDO_LOG_LEVEL=5
SUDO_MAX_LOG_LEVEL=5
SUDO_NOOP_COMMAND=0
SUDO_POST_SHELL=
SUDO_POST_SHELL_BASENAME=
SUDO_POST_SHELL_HISTFILE=
SUDO_POST_SHELL_HOME=
SUDO_POST_SHELL_INTERACTIVE_ADDITIONAL_COMMAND_OPTIONS=
SUDO_POST_SHELL_INTERACTIVE_COMMAND=
SUDO_POST_SHELL_PARENT_DIR=
SUDO_POST_SHELL_PS1=# 
SUDO_POST_SHELL_RCFILE=
SUDO_POST_SHELL_STDIN_STRING=
SUDO_RLWRAP_ADDITIONAL_COMMAND_OPTIONS=
SUDO_SCRIPT_PATH=/data/data/com.termux/files/usr/bin/sudo
SUDO_SCRIPT_SHELLS_WITHOUT_PROCESS_SUBSTITUTION_SUPPORT=dash sh node php
SUDO_SHELL=/data/data/com.termux/files/usr/bin/bash
SUDO_SHELLS_AUTOMATICALLY_CREATE_HISTORY_FILES=1
SUDO_SHELLS_AUTOMATICALLY_CREATE_RC_FILES=1
SUDO_SHELLS_HISTORY_ENABLED=1
SUDO_SHELL_ADDITIONAL_COMMAND_OPTIONS=
SUDO_SHELL_BASENAME=bash
SUDO_SHELL_COMMAND=/data/data/com.termux/files/usr/bin/bash
SUDO_SHELL_COMMAND_PRINT_FORMAT=%q 
SUDO_SHELL_HISTFILE=/data/data/com.termux/files/home/.suroot/.bash_history
SUDO_SHELL_HISTFILE_COMMANDS=export HISTSIZE=1000;
export HISTFILESIZE=1000;
export HISTFILE='/data/data/com.termux/files/home/.suroot/.bash_history';
SUDO_SHELL_HISTFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME_BASENAME=.suroot
SUDO_SHELL_HOME_PARENT_DIR=/data/data/com.termux/files/home
SUDO_SHELL_INTERACTIVE_ADDITIONAL_COMMAND_OPTIONS=--rcfile
SUDO_SHELL_INTERACTIVE_COMMAND=/data/data/com.termux/files/usr/bin/bash
SUDO_SHELL_INTERACTIVE_COMMAND_PRINT_FORMAT=%q 
SUDO_SHELL_PARENT_DIR=/data/data/com.termux/files/usr/bin
SUDO_SHELL_PS1=# 
SUDO_SHELL_RCFILE=/data/data/com.termux/files/home/.suroot/.bashrc
SUDO_SHELL_RCFILE_COMMANDS=export RCFILE='/data/data/com.termux/files/home/.suroot/.bashrc';
SUDO_SHELL_RCFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_RCFILE_VALUE=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


SUDO_SHELL_STDIN_STRING=
SUDO_SHELL_TERMINAL_TITLE=
SUDO_SHELL_WORKING_DIR=
SUDO_SKIP_ON_NOOP_COMMAND=0
SUDO_SUPPORTED_INTERACTIVE_SHELLS=bash zsh dash sh fish python ruby pry node perl lua5.2 lua5.3 lua5.4 php python2 ksh
SUDO_SUPPORTED_POST_SHELLS=
SUDO_SUPPORTED_SCRIPT_SHELLS=bash zsh dash sh fish python ruby node perl lua5.2 lua5.3 lua5.4 php python2 ksh
SUDO_SUPPORTED_SHELLS=bash zsh dash sh fish python ruby pry node perl lua5.2 lua5.3 lua5.4 php python2 ksh
SUDO_SU_ENV_ADDITIONAL_COMMAND_OPTIONS=
SUDO_SU_PATH=
SUDO_SU_RUN_ADDITIONAL_COMMAND_OPTIONS=
SUDO_TEMP_DIRECTORY=
SUDO_TEMP_DIRECTORY_PARENT_DIRECTORY=/data/data/com.termux/files/home/.suroot
SUDO_TEMP_DIRECTORY_PREFIX=.sudo.temp
SUDO_XARGS_PATH=
SUDO__VERSION=1.2.0
SU_BIN_PATH=/sbin
SU_BIN_PATH_BASENAME=su
SU_ENV_COMMAND=/sbin/su --preserve-environment --shell /data/data/com.termux/files/usr/bin/bash -c export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so'; 
SU_ENV_COMMAND_ADDITIONAL_VARIABLES_TO_EXPORT_ARRAY=ANDROID__BUILD_VERSION_SDK
SU_ENV_COMMAND_VARIABLES_TO_EXPORT=export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';
SU_INTERACTIVE_OPTION_SUPPORTED=0
SYSTEM_PARTITION_MM_DEPENDENT_PATHS=
SYSTEM_PARTITION_RW_DEPENDENT_PATHS=
SYSTEM_PREVIOUS_STATE_RO=0
SYS_BIN=/system/bin
SYS_XBIN=/system/xbin
TERM=xterm-256color
TERMUX_API_VERSION=0.53.0
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PID=964
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__NAME=Termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c235,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_BIN=/data/data/com.termux/files/usr/bin
TERMUX_BIN_APPLETS=/data/data/com.termux/files/usr/bin/applets
TERMUX_ENV__SS_TERMUX=_
TERMUX_ENV__SS_TERMUX_APP=APP__
TERMUX_ENV__S_TERMUX=TERMUX__
TERMUX_HOME=/data/data/com.termux/files/home
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib
TERMUX_LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets
TERMUX_PREFIX=/data/data/com.termux/files/usr
TERMUX_PREFIX__N=TERMUX__PREFIX
TERMUX_PRIORITY_LD_LIBRARY_PATH=
TERMUX_PRIORITY_LD_PRELOAD_COMMAND=export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so';
TERMUX_PRIORITY_PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
TERMUX_ROOTFS=/data/data/com.termux/files
TERMUX_VERSION=0.118.3
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__LNAME=termux
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c235,c256,c512,c768
TMPDIR=/data/data/com.termux/files/usr/tmp
TZ=Asia/Jakarta
T_FLAG_PASSED=0
UID=10235
USER=ceka
USE_ROOT_FOR_PATH_SEARCH_AND_VALIDATION=0
VALID_ABSOLUTE_PATH_REGEX=^(/[^/]+)+$
VALID_NUMBER_REGEX=^[0-9]+$
VALID_PATH_IN_ROOTFS_PARTITION_REGEX=^/[^/]*/?$
VALID_PATH_IN_SYSTEM_PARTITION_REGEX=^/system/.*
VALID_ROOTFS_OR_ABSOLUTE_PATH_REGEX=^((/)|((/[^/]+)+))$
VALID_SU_MOUNT_MASTER_OPTION_PREFIXED_STRING=^[ \t]*(--mount-master|-mm)[ \t]*
VISUAL=micro
_=v
file_type_test=x
i=4
interactive_sudo_shell_required=1
previous_priority_dependent_variables_priortiy=termux
return_value=
var=
exported:
ANDROID_DATA=/data
ANDROID_HOME=/data/data/com.termux/files/home/android
ANDROID_ROOT=/system
ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
ANDROID__BUILD_VERSION_SDK=29
BAT_THEME=Visual Studio Dark+
BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar
CDPATH=/data/data/com.termux/files/usr
COLORTERM=truecolor
DEX2OATBOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar
EDITOR=micro
EXTERNAL_STORAGE=/sdcard
FZF_COMPLETION_TRIGGER=,
FZF_CTRL_T_COMMAND=fd -t f -HF -E=.git -E=node_modules
FZF_DEFAULT_COMMAND=fd --hidden --follow --exclude=.git --exclude=node_modules
FZF_DEFAULT_OPTS=
--layout=reverse --info=inline --height=80% --multi --cycle --margin=1 --border=rounded
--preview '([[ -f {} ]] && (bat --style=numbers --color=always --line-range=:500 {} || cat {})) || ([[ -d {} ]] && (lsd -ahlT -L=2 -s=extension --group-directories-first --icons --git --git-ignore --no-user {} | less)) || echo {} 2> /dev/null | head -200'
--prompt=' ' --pointer=' ' --marker=' '
--color='hl:148,hl+:154,prompt:blue,pointer:032,marker:010,bg+:000,gutter:000'
--preview-window=right:65%
--bind '?:toggle-preview'
--bind 'ctrl-a:select-all'
--bind 'ctrl-y:execute-silent(echo {+} | )'
--bind 'ctrl-e:execute( micro {+})+reload(fzf)'
FZF_TMUX_OPTS=-p 90%
GPG_TTY=/dev/pts/0
GREP_COLOR=1;32
HISTCONTROL=ignoreboth:erasedups
HISTFILESIZE=20000
HISTIGNORE=ls:ll:la:l:bg:fg:history:clear:c:help
HISTSIZE=10000
HOME=/data/data/com.termux/files/home
JAVA_HOME=/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk
LANG=en_US.UTF-8
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
MANPAGER=less -R --use-color -Dd+g -Du+b
PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/xbin:/system/bin
PREFIX=/data/data/com.termux/files/usr
PWD=/data/data/com.termux/files/home
PYTHONPYCACHEPREFIX=/data/data/com.termux/files/home/.cache/Python
SHELL=/data/data/com.termux/files/usr/bin/bash
SHLVL=2
SSH_AUTH_SOCK=/data/data/com.termux/files/usr/var/run/ssh-agent.socket
SUDO_EDITOR=micro
SUDO_LOG_LEVEL=5
SUDO_SCRIPT_PATH=/data/data/com.termux/files/usr/bin/sudo
TERM=xterm-256color
TERMUX_API_VERSION=0.53.0
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PID=964
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c235,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.3
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c235,c256,c512,c768
TMPDIR=/data/data/com.termux/files/usr/tmp
TZ=Asia/Jakarta
USER=ceka
VISUAL=micro

Running sudo_setup_sudo_shell_home_and_working_environment
exported:
ANDROID_DATA=/data
ANDROID_HOME=/data/data/com.termux/files/home/android
ANDROID_ROOT=/system
ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
ANDROID__BUILD_VERSION_SDK=29
BAT_THEME=Visual Studio Dark+
BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar
CDPATH=/data/data/com.termux/files/usr
COLORTERM=truecolor
DEX2OATBOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar
EDITOR=micro
EXTERNAL_STORAGE=/sdcard
FZF_COMPLETION_TRIGGER=,
FZF_CTRL_T_COMMAND=fd -t f -HF -E=.git -E=node_modules
FZF_DEFAULT_COMMAND=fd --hidden --follow --exclude=.git --exclude=node_modules
FZF_DEFAULT_OPTS=
--layout=reverse --info=inline --height=80% --multi --cycle --margin=1 --border=rounded
--preview '([[ -f {} ]] && (bat --style=numbers --color=always --line-range=:500 {} || cat {})) || ([[ -d {} ]] && (lsd -ahlT -L=2 -s=extension --group-directories-first --icons --git --git-ignore --no-user {} | less)) || echo {} 2> /dev/null | head -200'
--prompt=' ' --pointer=' ' --marker=' '
--color='hl:148,hl+:154,prompt:blue,pointer:032,marker:010,bg+:000,gutter:000'
--preview-window=right:65%
--bind '?:toggle-preview'
--bind 'ctrl-a:select-all'
--bind 'ctrl-y:execute-silent(echo {+} | )'
--bind 'ctrl-e:execute( micro {+})+reload(fzf)'
FZF_TMUX_OPTS=-p 90%
GPG_TTY=/dev/pts/0
GREP_COLOR=1;32
HISTCONTROL=ignoreboth:erasedups
HISTFILESIZE=20000
HISTIGNORE=ls:ll:la:l:bg:fg:history:clear:c:help
HISTSIZE=10000
HOME=/data/data/com.termux/files/home
JAVA_HOME=/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk
LANG=en_US.UTF-8
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
MANPAGER=less -R --use-color -Dd+g -Du+b
PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/xbin:/system/bin
PREFIX=/data/data/com.termux/files/usr
PWD=/data/data/com.termux/files/home
PYTHONPYCACHEPREFIX=/data/data/com.termux/files/home/.cache/Python
REMOVE_PREVIOUS_SUDO_TEMP_FILES=0
SETUP_SUDO_TEMP_DIRECTORY=0
SHELL=/data/data/com.termux/files/usr/bin/bash
SHLVL=2
SSH_AUTH_SOCK=/data/data/com.termux/files/usr/var/run/ssh-agent.socket
SUDO_DRY_RUN=0
SUDO_EDITOR=micro
SUDO_LOG_LEVEL=5
SUDO_POST_SHELL_HISTFILE=
SUDO_POST_SHELL_HOME=
SUDO_POST_SHELL_RCFILE=
SUDO_SCRIPT_PATH=/data/data/com.termux/files/usr/bin/sudo
SUDO_SHELLS_AUTOMATICALLY_CREATE_HISTORY_FILES=1
SUDO_SHELLS_AUTOMATICALLY_CREATE_RC_FILES=1
SUDO_SHELL_HISTFILE=/data/data/com.termux/files/home/.suroot/.bash_history
SUDO_SHELL_HISTFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME_PARENT_DIR=/data/data/com.termux/files/home
SUDO_SHELL_RCFILE=/data/data/com.termux/files/home/.suroot/.bashrc
SUDO_SHELL_RCFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_RCFILE_VALUE=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


SUDO_SHELL_WORKING_DIR=
SUDO_TEMP_DIRECTORY=
SUDO_TEMP_DIRECTORY_PARENT_DIRECTORY=/data/data/com.termux/files/home/.suroot
SUDO_TEMP_DIRECTORY_PREFIX=.sudo.temp
TERM=xterm-256color
TERMUX_API_VERSION=0.53.0
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PID=964
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c235,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_HOME=/data/data/com.termux/files/home
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_PREFIX=/data/data/com.termux/files/usr
TERMUX_ROOTFS=/data/data/com.termux/files
TERMUX_VERSION=0.118.3
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c235,c256,c512,c768
TMPDIR=/data/data/com.termux/files/usr/tmp
TZ=Asia/Jakarta
USER=ceka
VISUAL=micro
Started sudo_setup_sudo_shell_home_and_working_environment

Running sudo_setup_shell_home for SUDO_SHELL
valid_path_under_termux_rootfs_regex="^[\/]+.+"
ANDROID_DATA=/data
ANDROID_HOME=/data/data/com.termux/files/home/android
ANDROID_ROOT=/system
ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
ANDROID__BUILD_VERSION_SDK=29
BASH=/data/data/com.termux/files/usr/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
BASHPID=3301
BASH_ALIASES=
BASH_ARGC=0
BASH_ARGV=
BASH_ARGV0=/data/data/com.termux/files/usr/bin/bash
BASH_CMDS=
BASH_COMMAND=echo "${v}=${!v}"
BASH_EXECUTION_STRING=export PATH='/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin'; export LD_LIBRARY_PATH=''; export HOME='/data/data/com.termux/files/home/.suroot'; export LANG='en_US.UTF-8'; export LD_PRELOAD='/data/data/com.termux/files/usr/lib/libtermux-exec.so'; source '/data/data/com.termux/files/usr/bin/sudo' || exit $?; sudo_setup_sudo_shell_home_and_working_environment;
BASH_LINENO=3774
BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.
BASH_MONOSECONDS=104727
BASH_REMATCH=/data/data/com.termux/files/home/.suroot
BASH_SOURCE=/data/data/com.termux/files/usr/bin/sudo
BASH_SUBSHELL=1
BASH_VERSINFO=5
BASH_VERSION=5.3.3(1)-release
BAT_THEME=Visual Studio Dark+
BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.
CDPATH=/data/data/com.termux/files/usr
COLORTERM=truecolor
COMP_WORDBREAKS= 	
"'@><=;|&(:
DEX2OATBOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/tcmiface.jar:/system/framework/telephony-ext.jar:/system/framework/qcnvitems.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/system/framework/WfdCommon.jar:/system/framework/oneplus_sdk_utils.jar:/system/framework/oneplus_sdk_wrapper.jar:/system/framework/oneplus-framework.jar
DIRSTACK=/data/data/com.termux/files/home
EDITOR=micro
EPOCHREALTIME=1760692127.972541
EPOCHSECONDS=1760692127
EUID=0
EXTERNAL_STORAGE=/sdcard
FUNCNAME=sudo_validate_path_is_a_whitelisted_path_under_termux_rootfs
FZF_COMPLETION_TRIGGER=,
FZF_CTRL_T_COMMAND=fd -t f -HF -E=.git -E=node_modules
FZF_DEFAULT_COMMAND=fd --hidden --follow --exclude=.git --exclude=node_modules
FZF_TMUX_OPTS=-p 90%
GPG_TTY=/dev/pts/0
GREP_COLOR=1;32
GROUPS=0
HISTCMD=0
HISTCONTROL=ignoreboth:erasedups
HISTSIZE=10000
HOME=/data/data/com.termux/files/home/.suroot
HOSTNAME=localhost
HOSTTYPE=aarch64
IFS= 	

JAVA_HOME=/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk
LANG=en_US.UTF-8
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
LINENO=5192
MACHTYPE=aarch64-unknown-linux-android
MANPAGER=less -R --use-color -Dd+g -Du+b
OPTERR=1
OPTIND=1
OSTYPE=linux-android
PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
PIPESTATUS=0
PPID=749
PREFIX=/data/data/com.termux/files/usr
PS4=+ 
PWD=/data/data/com.termux/files/home
PYTHONPYCACHEPREFIX=/data/data/com.termux/files/home/.cache/Python
RANDOM=9017
REMOVE_PREVIOUS_SUDO_TEMP_FILES=0
SECONDS=0
SETUP_SUDO_TEMP_DIRECTORY=0
SHELL=/data/data/com.termux/files/usr/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=3
SRANDOM=4062387700
SSH_AUTH_SOCK=/data/data/com.termux/files/usr/var/run/ssh-agent.socket
SUDO_EDITOR=micro
SUDO_LOG_LEVEL=5
SUDO_POST_SHELL_HISTFILE=
SUDO_SCRIPT_PATH=/data/data/com.termux/files/usr/bin/sudo
SUDO_SHELL_HISTFILE=/data/data/com.termux/files/home/.suroot/.bash_history
SUDO_SHELL_HISTFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_HOME_PARENT_DIR=/data/data/com.termux/files/home
SUDO_SHELL_RCFILE=/data/data/com.termux/files/home/.suroot/.bashrc
SUDO_SHELL_RCFILE_PARENT_DIR=/data/data/com.termux/files/home/.suroot
SUDO_SHELL_RCFILE_VALUE=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


SUDO_SHELL_WORKING_DIR=
SUDO_TEMP_DIRECTORY_PARENT_DIRECTORY=/data/data/com.termux/files/home/.suroot
SUDO_TEMP_DIRECTORY_PREFIX=.sudo.temp
SUDO__VERSION=1.2.0
TERM=xterm-256color
TERMUX_API_VERSION=0.53.0
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c235,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_HOME=/data/data/com.termux/files/home
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.3
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TMPDIR=/data/data/com.termux/files/usr/tmp
TZ=Asia/Jakarta
UID=0
USER=ceka
VISUAL=micro
_=v
blacklisted_path_in_termux_rootfs_regex=^(([\/]+data[\/]+data[\/]+com\.termux[\/]+files[\/]+home[\/]+\.(cache|config|local|termux))|()|([\/]+.*))([\/]+)?$
create_shell_home_if_it_does_not_exist=1
label=SUDO_SHELL_HOME
only_set_perms_and_ownership_on_creation_of_shell_home=1
path=/data/data/com.termux/files/home/.suroot
shell_automatically_create_history_file=
shell_automatically_create_rc_file=
shell_histfile=/data/data/com.termux/files/home/.suroot/.bash_history
shell_histfile_parent_dir=/data/data/com.termux/files/home/.suroot
shell_home=/data/data/com.termux/files/home/.suroot
shell_home_file_type_tests=rwx
shell_home_parent_dir=/data/data/com.termux/files/home
shell_home_permission=700
shell_label=SUDO_SHELL
shell_rcfile=/data/data/com.termux/files/home/.suroot/.bashrc
shell_rcfile_parent_dir=/data/data/com.termux/files/home/.suroot
shell_rcfile_value=
tpath() {
    export PATH="$SUDO__TERMUX_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__TERMUX_PRIORITY_LD_LIBRARY_PATH";
    export LD_PRELOAD="$SUDO__TERMUX_LD_PRELOAD";
}


apath() {
    export PATH="$SUDO__ANDROID_PRIORITY_PATH";
    export LD_LIBRARY_PATH="$SUDO__ANDROID_PRIORITY_LD_LIBRARY_PATH";
    unset LD_PRELOAD;
}


termux_home_escaped=[\/]+data[\/]+data[\/]+com\.termux[\/]+files[\/]+home
termux_prefix_escaped=
termux_rootfs_escaped=
valid_path_under_termux_rootfs_regex=^[\/]+.+
SUDO_SHELL_HOME '/data/data/com.termux/files/home/.suroot' matches one of following blacklisted paths:
'/data/data/com.termux/files/home/.{cache,config,local,termux}', '/*'
The '/data/data/com.termux/files/home/.suroot' cannot be used as SUDO_SHELL_HOME
Failed to setup SUDO_SHELL_HOME

Running sudo_remount_partitions_for_sudo_shell_homes

Idk if it's intended, export var on somelines written as export "${var}" instead of just var?

ddCeka avatar Oct 17 '25 09:10 ddCeka

Hello Apollo, I managed to make it work rn, you can close this issue.

The fix is actually there is some problem with exactly magisk v23.0 I've tried with lower version and higher version it worked ootb, rn I switched to v26.4 and still worked. Thanks

ddCeka avatar Nov 06 '25 08:11 ddCeka

Thanks for the logs earlier, sorry been really busy to reply, as per the logs the env was being exported properly by sudo and something was getting messed up in magisk su. Thanks for the version confirmation, which helped me find the fix that was done in magisk posted below. Env was lost if its length was greater than 4096 for magisk <= v23.

  • https://github.com/topjohnwu/Magisk/commit/b0c1a6f73a205fc31a727280550211f8ae94fbc2
  • https://github.com/topjohnwu/Magisk/commit/ef1b928532103c3c81d3d9a4151c7ea58997a7ba
  • https://github.com/topjohnwu/Magisk/commit/4e2ecdb92083e862a723e73c240879aec64ca070
  • https://github.com/topjohnwu/Magisk/issues/5989

Idk if it's intended, export var on somelines written as export "${var}" instead of just var?

That's expected. In shell ${var} and $var are same, ${var} is often used in concatenating variables, like ${FOO}bar would expand the variable $FOO and then append bar string to it, whereas $FOObar will expand the variable named FOObar, which likely would be not be set. ${!var} expands the variable whose name is set in the variable $var.

There are other usages of brace notation too.

  • https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion-1

agnostic-apollo avatar Nov 07 '25 17:11 agnostic-apollo

Reopening as this should be caught earlier and sudo aborted as dangerous commands could be run as root with unset variables before the above error occurs, potentially damaging the device.

agnostic-apollo avatar Nov 07 '25 17:11 agnostic-apollo