[英]rooted android read only file system error
I'm trying to modify /etc/hosts/
file and for that I make a separate file in external storage and then cp
it to the location. 我正在尝试修改
/etc/hosts/
文件,为此,我在外部存储中创建了一个单独的文件,然后将其cp
到该位置。 I'm getting these error messages: 我收到以下错误消息:
01-14 18:51:51.069: E/HostsActivity(5356): rm failed for /etc/hosts, Read-only file system
01-14 18:51:51.079: E/HostsActivity(5356): failed on '/mnt/sdcard/hosts' - Cross-device link
What do I do? 我该怎么办?
I'm using RootTools . 我正在使用RootTools 。
My code: 我的代码:
try {
String fn = write_file("hosts", hostsData);
RootTools.getShell(true).add(new Command(0, "rm /etc/hosts", "mv " + fn + " /etc/hosts")
{
@Override
public void output(int arg0, String arg1) {
// TODO Auto-generated method stub
Log.e("HostsActivity", arg1);
}
}).waitForFinish();
tv_status.setText("Done");
} catch (Exception ioe) {
Log.e("HostsActivity", ioe.toString());
tv_status.setText(ioe.toString());
}
I have asked for root permissions in the beginning of the activity in the onCreate
我已经在
onCreate
活动开始时要求了root权限
if (!RootTools.isAccessGiven()) {
TextView tv = new TextView(this);
tv.setText("Root access not given. Please ensure root access.");
setContentView(tv);
}
setContentView(R.layout.activity_hosts);
You need to remount /etc by default it is Read-only file system. 默认情况下,您需要重新挂载/ etc,它是只读文件系统。
Than you need to check permissions on the /etc/hosts and maybe you need to correct file permissions using chmod command. 比您需要检查/ etc / hosts上的权限,也许您需要使用chmod命令更正文件权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.