Message ID | SN4P221MB0682E582104B524681EBE0C9A0729@SN4P221MB0682.NAMP221.PROD.OUTLOOK.COM |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] package/skeleton-init-systemd: copy over etc-factory content | expand |
James, All, On 2023-05-05 00:30 -0400, James Knight spake thusly: > The systemd package will prepare the folder `/usr/share/factory/etc/`, > which holds a series of default configuration files for a runtime > state [1]. For example, the etc-factory repository holds the default > template for `/etc/pam.d/system-auth` which is required in a default > environment configured to use systemd with SELinux. Without this file > prepared, login attempts will fail with the message: > > ... buildroot login[242]: PAM _pam_load_conf_file: unable to open config for system-auth > ... > > To avoid this, when preparing the initial skeleton structure for systemd > environments, copy over fallback configurations defined in etc-factory > into the target's `etc` folder. If a file is already prepared at this > state, these template files will be ignored. Why is that not listed in the systemd tmpfiles, so that it is installed when running systemd-tmpfiles, either at runtime by systemd on a r/w filesystem, or at buildtime with BR2_INIT_SYSTEMD_POPULATE_TMPFILES ? Also, none of our runtime tests for systemd exhibits this login issue: support/testing/tests/init/test_systemd.py support/testing/tests/init/test_systemd_selinux.py Could you try to add a bit more explanations and context, please? Regards, Yann E. MORIN. > [1]: https://www.freedesktop.org/software/systemd/man/file-hierarchy.html > > Signed-off-by: James Knight <james.d.knight@live.com> > --- > package/skeleton-init-systemd/skeleton-init-systemd.mk | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk > index fb15552f99eafcc90bc5fa9dfcee3ad465492b81..4076821c0c0429cf90681f4b16be114c44bde282 100644 > --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk > +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk > @@ -68,6 +68,13 @@ SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFI > endif # BR2_INIT_SYSTEMD_POPULATE_TMPFILES > > define SKELETON_INIT_SYSTEMD_INSTALL_TARGET_CMDS > + if [ -d $(TARGET_DIR)/usr/share/factory/etc ]; then \ > + rsync -av --ignore-existing --remove-source-files \ > + $(TARGET_DIR)/usr/share/factory/etc/ $(TARGET_DIR)/etc/; \ > + rm -rf $(TARGET_DIR)/usr/share/factory/etc/; \ > + rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/factory; \ > + fi > + > mkdir -p $(TARGET_DIR)/home > mkdir -p $(TARGET_DIR)/srv > mkdir -p $(TARGET_DIR)/var > -- > 2.40.1.windows.1 > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot
diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk index fb15552f99eafcc90bc5fa9dfcee3ad465492b81..4076821c0c0429cf90681f4b16be114c44bde282 100644 --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk @@ -68,6 +68,13 @@ SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFI endif # BR2_INIT_SYSTEMD_POPULATE_TMPFILES define SKELETON_INIT_SYSTEMD_INSTALL_TARGET_CMDS + if [ -d $(TARGET_DIR)/usr/share/factory/etc ]; then \ + rsync -av --ignore-existing --remove-source-files \ + $(TARGET_DIR)/usr/share/factory/etc/ $(TARGET_DIR)/etc/; \ + rm -rf $(TARGET_DIR)/usr/share/factory/etc/; \ + rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/factory; \ + fi + mkdir -p $(TARGET_DIR)/home mkdir -p $(TARGET_DIR)/srv mkdir -p $(TARGET_DIR)/var
The systemd package will prepare the folder `/usr/share/factory/etc/`, which holds a series of default configuration files for a runtime state [1]. For example, the etc-factory repository holds the default template for `/etc/pam.d/system-auth` which is required in a default environment configured to use systemd with SELinux. Without this file prepared, login attempts will fail with the message: ... buildroot login[242]: PAM _pam_load_conf_file: unable to open config for system-auth ... To avoid this, when preparing the initial skeleton structure for systemd environments, copy over fallback configurations defined in etc-factory into the target's `etc` folder. If a file is already prepared at this state, these template files will be ignored. [1]: https://www.freedesktop.org/software/systemd/man/file-hierarchy.html Signed-off-by: James Knight <james.d.knight@live.com> --- package/skeleton-init-systemd/skeleton-init-systemd.mk | 7 +++++++ 1 file changed, 7 insertions(+)