Skip to contentSkip to conversation

Patches and bugfixes for overlayfs

PATCH In review Claudius Heine 2 participants 7 messages Mar 10, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover Patches and bugfixes for overlayfs

Hi,

I bundled my patches to overlayfs and overlayfs-etc togehter in this patchset and fixed the whitespace issues.

regards,
Claudius

--
Changes from v1:
- fixed whitespace issues: converted tabs to 4 spaces.
- changed git commit title of patch 4

Claudius Heine (4):
overlayfs-etc: add condition to package-management feature conflict
overlayfs: add systemd unit path prefix to FILES:${PN} array
files: overlayfs-etc: wrap long lines of preinit file
files: overlayfs-etc: add overlay mount options to preinit

 meta/classes/overlayfs-etc.bbclass     |  3 ++-
 meta/classes/overlayfs.bbclass         |  3 ++-
 meta/files/overlayfs-etc-preinit.sh.in | 12 ++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/4 overlayfs-etc: add condition to package-management feature conflict

The conflict with the package-managment only happens if the overlayfs-etc class overwrites /sbin/init, which is not the case when OVERLAYFS_ETC_USE_ORIG_INIT_NAME is set to 0.

---
 meta/classes/overlayfs-etc.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/overlayfs-etc.bbclass +2 -1
index 4ced07ba11..b593a4d9eb 100644
@@ -26,7 +26,8 @@
 # overlay is out of scope of this class
 
 ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "overlayfs-etc", "create_overlayfs_etc_preinit;", "", d)}'
-IMAGE_FEATURES_CONFLICTS_overlayfs-etc = "package-management"
+IMAGE_FEATURES_CONFLICTS_overlayfs-etc = " \
+    ${@ 'package-management' if bb.utils.to_boolean(d.getVar('OVERLAYFS_ETC_USE_ORIG_INIT_NAME'), True) else ''}"
 
 OVERLAYFS_ETC_MOUNT_POINT ??= ""
 OVERLAYFS_ETC_FSTYPE ??= ""
Signature · 1 line
2.35.1
#2 lore raw

PATCH v2 2/4 overlayfs: add systemd unit path prefix to FILES:${PN} array

In reply to Claudius Heine

The 'FILES:${PN}' array is missing the systemd unit dir prefix causing them to not be packaged and the build fails with the installed-vs-shipped error.

This adds the systemd_system_unitdir variable in front of every unit file added with this class.

---
 meta/classes/overlayfs.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/overlayfs.bbclass +2 -1
index 4a860f7308..25e30aee83 100644
@@ -103,7 +103,8 @@ python () {
     unitList = unitFileList(d)
     for unit in unitList:
         d.appendVar('SYSTEMD_SERVICE:' + d.getVar('PN'), ' ' + unit)
-        d.appendVar('FILES:' + d.getVar('PN'), ' ' + strForBash(unit))
+        d.appendVar('FILES:' + d.getVar('PN'), ' ' +
+        d.getVar('systemd_system_unitdir') + '/' + strForBash(unit))
 
     d.setVar('OVERLAYFS_UNIT_LIST', ' '.join([strForBash(s) for s in unitList]))
 }
Signature · 1 line
2.35.1
#3 lore raw

PATCH v2 3/4 files: overlayfs-etc: wrap long lines of preinit file

In reply to Claudius Heine

Make it easier to see what is happening by wrapping the overly long lines in the preinit file for the overlayfs-etc.

---
 meta/files/overlayfs-etc-preinit.sh.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
meta/files/overlayfs-etc-preinit.sh.in +9 -2
index 2ebb6c9224..e5f5001a05 100644
@@ -16,11 +16,18 @@ mount -t sysfs sysfs /sys
 [ -z "$CONSOLE" ] && CONSOLE="/dev/console"
 
 mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}
-if mount -n -t {OVERLAYFS_ETC_FSTYPE} -o {OVERLAYFS_ETC_MOUNT_OPTIONS} {OVERLAYFS_ETC_DEVICE} {OVERLAYFS_ETC_MOUNT_POINT}
+if mount -n -t {OVERLAYFS_ETC_FSTYPE} \
+    -o {OVERLAYFS_ETC_MOUNT_OPTIONS} \
+    {OVERLAYFS_ETC_DEVICE} {OVERLAYFS_ETC_MOUNT_POINT}
 then
     mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper
     mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work
-    mount -n -t overlay -o upperdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper,lowerdir=/etc,workdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper /etc || echo "PREINIT: Mounting etc-overlay failed!"
+    mount -n -t overlay \
+        -o upperdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper \
+        -o lowerdir=/etc \
+        -o workdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work \
+        {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper /etc || \
+            echo "PREINIT: Mounting etc-overlay failed!"
 else
     echo "PREINIT: Mounting </data> failed!"
 fi
Signature · 1 line
2.35.1
#4 lore raw

PATCH v2 4/4 files: overlayfs-etc: add overlay mount options to preinit

In reply to Claudius Heine

Overlayfs-etc is useful if the rootfs is read-only. One reason to have the rootfs read-only is to allow image based updating.

Image based updating will change the underlying root file system, which is unsupported by overlayfs when with some mount options [1].

This disables those options.

[1] https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html?highlight=overlayfs#changes-to-underlying-filesystems

---
 meta/files/overlayfs-etc-preinit.sh.in | 1 +
 1 file changed, 1 insertion(+)
meta/files/overlayfs-etc-preinit.sh.in +1 -0
index e5f5001a05..43c9b04eb9 100644
@@ -26,6 +26,7 @@ then
         -o upperdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper \
         -o lowerdir=/etc \
         -o workdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work \
+        -o index=off,xino=off,redirect_dir=off,metacopy=off \
         {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper /etc || \
             echo "PREINIT: Mounting etc-overlay failed!"
 else
Signature · 1 line
2.35.1
#5 lore raw
In reply to Claudius Heine
Quoted 19 lines · Claudius Heine

Hi,

I bundled my patches to overlayfs and overlayfs-etc togehter in this patchset and fixed the whitespace issues.

regards,
Claudius

--
Changes from v1:
- fixed whitespace issues: converted tabs to 4 spaces.
- changed git commit title of patch 4

Claudius Heine (4):
overlayfs-etc: add condition to package-management feature conflict
overlayfs: add systemd unit path prefix to FILES:${PN} array
files: overlayfs-etc: wrap long lines of preinit file
files: overlayfs-etc: add overlay mount options to preinit

Quoted 5 lines
  meta/classes/overlayfs-etc.bbclass     |  3 ++-
  meta/classes/overlayfs.bbclass         |  3 ++-
  meta/files/overlayfs-etc-preinit.sh.in | 12 ++++++++++--
  3 files changed, 14 insertions(+), 4 deletions(-)

Hi Claudius,
Thanks for the patches. It seems like the first 2 are already in master branch or I'm missing something?

Cheers,
Vyacheslav

#6 lore raw

Hi Vyacheslav,

Quoted 20 lines · Vyacheslav Yurkov
Quoted 19 lines · Claudius Heine

Hi,

I bundled my patches to overlayfs and overlayfs-etc togehter in this patchset and fixed the whitespace issues.

regards,
Claudius

Signature · 9 lines
Changes from v1:
   - fixed whitespace issues: converted tabs to 4 spaces.
   - changed git commit title of patch 4

Claudius Heine (4):
   overlayfs-etc: add condition to package-management feature conflict
   overlayfs: add systemd unit path prefix to FILES:${PN} array
   files: overlayfs-etc: wrap long lines of preinit file
   files: overlayfs-etc: add overlay mount options to preinit
Quoted 8 lines
Quoted 5 lines

  meta/classes/overlayfs-etc.bbclass     |  3 ++- meta/classes/overlayfs.bbclass         |  3 ++- meta/files/overlayfs-etc-preinit.sh.in | 12 ++++++++++--

  3 files changed, 14 insertions(+), 4 deletions(-)

Hi Claudius,
Thanks for the patches. It seems like the first 2 are already in master branch or I'm missing something?

Yes, that seems to be the case, I missed that.

There are only non-essential white space differences between those and mine, so my first two patches can be ignored.

Thanks for spotting that.

regards,
Claudius