public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Badrikesh Prusty' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Badrikesh Prusty <badrikesh.prusty@siemens.com>
Subject: [PATCH] isar-installer: Mount /tmp as tmpfs for read-only boot fix
Date: Fri, 13 Jun 2025 13:23:23 -0400	[thread overview]
Message-ID: <20250613172323.14644-1-badrikesh.prusty@siemens.com> (raw)

Fix image installation when isar-image-installer rootfs is booted as read-only
by ensuring /tmp is mounted as tmpfs.
This change utilizes systemd's tmp.mount to mount /tmp as tmpfs. Since systemd
versions up to Debian Bookworm ship tmp.mount in /usr/share/systemd/, the file
must be copied to a directory where systemctl can enable it.
For systemd versions 256.x and newer, tmp.mount is shipped in the appropriate
location: /usr/lib/systemd/system/tmp.mount

Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
 .../deploy-image/deploy-image_0.1.bb              |  3 ++-
 .../systemd-tmpfs-tmp/files/postinst              | 15 +++++++++++++++
 .../systemd-tmpfs-tmp/systemd-tmpfs-tmp_0.1.bb    | 10 ++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 meta-isar/recipes-installer/systemd-tmpfs-tmp/files/postinst
 create mode 100644 meta-isar/recipes-installer/systemd-tmpfs-tmp/systemd-tmpfs-tmp_0.1.bb

diff --git a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
index 54e521b5..e67feae5 100644
--- a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
+++ b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
@@ -11,7 +11,8 @@ SRC_URI = "file://usr/bin/deploy-image-wic.sh \
            file://usr/lib/deploy-image-wic/handle-config.sh \
           "
 DEPENDS:bookworm += "bmap-tools"
-DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
+DEPENDS:append = " systemd-tmpfs-tmp"
+DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, systemd-tmpfs-tmp, xz-utils, pbzip2, zstd"
 do_install[cleandirs] = "${D}/usr/bin/ \
                          ${D}/usr/lib/deploy-image-wic \
                         "
diff --git a/meta-isar/recipes-installer/systemd-tmpfs-tmp/files/postinst b/meta-isar/recipes-installer/systemd-tmpfs-tmp/files/postinst
new file mode 100644
index 00000000..be1594e6
--- /dev/null
+++ b/meta-isar/recipes-installer/systemd-tmpfs-tmp/files/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+# Enable tmp.mount if /tmp is NOT configured in /etc/fstab
+if ! grep -q '/tmp' /etc/fstab; then
+    # Ensure tmp.mount exists in systemd path
+    if [ ! -e /usr/lib/systemd/system/tmp.mount ] && [ ! -e /etc/systemd/system/tmp.mount ]; then
+        cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
+    fi
+
+    # Enable the mount unit using deb-systemd-helper
+    deb-systemd-helper enable tmp.mount || true
+fi
+
diff --git a/meta-isar/recipes-installer/systemd-tmpfs-tmp/systemd-tmpfs-tmp_0.1.bb b/meta-isar/recipes-installer/systemd-tmpfs-tmp/systemd-tmpfs-tmp_0.1.bb
new file mode 100644
index 00000000..821cdd5f
--- /dev/null
+++ b/meta-isar/recipes-installer/systemd-tmpfs-tmp/systemd-tmpfs-tmp_0.1.bb
@@ -0,0 +1,10 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+
+SRC_URI = "file://postinst"
+
+DEBIAN_DEPENDS = "systemd"
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250613172323.14644-1-badrikesh.prusty%40siemens.com.

             reply	other threads:[~2025-06-13 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 17:23 'Badrikesh Prusty' via isar-users [this message]
2025-06-16  6:39 ` 'MOESSBAUER, Felix' via isar-users
2025-06-16 10:01   ` 'Badrikesh Prusty' via isar-users
2025-06-16 12:56     ` 'Heinisch, Alexander' via isar-users

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250613172323.14644-1-badrikesh.prusty@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=badrikesh.prusty@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox