[PATCH v2 compass-ci] create-image: disable selinux

[Error] [ 5.786497] Run /sbin/init as init process SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.32: No such file or directory Signed-off-by: Wang Chenglong <18509160991@163.com> --- container/osimage/openeuler/create-image | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/container/osimage/openeuler/create-image b/container/osimage/openeuler/create-image index 631bb14..4056ff1 100755 --- a/container/osimage/openeuler/create-image +++ b/container/osimage/openeuler/create-image @@ -13,6 +13,17 @@ setup_rootfs() ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime rm -f /etc/machine-id /var/lib/dbus/machine-id systemd-machine-id-setup + + # disable selinux + echo "Disable selinux" + if [ -f /etc/selinux/config ]; then + sed -i -r 's/^.*SELINUX=enforcing/SELINUX=disabled/g' "/etc/selinux/config" + else + cat > "/etc/selinux/config" <<-EOF + SELINUX=disabled + SELINUXTYPE=targeted + EOF + fi } setup_login() { -- 2.23.0

On Wed, Jan 20, 2021 at 04:09:39PM +0800, Wang Chenglong wrote:
[Error] [ 5.786497] Run /sbin/init as init process SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.32: No such file or directory
Signed-off-by: Wang Chenglong <18509160991@163.com> --- container/osimage/openeuler/create-image | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/container/osimage/openeuler/create-image b/container/osimage/openeuler/create-image index 631bb14..4056ff1 100755 --- a/container/osimage/openeuler/create-image +++ b/container/osimage/openeuler/create-image @@ -13,6 +13,17 @@ setup_rootfs() ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime rm -f /etc/machine-id /var/lib/dbus/machine-id systemd-machine-id-setup + + # disable selinux + echo "Disable selinux" + if [ -f /etc/selinux/config ]; then + sed -i -r 's/^.*SELINUX=enforcing/SELINUX=disabled/g' "/etc/selinux/config"
There should be a ".*$" after "SELINUX=enforcing", pls check my last suggestion. If not, it will be like this: xxj@crystal ~/my/tmp% cat aa.txt # SELINUX=enforcing aaaaaa xxj@crystal ~/my/tmp% sed -i -r 's/^.*SELINUX=enforcing/SELINUX=disabled/g' aa.txt xxj@crystal ~/my/tmp% cat aa.txt SELINUX=disabled aaaaaa Thanks, Xijian

On Wed, Jan 20, 2021 at 04:22:40PM +0800, Xu Xijian wrote:
On Wed, Jan 20, 2021 at 04:09:39PM +0800, Wang Chenglong wrote:
[Error] [ 5.786497] Run /sbin/init as init process SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.32: No such file or directory
Signed-off-by: Wang Chenglong <18509160991@163.com> --- container/osimage/openeuler/create-image | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/container/osimage/openeuler/create-image b/container/osimage/openeuler/create-image index 631bb14..4056ff1 100755 --- a/container/osimage/openeuler/create-image +++ b/container/osimage/openeuler/create-image @@ -13,6 +13,17 @@ setup_rootfs() ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime rm -f /etc/machine-id /var/lib/dbus/machine-id systemd-machine-id-setup + + # disable selinux + echo "Disable selinux" + if [ -f /etc/selinux/config ]; then + sed -i -r 's/^.*SELINUX=enforcing/SELINUX=disabled/g' "/etc/selinux/config"
There should be a ".*$" after "SELINUX=enforcing", pls check my last suggestion. If not, it will be like this:
xxj@crystal ~/my/tmp% cat aa.txt # SELINUX=enforcing aaaaaa xxj@crystal ~/my/tmp% sed -i -r 's/^.*SELINUX=enforcing/SELINUX=disabled/g' aa.txt xxj@crystal ~/my/tmp% cat aa.txt SELINUX=disabled aaaaaa
Well, you thonk more fully.
Thanks, Xijian
participants (2)
-
Wang Chenglong
-
Xu Xijian