Android 11 无法remount问题

本文针对Android11开发中遇到的remount失败问题进行了深入分析,并提供了详细的解决方案,包括如何禁用DM-Verity以允许系统分区的读写操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述: 在Android 11开发的时候,想快速调试把单独编译好的模块push 到 /system 目录下,结果发现remount failed

C:>adb root
restarting adbd as root

C:>adb remount
Skipping /system for remount
Skipping /vendor for remount
Skipping /product for remount
No partitions to remount
remount failed

强行push 也是显示错误

 Z:framework> adb push .\framework.jar /system/
adb: error: failed to copy '.\framework.jar' to '/system/framework.jar': 
remote couldn't create file: Read-only file system
.\framework.jar: 1 file pushed, 0 skipped. 43.0 MB/s (29967488 bytes in 0.665s)

remote couldn't create file: Read-only file system


MTK解释: 原因是android P版本后google启用avb(Android Verified Boot)2.0,verified boot and DM-verity默认启用策略发生了变化。
DM-Verity behavior changes from vboot1.0 to avb2.0.
On vboot1.0, dm-verity is turned off on eng build and is enabled on userdebug/user build.
DM-verity could be disabled with adb (not fastboot) on userdebug build without unlocking device first.
DM-Verity could not be disabled on user build.
On avb2.0, dm-verity behavior are the same on all build variants.
It’s turned on by default and could only be disabled after device is unlocked.
dm-verity disable flag is moved from system image dm-verity metadata(vboot1.0) to vbmeta image(avb2.0), and you have two ways to disable it: adb and fastboot.

解决办法:

  • Android P + kernel-4.4 or kernel-3.18
download preloader with verified boot disabled which location is the same as scatter file //preloader_<PROJECT>_SBOOT_DIS.bin
adb root
adb disable-verity
adb reboot
adb root
adb remount
  • Android P + kernel-4.9 or after
1. download preloader with verified boot disabled which location is the same as scatter file. //preloader_<PROJECT>_SBOOT_DIS.bin
2.boot to Home Screen
3.go to setting -> system -> Developer options -> OEM unlocking
4.adb reboot bootloader
5.fastboot flashing unlock
6.press volume up key
7.fastboot reboot
8.adb root
9.adb disable-verity
10.adb reboot
11.adb root
12.adb remount

注意事项:

  1. 第一步需要先确认out目录有没有编译出preloader_<PROJECT>_SBOOT_DIS.bin 这个文件,是和下载时选择的Android_scatter.txt同级目录
    如果没有这个文件,那么需要先在系统里找到对应BoardConfig.mk

    	ifneq ($(wildcard vendor/mediatek/internal/sboot_disable),)
    	BOARD_BUILD_SBOOT_DIS:=yes
    	else
    	BOARD_BUILD_SBOOT_DIS:=no  // 把这个no 改为yes
    	endif
    

    把这个no 改为yes, 然后重编烧录开机,之后再进行后面的步骤。

  2. 第三步是要在开发者模式里找到OEM unlocking 并打开
    在这里插入图片描述

  3. 成功之后remount 是这样

    	Z:> adb remount
    	Using overlayfs for /system
    	Using overlayfs for /vendor
    	Using overlayfs for /product
    	Now reboot your device for settings to take effect
    	remount succeeded
    

总结: android 真的好难呀!

### Anaconda 安装教程 #### 一、安装 Anaconda 并配置环境变量 为了确保 Anaconda 正常工作,在安装过程中需要注意勾选添加路径选项,这一步骤对于后续命令行工具的正常使用至关重要[^3]。 ```bash # 如果在安装时未选择添加路径,则可以通过手动设置环境变量来解决 export PATH="/path/to/anaconda/bin:$PATH" ``` #### 二、验证安装是否成功 完成安装后,可通过启动 Anaconda Navigator 或者在命令提示符中运行 `conda --version` 来确认安装情况。如果显示 Conda 的版本号则表示安装无误。 ```bash conda --version ``` ### 使用清华大学镜像加速软件包下载 #### 三、配置 Conda 使用清华大学镜像源 由于官方仓库可能速度较慢,建议修改默认的 Conda 源为清华大学开源软件镜像站提供的国内镜像地址,从而提高依赖项获取效率[^1]。 ```bash # 添加清华镜像作为优先级最高的渠道 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ # 显示完整的 URL 地址以便于调试 conda config --set show_channel_urls yes ``` #### 四、创建并激活 TensorFlow 所需虚拟环境 考虑到不同 Python 版本之间的兼容性差异,推荐专门为 TensorFlow 创建独立的工作空间,并指定合适的 Python 解释器版本[^2]。 ```bash # 基于特定Python版本建立新的Conda环境 conda create -n tensorflow python=3.6 anaconda # 切换至刚创建好的环境中去 conda activate tensorflow ``` #### 五、利用 Pip 和 Conda 结合方式高效部署 TensorFlow 及其他库 除了通过 Conda 管理基础设施外,还可以借助 PyPI 上丰富的第三方扩展资源进一步完善开发平台建设;同样地,这里也提倡采用本地化存储节点以加快网络传输速率[^4]。 ```bash # 运用Pip配合清华简易索引服务器快速加载目标模块 pip install tensorflow-gpu==2.x.y -i https://pypi.tuna.tsinghua.edu.cn/simple ```
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值