meta-selinux/recipes-core
João Marcos Costa 91bf293772 initscripts: fix incompatibility with read-only-rootfs
When the read-only-rootfs feature (in IMAGE_FEATURES) is enabled, the
populate-volatile.sh script runs at build time. This compensates for the
fact that certain essential directories and files cannot be created at
runtime, since the root filesystem is read-only. This is handled in
oe-core's rootfs-postcommands.bbclass, in read_only_rootfs_hook.

However, initscripts-1.0_selinux.inc appends some shell code to
populate-volatile.sh considering it will be run in the target, not on
the host machine. So, if one uses both read-only-rootfs and selinux (in
DISTRO_FEATURES), the recursive call to restorecon is run in the host
machine, since populate-volatile.sh is called in build time. This leads
to errors such as:

| NOTE: Executing read_only_rootfs_hook ...
| DEBUG: Executing shell function read_only_rootfs_hook
| /sbin/restorecon: Could not read /var/lib/AccountsService/users: Permission denied.
| /sbin/restorecon: Could not read /var/lib/NetworkManager: Permission denied.
| /sbin/restorecon: Could not read /var/lib/bluetooth: Permission denied.
| /sbin/restorecon: Could not read /var/lib/chrony: Permission denied.

As a matter of fact, this scenario is a fair reminder not to call
bitbake with sudo.

This change makes sure the append is only performed if the
read-only-rootfs feature is not used.

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2025-10-08 18:52:07 +08:00
..
base-files base-files: set correct label for /var/volatile 2022-11-07 14:19:08 -05:00
busybox Add SELinux specific configuration snippet for busybox. 2024-08-26 08:15:57 -04:00
coreutils coreutils/findutils/tar: remove pkgconfig from bbappend 2021-09-29 22:29:59 -04:00
dbus classes: drop redundant classes 2021-08-29 21:34:22 -04:00
eudev eudev: remove PACKAGECONFIG[selinux] 2024-02-27 12:30:20 -05:00
glib-2.0 classes: drop redundant classes 2021-08-29 21:34:22 -04:00
initscripts initscripts: fix incompatibility with read-only-rootfs 2025-10-08 18:52:07 +08:00
systemd classes: drop redundant classes 2021-08-29 21:34:22 -04:00
sysvinit sysvinit: sync bbappend to 3.0 2021-11-22 12:23:16 -05:00
util-linux util-linux: move PACKAGECONFIG to oe-core 2022-12-14 20:31:45 -05:00