Kri*_*ael 16 android selinux android-virtual-device
当目标平台为Level 26(Android 8.0.0)或更高版本时,我的android模拟器无法启动.模拟器只显示黑屏,而模拟器进程持续运行大约.100%CPU.请注意,25级和更低级别工作正常.
这是我到目前为止发现的:
我从命令行启动了模拟器,以便我可以检查logcat:
./emulator -avd Test2 -logcat '*:e'
Run Code Online (Sandbox Code Playgroud)
这是logcat的摘录:
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.18.91+ (android-build@wphr1.hot.corp.google.com) (gcc version 4.9 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Jan 9 20:30:51 UTC 2018
[ 0.000000] Command line: qemu=1 androidboot.hardware=ranchu clocksource=pit androidboot.console=ttyS0 android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=1 androidboot.logcat=*:e androidboot.selinux=permissive ndns=2 ndns=2
[ 0.000000] Disabled fast string operations
...
(skipping a few hundred lines)
...
[ 1.443608] init: init first stage started!
[ 1.443608] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 1.443608] init: First stage mount skipped (missing/incompatible fstab in device tree)
[ 1.453842] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[ 1.453842] init: Loading SELinux policy
[ 1.453842] selinux: SELinux: Could not open /sepolicy: No such file or directory
[ 1.453842]
[ 1.463161] init: Failed to load monolithic SELinux policy: No such file or directory
[ 1.463161] init: panic: rebooting to bootloader
[ 1.463161] init: Reboot start, reason: reboot, rebootTarget: bootloader
[ 1.472277] init: android::WriteStringToFile open failed: No such file or directory
[ 1.472277] init: Shutdown timeout: 6
[ 1.472277] init: terminating init services
[ 1.472277] init: waitpid failed: No child processes
[ 1.482231] init: Terminating running services took 0.013438 seconds with remaining services:0
[ 1.482231] init: waitpid failed: No child processes
[ 1.482231] init: vold not running, skipping vold shutdown
[ 1.607664] init: powerctl_shutdown_time_ms:128:0
[ 1.607664] init: Reboot ending, jumping to kernel
[ 1.607664] reboot: Restarting system with command 'bootloader'
[ 1.607664] reboot: machine restart
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.18.91+ (android-build@wphr1.hot.corp.google.com) (gcc version 4.9 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Jan 9 20:30:51 UTC 2018
[ 0.000000] Command line: qemu=1 androidboot.hardware=ranchu clocksource=pit androidboot.console=ttyS0 android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=1 androidboot.logcat=*:e androidboot.selinux=permissive ndns=2 ndns=2
[ 0.000000] Disabled fast string operations
...
Run Code Online (Sandbox Code Playgroud)
这每5秒无限重复一次.所以我怀疑我的问题与SELinux有关.这是有道理的,因为Android 8在该领域引入了许多变化:https://source.android.com/security/selinux/
但我不知道为什么其他人没有这个问题,也不知道该怎么做.
小智 1
我发现这是主机上的 SELinux 问题。这是解决该问题的一种方法:
sudo setsebool -P selinuxuser_execheap 1
Run Code Online (Sandbox Code Playgroud)
还有更具体的方法。但是,您需要捕获异常以获得确切的命令:
通过执行以下命令暂时允许此访问:
ausearch -c 'qemu-system-x86' --raw | audit2allow -M my-qemusystemx86
semodule -X 300 -i my-qemusystemx86.pp
Run Code Online (Sandbox Code Playgroud)
当然,您可以通过在主机上暂时允许 SELinux 来进行一般测试。
完成此操作后,手机显示屏不再是黑色的。
| 归档时间: |
|
| 查看次数: |
613 次 |
| 最近记录: |