summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunitexe <unitexe70@gmail.com>2026-01-13 00:56:46 -0600
committerunitexe <unitexe70@gmail.com>2026-01-13 00:56:46 -0600
commit60fe98ebdd3a3a70871db1fe47427399f785c1ec (patch)
tree98f0652fa71a5b25f62caac91686e46aba58eda4
parent1c6ea2c89f69b924e866dc901a2183068e44297f (diff)
User systemd journals working
-rw-r--r--meta-unit-core/recipes-core/packagegroups/packagegroup-unit-systemd.bb6
-rw-r--r--meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage.bb17
-rw-r--r--meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage/journald-persistent-storage.conf2
-rw-r--r--meta-unit-core/recipes-unit/images/unit-image-base.inc1
-rw-r--r--meta-unit-core/recipes-users/useradd/add-user-svc.bb13
-rw-r--r--meta-unit-core/recipes-users/useradd/add-user-unitexe.bb13
-rw-r--r--meta-unit-distro/conf/distro/include/systemd.inc4
7 files changed, 50 insertions, 6 deletions
diff --git a/meta-unit-core/recipes-core/packagegroups/packagegroup-unit-systemd.bb b/meta-unit-core/recipes-core/packagegroups/packagegroup-unit-systemd.bb
new file mode 100644
index 0000000..0641d74
--- /dev/null
+++ b/meta-unit-core/recipes-core/packagegroups/packagegroup-unit-systemd.bb
@@ -0,0 +1,6 @@
+SUMMARY = "Unit systemd packages"
+
+inherit packagegroup
+
+RDEPENDS:${PN}:append = " systemd-analyze"
+RDEPENDS:${PN}:append = " systemd-conf-journal-persistent-storage"
diff --git a/meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage.bb b/meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage.bb
new file mode 100644
index 0000000..7dcdb49
--- /dev/null
+++ b/meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Systemd journal persistent storage drop-in configuration"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${UNIT_CORE_LAYERDIR}/LICENSE;md5=38bf13be5d6979b28bd8adddb2f2f9b3"
+
+SRC_URI = "file://journald-persistent-storage.conf"
+
+RDEPENDS:${PN}:append = " systemd"
+
+S = "${UNPACKDIR}"
+
+do_install:append() {
+ install -D -m 0644 ${UNPACKDIR}/journald-persistent-storage.conf ${D}${sysconfdir}/systemd/journald.conf.d/journald-persistent-storage.conf
+}
+
+FILES:${PN} = "\
+ ${sysconfdir}/systemd/journald.conf.d/journald-persistent-storage.conf \
+"
diff --git a/meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage/journald-persistent-storage.conf b/meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage/journald-persistent-storage.conf
new file mode 100644
index 0000000..21dfde0
--- /dev/null
+++ b/meta-unit-core/recipes-core/systemd/systemd-conf-journal-persistent-storage/journald-persistent-storage.conf
@@ -0,0 +1,2 @@
+[Journal]
+Storage=persistent
diff --git a/meta-unit-core/recipes-unit/images/unit-image-base.inc b/meta-unit-core/recipes-unit/images/unit-image-base.inc
index e58ad54..23dd8c7 100644
--- a/meta-unit-core/recipes-unit/images/unit-image-base.inc
+++ b/meta-unit-core/recipes-unit/images/unit-image-base.inc
@@ -3,6 +3,7 @@ inherit image-buildinfo
IMAGE_INSTALL:append = " packagegroup-unit-networking"
IMAGE_INSTALL:append = " packagegroup-unit-system"
+IMAGE_INSTALL:append = " packagegroup-unit-systemd"
IMAGE_INSTALL:append = " packagegroup-unit-users"
IMAGE_INSTALL:append = " packagegroup-unit-utils"
diff --git a/meta-unit-core/recipes-users/useradd/add-user-svc.bb b/meta-unit-core/recipes-users/useradd/add-user-svc.bb
index b156019..3e2a8ca 100644
--- a/meta-unit-core/recipes-users/useradd/add-user-svc.bb
+++ b/meta-unit-core/recipes-users/useradd/add-user-svc.bb
@@ -6,16 +6,23 @@ EXCLUDE_FROM_WORLD = "1"
inherit useradd
inherit extrausers
-S = "${UNPACKDIR}"
-
+RDEPENDS:${PN}:append = " base-passwd"
+RDEPENDS:${PN}:append = " busybox"
RDEPENDS:${PN}:append = " shadow"
+RDEPENDS:${PN}:append = " systemd"
USERADD_PACKAGES = "${PN}"
USER_TO_ADD_NAME ?= "svc"
USER_TO_ADD_UID ?= "2000"
USER_TO_ADD_PASSWORD_HASHED ?= "\$6\$1TQs7iLskyTyCjoL\$xhngcFWaPRsoaZCwLSsYXUrRcVdR19zV2vBEzrzSEVu8zbqDlfKu4HLwzsZfiqJCiWqiu9qirD4Ym12CMf7D7."
+COMMA_SEPARATED_LIST_OF_GROUPS_TO_ADD_USER_TO ?= "systemd-journal"
-USERADD_PARAM:${PN} = "--uid ${USER_TO_ADD_UID} --home-dir /home/${USER_TO_ADD_NAME} --shell ${base_bindir}/sh --password '${USER_TO_ADD_PASSWORD_HASHED}' ${USER_TO_ADD_NAME}"
+USERADD_PARAM:${PN} = "-u ${USER_TO_ADD_UID} -d /home/${USER_TO_ADD_NAME} -s ${base_bindir}/sh -G ${COMMA_SEPARATED_LIST_OF_GROUPS_TO_ADD_USER_TO} -p '${USER_TO_ADD_PASSWORD_HASHED}' ${USER_TO_ADD_NAME}"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+# Prior to useradd being performed on the sysroot a couple things must happen:
+# 1. Need the systemd recipe to create the systemd-journal group
+# 2. Need busybox shell present
+do_prepare_recipe_sysroot[depends] += "systemd:do_populate_sysroot busybox:do_populate_sysroot"
diff --git a/meta-unit-core/recipes-users/useradd/add-user-unitexe.bb b/meta-unit-core/recipes-users/useradd/add-user-unitexe.bb
index 97f09f5..faa1d2a 100644
--- a/meta-unit-core/recipes-users/useradd/add-user-unitexe.bb
+++ b/meta-unit-core/recipes-users/useradd/add-user-unitexe.bb
@@ -6,18 +6,25 @@ EXCLUDE_FROM_WORLD = "1"
inherit useradd
inherit extrausers
-S = "${UNPACKDIR}"
-
+RDEPENDS:${PN}:append = " base-passwd"
+RDEPENDS:${PN}:append = " busybox"
RDEPENDS:${PN}:append = " sudo"
RDEPENDS:${PN}:append = " shadow"
RDEPENDS:${PN}:append = " ssh-authorized-keys"
+RDEPENDS:${PN}:append = " systemd"
USERADD_PACKAGES = "${PN}"
USER_TO_ADD_NAME ?= "unitexe"
USER_TO_ADD_UID ?= "1000"
USER_TO_ADD_PASSWORD_HASHED ?= "\$6\$esHchcEKubkj/1v7\$woeV0ChUqcC8J8lOEWB563mX4XRAvYJldGcU/I0Pzg1Nw9bBGOQoLmIsn0wU1gUzpysZr6R18xps5Cjn470Nv/"
+COMMA_SEPARATED_LIST_OF_GROUPS_TO_ADD_USER_TO ?= "systemd-journal"
-USERADD_PARAM:${PN} = "--uid ${USER_TO_ADD_UID} --home-dir /home/${USER_TO_ADD_NAME} --shell ${base_bindir}/sh --password '${USER_TO_ADD_PASSWORD_HASHED}' ${USER_TO_ADD_NAME}"
+USERADD_PARAM:${PN} = "-u ${USER_TO_ADD_UID} -d /home/${USER_TO_ADD_NAME} -s ${base_bindir}/sh -G ${COMMA_SEPARATED_LIST_OF_GROUPS_TO_ADD_USER_TO} -p '${USER_TO_ADD_PASSWORD_HASHED}' ${USER_TO_ADD_NAME}"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+# Prior to useradd being performed on the sysroot a couple things must happen:
+# 1. Need the systemd recipe to create the systemd-journal group
+# 2. Need busybox shell present
+do_prepare_recipe_sysroot[depends] += "systemd:do_populate_sysroot busybox:do_populate_sysroot"
diff --git a/meta-unit-distro/conf/distro/include/systemd.inc b/meta-unit-distro/conf/distro/include/systemd.inc
index 116315b..bd3f03d 100644
--- a/meta-unit-distro/conf/distro/include/systemd.inc
+++ b/meta-unit-distro/conf/distro/include/systemd.inc
@@ -1 +1,5 @@
INIT_MANAGER = "systemd"
+
+# Don't symlink /var/log to /var/volatile/log
+# so persistent journal storage can be used.
+FILESYSTEM_PERMS_TABLES:remove = "files/fs-perms-volatile-log.txt"