Apparently not
When did it stop working? Did you try wired and wireless?
Try lowering the video resolution in android auto developer setting
So look again until you see the error number
what issues ?
Where can i get this custom rom for f21 pro?
Top of this thread is the link
Does anyone know how I can flash this ROM onto a device with 1.1.1 and not have the encryption error that requires a factory reset?
Whatβs the difference your going to wipe the userdata anyway ?
The whole point is I want to keep userdata
I was never successful in doing that maybe @ars18 can help ?
Not something Iβm remotely interested in
On this ROM, Root shell is not working it says Permission denied. How do I fix that
Allow in maigsk - superuser - termux (/or your terminal).
How can I bake it into the ROM so itβs a system change even on factory reset?
Boot script that adds it to magisk.db
I tried doing it but its not working. Can you tell me exactly what to do?
This is what I did in the sh script:
mkdir -p /data/adb/magisk 2>/dev/null
{
echo "ZYGISK=1"
echo "DENYLIST=1"
echo "SU_AUTO_RESPONSE=2" # 2=allow new su requests without prompt
echo "SU_DEFAULT_TIMEOUT=10"
echo "ROOT_ACCESS=3" # 3 = apps + adb
echo "SU_MNT_NS=2" # isolate (default)
} > /data/adb/magisk/config 2>>"$LOG"
log "magisk config written: ZYGISK=1, DENYLIST=1, SU_AUTO_RESPONSE=2, ROOT_ACCESS=3"
magisk --denylist enable >> "$LOG" 2>&1 \
&& log "magisk: denylist enforcement enabled" \
|| log "WARN: magisk --denylist enable failed (rc=$?)"
#!/system/bin/sh
# ---------------------------- Configuration ----------------------------
if [ ! -f /data/adb/.first_boot_done ]; then exit 0; fi
LOG_FILE_CACHE="/cache/magisk_init.log" # Accessible via ADB
# Log level: DEBUG, INFO, WARN, ERROR
LOG_LEVEL="DEBUG"
MAGISK_DB_PATHS=(
"/data/adb/magisk.db"
)
# Packages to grant SU permissions to
APP_PACKAGES=(
"shell"
"com.aurora.store"
# whatever other packages you want to grant su permissions to, e.g. "com.example.app"
)
# Maximum wait time (in seconds) for magisk.db to become available
MAX_WAIT=60
# Interval between checks (in seconds)
WAIT_INTERVAL=5
# Path to sqlite3 binary
SQLITE_PATH="/system/bin/sqlite3"
# Maximum number of retry attempts for each insert
MAX_RETRIES=3
# Interval between retries (in seconds)
RETRY_INTERVAL=2
# Constants for launching app
APP_LAUNCH_TIMEOUT=300 # Total time to try launching the app (in seconds)
APP_LAUNCH_INTERVAL=5 # Interval between launch attempts (in seconds)
TARGET_PACKAGE="com.example.kosherpilot" # The app to launch and monitor
# ---------------------------- Logging Functions ----------------------------
# Function to log messages to both /sdcard and /cache
Log() {
local LEVEL="$1"
local MSG="$2"
local TIMESTAMP
TIMESTAMP="$(date "+%Y-%m-%d %H:%M:%S")"
local LOG_ENTRY="$TIMESTAMP [$LEVEL] grant_su.sh: $MSG"
# Log to cache
echo "$LOG_ENTRY" >> "$LOG_FILE_CACHE"
}
# Function to check if a log level should be logged
ShouldLog() {
local LEVEL="$1"
case "$LOG_LEVEL" in
DEBUG)
return 0
;;
INFO)
[ "$LEVEL" != "DEBUG" ] && return 0 || return 1
;;
WARN)
[ "$LEVEL" = "WARN" ] || [ "$LEVEL" = "ERROR" ] && return 0 || return 1
;;
ERROR)
[ "$LEVEL" = "ERROR" ] && return 0 || return 1
;;
*)
return 1
;;
esac
}
LogDebug() {
ShouldLog "DEBUG" && Log "DEBUG" "$1"
}
LogInfo() {
ShouldLog "INFO" && Log "INFO" "$1"
}
LogWarn() {
ShouldLog "WARN" && Log "WARN" "$1"
}
LogError() {
ShouldLog "ERROR" && Log "ERROR" "$1"
}
# ---------------------------- Main Script ----------------------------
LogInfo "Script started."
[ -f /data/adb/.first_boot_done ] || { LogInfo "Skipping: first-boot flag not present."; exit 0; }
# Function to check if the script is running as root
check_root() {
if [ "$(id -u)" -ne 0 ]; then
LogError "Script is not running as root. Exiting."
exit 1
else
LogDebug "Script is running as root."
fi
}
# Execute root check
check_root
# Function to find the Magisk database path
find_magisk_db() {
for path in "${MAGISK_DB_PATHS[@]}"; do
if [ -f "$path" ]; then
MAGISK_DB="$path"
LogInfo "Found Magisk database at ${MAGISK_DB}."
return 0
else
LogDebug "Magisk database not found at ${path}."
fi
done
MAGISK_DB=""
return 1
}
# Function to wait for magisk.db to become available
wait_for_magisk_db() {
local waited=0
while [ $waited -lt $MAX_WAIT ]; do
if find_magisk_db; then
return 0
fi
LogInfo "magisk.db not found. Waiting for ${WAIT_INTERVAL} seconds..."
sleep $WAIT_INTERVAL
waited=$((waited + WAIT_INTERVAL))
done
return 1
}
# Function to check if the 'policies' table exists
check_policies_table() {
if [ -z "$MAGISK_DB" ]; then
LogError "Magisk database path not set."
return 1
fi
TABLES="$("$SQLITE_PATH" "$MAGISK_DB" ".tables")"
LogDebug "Tables in ${MAGISK_DB}: ${TABLES}"
if echo "$TABLES" | grep -qw "policies"; then
LogInfo "'policies' table found in Magisk database."
return 0
else
LogWarn "'policies' table not found in Magisk database."
LogInfo "Available tables in Magisk database: ${TABLES}"
return 1
fi
}
# Function to grant SU permissions with retries
grant_su_permissions() {
for APP_PACKAGE in "${APP_PACKAGES[@]}"; do
LogInfo "Processing app package: ${APP_PACKAGE}"
# Get UID for the package
if [ "$APP_PACKAGE" = "shell" ]; then
# For shell, UID is 2000
APP_UID=2000
LogDebug "UID for 'shell' is ${APP_UID}"
else
APP_UID=$(dumpsys package "$APP_PACKAGE" | grep -E "userId=|userId:" | head -n 1 | awk -F'=' '{print $2}' | awk '{print $1}')
if [ -z "$APP_UID" ]; then
LogError "Could not find UID for package ${APP_PACKAGE}."
continue
else
LogDebug "UID for package ${APP_PACKAGE} is ${APP_UID}"
fi
fi
# Construct SQL command
SQL_CMD="INSERT OR REPLACE INTO policies (uid,policy,until,logging,notification) VALUES(${APP_UID},2,0,1,1);"
LogDebug "Constructed SQL command: ${SQL_CMD}"
# Attempt the SQL command with retries
for attempt in $(seq 1 $MAX_RETRIES); do
LogDebug "Attempt ${attempt} to grant SU to ${APP_PACKAGE}"
SQL_OUTPUT="$("$SQLITE_PATH" "$MAGISK_DB" "${SQL_CMD}" 2>&1)"
SQL_EXIT_CODE=$?
if [ $SQL_EXIT_CODE -eq 0 ]; then
LogInfo "Successfully granted SU to ${APP_PACKAGE} on attempt ${attempt}."
break
else
LogError "Attempt ${attempt}: Failed to grant SU to ${APP_PACKAGE}. SQLite error: ${SQL_OUTPUT}"
sleep $RETRY_INTERVAL
fi
done
# Final check after retries
if [ $SQL_EXIT_CODE -ne 0 ]; then
LogError "Failed to grant SU to ${APP_PACKAGE} after ${MAX_RETRIES} attempts."
fi
done
}
# Check if sqlite3 exists
if [ ! -x "$SQLITE_PATH" ]; then
LogError "sqlite3 not found at ${SQLITE_PATH}."
exit 1
else
LogDebug "Found sqlite3 at ${SQLITE_PATH}."
fi
# Wait for magisk.db to become available
if wait_for_magisk_db; then
LogInfo "Magisk database is available at ${MAGISK_DB}."
else
LogError "Timeout waiting for magisk.db."
reboot
exit 1
fi
# Check for 'policies' table
if check_policies_table; then
LogInfo "Proceeding to grant SU permissions."
else
LogError "'policies' table not found in Magisk database. Cannot proceed."
exit 1
fi
# Grant SU permissions
grant_su_permissions
LogInfo "SU permissions granting process completed."
exit 0
You need sqlite3, attached here, (extract and) put in /system/bin
sqlite3.zip (1.4 MB)
Thanks - I bundled sqlite3 into /system/bin/ and
adapted the script. It DOES write to /data/adb/magisk.db successfully but the daemon ignores the policy and still denies `su for shell.
POLICIES TABLE (SELECT 'policies:', uid, policy FROM policies)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
policies:|10048|2
policies:|10145|2
policies:|10047|1
policies:|2000|2
SETTINGS TABLE (SELECT 'settings:', key, value FROM settings)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
settings:|zygisk|1
settings:|denylist|1
settings:|bootloop|0
settings:|su_notification|0
- policies:|2000|2 = shell (uid 2000) is set to policy 2 (allow), forever
When I run adb shell "su -c 'whoami'" it comes up with a prompt on my phone asking if I want to grant it or not
Check what it logs
Try magisk --sqlite instead
Also, on factory reset, other apps (not 2000 or 1000) will have a new uid. Youβd have to restore the app completely in first boot from a working install.
Rather find the package name, and have the script inject the uid needed before running sqlite.
Maybe Iβm just making this more complicated than it actually is? ![]()
The script checks for UID