init: cannot setexeccon('u:r:logd:s0'): Invalid argument

android 8.0添加新的sepolicy权限后,烧boot.img,system.img到手机里面,发现服务无法起来:

init: cannot setexeccon('u:r:logd:s0'): Invalid argument

service logcatserive /system/bin/logcat -v threadtime  -b radio -r 1024 - -n 10 -f /data/logcat-radio-log
    class late_start
    user root
    group system
    disabled
    seclabel u:r:logcat:s0

一般这样的报错有两种原因:
1、要seclable的文件不存在,例如上面的service,/system/bin/logcat不存在,就要查看手机里面改文件是否存在,对应的权限是否正确;

2、Android 8.0上面,Sepolicy权限发生了变化, device/XXX/YYY/sepolicy 存储在vendor.img中,假设修改的权限再该目录中,就要同时刷入vendor.img到手机中,
否则会报该错误,cannot setexeccon;


Android 8.0权限相关资料:

Policy placement
In Android 7.0, partners could add policy to BOARD_SEPOLICY_DIRS, including policy meant
to augment AOSP policy across different device types. In Android 8.0, adding a policy to
BOARD_SEPOLICY_DIRS places the policy only in the vendor image.
In Android 8.0 AOSP, policy exists in the following locations:

● system/sepolicy/public. Includes policy exported for use in vendor-specific policy.
Everything goes into the Android 8.0 compatibility infrastructure, and vendors include
it as part of their policy so it can be relied upon (leading to restrictions on the type of
policy that can be placed here). Consider this the platform’s exported policy API:
Anything that deals with the interface between /system and /vendor should be here.

● system/sepolicy/private. Includes policy necessary for the functioning of the system

image, but of which vendor image policy should have no knowledge.

● system/sepolicy/vendor. Includes policy for components that go in /vendor but exist
in the core platform tree (not device-specific directories). This is an artifact of build
system’s distinction between devices and global components; conceptually this is a
part of the device-specific policy described below.

● device/XXX/YYY/sepolicy. Includes device-specific policy. Also includes device
customizations to policy, which in Android 8.0 now corresponds to policy for
components on the vendor image

你可能感兴趣的:(linux,android,sepolicy)