do_mounts() { mount --bind /proc debian11/proc/ > /dev/null
mount --bind /dev debian11/dev/ > /dev/null mount --bind /dev/pts debian11/dev/pts > /dev/null
mount --bind /sys debian11/sys/ > /dev/null mount --bind /sys/fs/bpf/ debian11/sys/fs/bpf/ > /dev/null mount --bind /sys/fs/cgroup/ debian11/sys/fs/cgroup/ > /dev/null mount --bind /sys/kernel/debug/ debian11/sys/kernel/debug/ > /dev/null
mount --bind /sys/kernel/tracing/ debian11/sys/kernel/tracing/ # some devices doesn't have a /sys/kernel/debug/tracing if [ -d /sys/kernel/debug/tracing ]; then mount --bind /sys/kernel/debug/tracing/ debian11/sys/kernel/debug/tracing/ fi # Mount Android partitions if [ -d /d/ ]; then if [ ! -d debian11/d ]; then ln -s /sys/kernel/debug debian11/d; fi fi # don't mount /data to avoid data loss if [ -d /system/ ]; then mkdir -p debian11/system/ mount --bind /system debian11/system/ fi
if [ -d /vendor/ ]; then mkdir -p debian11/vendor/ mount --bind /vendor debian11/vendor/ fi
if [ -d /apex/ ]; then mkdir -p debian11/apex/ mount --bind /apex debian11/apex/ for f in /apex/*; do if [ -d $f ]; then mount --bind $f debian11/apex/$(basename $f) fi done fi
if [ -d /dev/binderfs/ ]; then mkdir -p debian11/dev/binderfs mount --bind /dev/binderfs/ debian11/dev/binderfs fi
}
mount | grep debian11 > /dev/null if [ $? -ne 0 ]; then do_mounts; fi # unset any PRELOAD in Android environment, otherwise Linux linker cann't handle it. unset LD_PRELOAD
添加bashrc
参考eadb
补充说下disable kptr一定得设置,不然会影响到ebpf的执行过程
1 2 3 4 5 6 7 8 9 10 11
# vi debian11/.bashrc 记得添加bashrc文件 export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/bcc/tools/ export TMPDIR=/tmp/ # disable kptr to lookup symbol of kernel functions psk=/proc/sys/kernel/kptr_restrict if [ -f $psk ]; then echo 0 > $psk; fi # enable tracingFs tracingFs=/sys/kernel/tracing/tracing_on if [ -f $tracingFs ]; then echo 1 > $tracingFs; fi
root@localhost:/# apt update Err:1 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] Err:2 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-updates InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] Err:3 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-backports InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] Err:5 https://security.debian.org/debian-security bullseye-security InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 151.101.2.132 443] Hit:4 http://mirrors.ustc.edu.cn/debian bullseye InRelease Reading package lists... Done Building dependency tree... Done All packages are up to date. W: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye/InRelease: No system certificates available. Try installing ca-certificates. W: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-updates/InRelease: No system certificates available. Try installing ca-certificates. W: https://security.debian.org/debian-security/dists/bullseye-security/InRelease: No system certificates available. Try installing ca-certificates. W: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-backports/InRelease: No system certificates available. Try installing ca-certificates. W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-updates/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-backports/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] W: Failed to fetch https://security.debian.org/debian-security/dists/bullseye-security/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 151.101.2.132 443] W: Some index files failed to download. They have been ignored, or old ones used instead. root@localhost:/# exit exit oriole:/data/local/tmp # sh debian.sh root@localhost:/# apt update Err:1 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] Err:2 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-updates InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] Err:3 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-backports InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] Err:4 https://security.debian.org/debian-security bullseye-security InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 151.101.2.132 443] Hit:5 http://mirrors.ustc.edu.cn/debian bullseye InRelease Reading package lists... Done Building dependency tree... Done All packages are up to date. W: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye/InRelease: No system certificates available. Try installing ca-certificates. W: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-updates/InRelease: No system certificates available. Try installing ca-certificates. W: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-backports/InRelease: No system certificates available. Try installing ca-certificates. W: https://security.debian.org/debian-security/dists/bullseye-security/InRelease: No system certificates available. Try installing ca-certificates. W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-updates/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-backports/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443] W: Failed to fetch https://security.debian.org/debian-security/dists/bullseye-security/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 151.101.2.132 443] W: Some index files failed to download. They have been ignored, or old ones used instead.
root@localhost:/# apt install ca-certificates Reading package lists... Done Building dependency tree... Done The following additional packages will be installed: openssl The following NEW packages will be installed: ca-certificates openssl 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 995 kB of archives. After this operation, 1873 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://ftp.cn.debian.org/debian bullseye/main arm64 openssl arm64 1.1.1w-0+deb11u1 [837 kB] Get:2 http://mirrors.ustc.edu.cn/debian bullseye/main arm64 ca-certificates all 20210119 [158 kB] Fetched 995 kB in 1s (940 kB/s) Preconfiguring packages ... Selecting previously unselected package openssl. (Reading database ... 9215 files and directories currently installed.) Preparing to unpack .../openssl_1.1.1w-0+deb11u1_arm64.deb ... Unpacking openssl (1.1.1w-0+deb11u1) ... Selecting previously unselected package ca-certificates. Preparing to unpack .../ca-certificates_20210119_all.deb ... Unpacking ca-certificates (20210119) ... Setting up openssl (1.1.1w-0+deb11u1) ... Setting up ca-certificates (20210119) ... Updating certificates in /etc/ssl/certs... 129 added, 0 removed; done. Processing triggers for ca-certificates (20210119) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done.