has incorrect label or no domain transition from u:r:init:s0 to another SELinux domain defined.

遇到问题

在Android项目上,写了一个bash脚本,内置在/vendor/bin,在init.rc配置了service catlog_sh,

# add cat log
service catlog_sh /vendor/bin/cat_log.sh
    class main
    user root
    group root system
    disabled
    oneshot

使用ctl.start catlog_sh提示执行失败:

evt:/ # setprop ctl.start catlog_sh
Failed to set property 'ctl.start' to 'catlog_sh'.
See dmesg for error reason.

dmesg查看日志:

init: Control message: Could not ctl.start for 'catlog_sh' from pid: 2933 (setprop ctl.start catlog_sh): File /vendor/bin/sh(labeled "u:object_r:vendor_shell_exec:s0") has incorrect label or no domain transition from u:r:init:s0 to another SELinux domain defined. 

解决方案

init.rc service 无法启动_has incorrect label or no domain transition from u-CSDN博客

文章里面说是需要定义domain,我已经定义过了:

cat_log.te

type cat_log, domain;
type cat_log_exec, exec_type, vendor_file_type, file_type;

init_daemon_domain(cat_log)

经过排查发现是shell定义问题

#!/system/bin/sh       //原先的,导致domain异常

#!/bin/sh              //调整后,自动适配域,解决问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值