From 2ab2d6496687ebc76a4a9cad956ff4b24df5125b Mon Sep 17 00:00:00 2001 From: Charles Short Date: Thu, 17 Feb 2022 15:09:19 +0000 Subject: [PATCH] debian: Copy /var/log directory to LVM volume. When the image boots the LVM volume is mounted via /etc/fstab. However it does not contain the log directories that services like Keystone and Apache expect to be present in order for them to start. This has a knock on affect later in bootstrap when Keystone tries to restart the service when Keystone is started and it fails to do so because /var/log/keystone is missing. Test Plan: PASS Apply patch PASS Boot image check for /var/log/keystone. Story: 2009221 Task: 43324 Signed-off-by: Charles Short Change-Id: Ib716e48fba2fcf5896ca3f06fc2bae76d24aa05f --- ...n-Copy-sysroot-var-log-to-LVM-volume.patch | 37 +++++++++++++++++++ ostree/initramfs-ostree/debian/patches/series | 1 + 2 files changed, 38 insertions(+) create mode 100644 ostree/initramfs-ostree/debian/patches/0003-debian-Copy-sysroot-var-log-to-LVM-volume.patch diff --git a/ostree/initramfs-ostree/debian/patches/0003-debian-Copy-sysroot-var-log-to-LVM-volume.patch b/ostree/initramfs-ostree/debian/patches/0003-debian-Copy-sysroot-var-log-to-LVM-volume.patch new file mode 100644 index 000000000..7b0772b61 --- /dev/null +++ b/ostree/initramfs-ostree/debian/patches/0003-debian-Copy-sysroot-var-log-to-LVM-volume.patch @@ -0,0 +1,37 @@ +From 5598e61c3471c0cf253e6d077f09ee2b1d438ea9 Mon Sep 17 00:00:00 2001 +From: Charles Short +Date: Thu, 17 Feb 2022 15:21:03 -0500 +Subject: [PATCH 3/3] debian: Copy /sysroot/var/log to LVM volume + +Sync the contents of ostree/1/var/log and the +cgts-vg/log-lv volume so services will start properly +at boot. + +Signed-off-by: Charles Short +--- + init-ostree-install.sh | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/init-ostree-install.sh b/init-ostree-install.sh +index 57e8f2d..f56b78d 100644 +--- a/init-ostree-install.sh ++++ b/init-ostree-install.sh +@@ -1468,6 +1468,15 @@ if [ -d ${PHYS_SYSROOT}/ostree/1/usr/homedirs/home ] ; then + tar --xattrs --xattrs-include='*' -xf - -C /var1/home 2> /dev/null + fi + ++if [ -b /dev/cgts-vg/log-lv ]; then ++ if [ -d ${PHYS_SYSROOT}/ostree/1/var/log/apt ] ; then ++ mnt_point=$(mktemp -d) ++ mount -t ext4 /dev/cgts-vg/log-lv ${mnt_point} || fatal "Error mounting ${mnt_point}" ++ cp -rp ${PHYS_SYSROOT}/ostree/1/var/log/* ${mnt_point} ++ umount ${mnt_point} ++ fi ++fi ++ + if [ -n "${KS}" ]; then + rootfs=`ls ${PHYS_SYSROOT}/ostree/? -d` + if [ "$INSTAB" = 1 ] ; then +-- +2.25.1 + diff --git a/ostree/initramfs-ostree/debian/patches/series b/ostree/initramfs-ostree/debian/patches/series index 591bb8f98..0abec0f88 100644 --- a/ostree/initramfs-ostree/debian/patches/series +++ b/ostree/initramfs-ostree/debian/patches/series @@ -1,2 +1,3 @@ 0001-Prevent-auto-expansion-of-fluxdata-partition.patch 0002-debian-Add-CentOS-compatible-initial-AIO-partitionin.patch +0003-debian-Copy-sysroot-var-log-to-LVM-volume.patch