initramfs-overlay-hook: tmpFS for overlay storage
Hello all,
I have some questions regarding the use of the initramfs-overlay-hook feature in CIP Core:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb
Currently, I’m using the default behavior where the overlay’s upper directory is located on a separate, persistent /var partition. An wic example setup can be found here:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/wic/bbb-efibootguard.wks.in
At runtime, /etc/fstab includes an entry:
overlay on /etc type overlay (rw,relatime,lowerdir=/root/etc,upperdir=/root/var/local/etc,workdir=/root/var/local/.etc-atomic,uuid=on)
In this setup, the root filesystem is mounted read-only, and directories like /etc are made writable via an overlay.
This works well from a functional perspective, but due to the use of persistent storage for the upper and work directories (on /var), all runtime modifications are retained across reboots.
For example:/etc/machine-id can be modified as expected,
but also a file like /etc/systemd/system/attacker.service could be dropped during runtime by someone with physical access to the flash of the device. These files would then persist across reboots, undermining runtime integrity.
Questions:
1) Is there an existing way to configure initramfs-overlay-hook to use a volatile overlay backed by tmpFS for the upper directories?
2) If not, would it be feasible or acceptable to extend the recipe to optionally support such a mode?
3) Are there known reasons why a tmpFS for overlay storage was not implemented yet?
The goal is to ensure that the system always boots into a clean and controlled state, without retaining any changes made during runtime — for improved security and integrity.
Thank you for your time and expertise.
Best regards,
David
Hi David,
oops, I think no one replied to this question back then, right? Was the topic resolved in the meantime, or is it still open?
Quoted 34 lines · On 20.05.25 07:53, [email protected] wrote:
Hello all,
I have some questions regarding the use of the initramfs-overlay-hook feature in CIP Core:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/
recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb
<https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/
recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb>
Currently, I’m using the default behavior where the overlay’s upper directory is located on a separate, persistent /var partition. An wic example setup can be found here:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/wic/
bbb-efibootguard.wks.in <https://gitlab.com/cip-project/cip-core/isar-
cip-core/-/blob/master/wic/bbb-efibootguard.wks.in>
At runtime,/etc/fstabincludes an entry:
overlay on /etc type overlay (rw,relatime,lowerdir=/root/etc,upperdir=/ root/var/local/etc,workdir=/root/var/local/.etc-atomic,uuid=on)
In this setup, the root filesystem is mounted read-only, and directories like /etc are made writable via an overlay.
This works well from a functional perspective, but due to the use of persistent storage for the upper and work directories (on /var), all runtime modifications are retained across reboots.
For example:/etc/machine-idcan be modified as expected,
but also a file like/etc/systemd/system/attacker.servicecould be dropped during runtime by someone with physical access to the flash of the device.
These files would then persist across reboots, undermining runtime integrity.
Quoted 8 lines
Questions:
1) Is there an existing way to configure initramfs-overlay-hook to use a volatile overlay backed by tmpFS for the upper directories?
2) If not, would it be feasible or acceptable to extend the recipe to optionally support such a mode?
3) Are there known reasons why a tmpFS for overlay storage was not implemented yet?
Not sure if there is anything preventing to specify some folder on an existing tmpfs mountpoint as backing. With trixie, /tmp should be available for that, e.g.
Quoted 10 lines
The goal is to ensure that the system always boots into a clean and controlled state,
without retaining any changes made during runtime — for improved security and integrity.
Thank you for your time and expertise.
Best regards,
David
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
Quoted 49 lines · Jan Kiszka
Hi David,
oops, I think no one replied to this question back then, right? Was the topic resolved in the meantime, or is it still open?
Quoted 35 lines · On 20.05.25 07:53, [email protected] wrote:
Hello all,
I have some questions regarding the use of the initramfs-overlay-hook feature in CIP Core:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/
recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb
<https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/
recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb>Currently, I’m using the default behavior where the overlay’s upper directory is located on a separate, persistent /var partition. An wic example setup can be found here:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/wic/
bbb-efibootguard.wks.in <https://gitlab.com/cip-project/cip-core/isar-
cip-core/-/blob/master/wic/bbb-efibootguard.wks.in>At runtime,
/etc/fstabincludes an entry:overlay on /etc type overlay (rw,relatime,lowerdir=/root/etc,upperdir=/ root/var/local/etc,workdir=/root/var/local/.etc-atomic,uuid=on)
In this setup, the root filesystem is mounted read-only, and directories like /etc are made writable via an overlay.
This works well from a functional perspective, but due to the use of persistent storage for the upper and work directories (on /var), all runtime modifications are retained across reboots.
For example:/etc/machine-idcan be modified as expected,
but also a file like/etc/systemd/system/attacker.servicecould be dropped during runtime by someone with physical access to the flash of the device.
These files would then persist across reboots, undermining runtime integrity.Quoted 7 lines
Questions:
1) Is there an existing way to configure initramfs-overlay-hook to use a volatile overlay backed by tmpFS for the upper directories?
2) If not, would it be feasible or acceptable to extend the recipe to optionally support such a mode?
3) Are there known reasons why a tmpFS for overlay storage was not implemented yet?
Quoted 4 lines
Not sure if there is anything preventing to specify some folder on an existing tmpfs mountpoint as backing. With trixie, /tmp should be available for that, e.g.
You can simple set the variable INITRAMFS_OVERLAY_STORAGE_PATH in configuration(distro, kas or machine ):
``` INITRAMFS_OVERLAY_STORAGE_PATH = "/tmp" ```
Quirin
Quoted 13 lines
Quoted 10 lines
The goal is to ensure that the system always boots into a clean and controlled state,
without retaining any changes made during runtime — for improved security and integrity.Thank you for your time and expertise.
Best regards,
DavidJan
Quoted 71 lines · Quirin Gylstorff via lists.cip- project.org
Quoted 68 lines · Jan Kiszka
Hi David,
oops, I think no one replied to this question back then, right? Was the
topic resolved in the meantime, or is it still open?Quoted 61 lines · On 20.05.25 07:53, [email protected] wrote:
Hello all,
I have some questions regarding the use of the initramfs-overlay- hook
feature in CIP Core:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/
recipes-initramfs/initramfs-overlay-hook/initramfs-overlay- hook_0.3.bb
<
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
gitlab.com%2Fcip-project%2Fcip-core%2Fisar-cip-core%2F- %2Fblob%2Fmaster%2F&data=05%7C02%7Calexander.heinisch%40siemens.c om%7C3d4115b1b87f46e1d66308dde6206f60%7C38ae3bcd95794fd4addab42e1 495d55a%7C1%7C0%7C638919749159669284%7CUnknown%7CTWFpbGZsb3d8eyJF bXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=mzwlxx4Rq1VxC2WEUisczu Ai2%2FW6gWszsgVI2ttChKs%3D&reserved=0 recipes-initramfs/initramfs-overlay-hook/initramfs-overlay- hook_0.3.bb>Currently, I’m using the default behavior where the overlay’s upper
directory is located on a separate, persistent /var partition. An wic example setup can be found here:
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/wic/
bbb-efibootguard.wks.in
<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%25
2Fgitlab.com%2Fcip-project%2Fcip-core%2Fisar- &data=05%7C02%7Calexander.heinisch%40siemens.com%7C3d4115b1b87f46 e1d66308dde6206f60%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C6 38919749159690094%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWU sIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3 D%3D%7C0%7C%7C%7C&sdata=Cj%2BP8HzetDwQEKir6U048a3nt84DJRL%2FxTmQc 5VbFeM%3D&reserved=0 cip-core/-/blob/master/wic/bbb-efibootguard.wks.in>At runtime,
/etc/fstabincludes an entry:overlay on /etc type overlay (rw,relatime,lowerdir=/root/etc,upperdir=/ root/var/local/etc,workdir=/root/var/local/.etc-atomic,uuid=on)
In this setup, the root filesystem is mounted read-only, and directories
like /etc are made writable via an overlay.This works well from a functional perspective, but due to the use of
persistent storage for the upper and work directories (on /var), all runtime modifications are retained across reboots. For example:/etc/machine-idcan be modified as expected,
but also a file like/etc/systemd/system/attacker.servicecould be
dropped during runtime by someone with physical access to the flash of
the device.
These files would then persist across reboots, undermining runtime
integrity.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Questions:
1) Is there an existing way to configure initramfs-overlay-hook to use a
volatile overlay backed by tmpFS for the upper directories?
2) If not, would it be feasible or acceptable to extend the recipe to
optionally support such a mode?
3) Are there known reasons why a tmpFS for overlay storage was not
implemented yet?
As Jan and Quirin mentioned, (at least on trixie) it's just a matter of configuration. Nevertheless, not having persistent /etc can have side effects like e.g. systemd's /etc/machine-id, that needs special treatment in case you don't want to have first-boot semantics on every restart.
We had a discussion back then on ro /etc on this RFC [1]. We use a similar patch series downstream, build images with only /var rw and all the rest ro.
This approach was mainly driven due to the points you mentioned above as well as to prevent local changes that might require a merge on updates.
Since systemd itself tries to enforce ro /usr and rw /etc we decided not to integrate it in isar-cip-core as this could make long time maintenance pretty hard. A discussion with upstream systemd has still not happened yet. :-(
BR Alexander
Quoted 33 lines
Quoted 6 lines
Not sure if there is anything preventing to specify some folder on an
existing tmpfs mountpoint as backing. With trixie, /tmp should be available for that, e.g.You can simple set the variable
INITRAMFS_OVERLAY_STORAGE_PATHinconfiguration(distro, kas or machine ):``` INITRAMFS_OVERLAY_STORAGE_PATH = "/tmp" ```Quirin
Quoted 7 lines
Quoted 7 lines
The goal is to ensure that the system always boots into a clean and
controlled state,
without retaining any changes made during runtime — for improved security and integrity.Quoted 7 lines
Quoted 4 lines
Thank you for your time and expertise.
Best regards,
DavidJan
Quoted 11 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19979):
https://lists.cip-project.org/g/cip-dev/message/19979
Mute This Topic: https://lists.cip-project.org/mt/113206778/8886423
Group Owner: [email protected]
Unsubscribe:
https://lists.cip-project.org/g/cip-dev/unsub [[email protected] ]
-=-=-=-=-=-=-=-=-=-=-=-
--
Alexander Heinisch
Siemens AG
http://www.siemens.com/
Thank you for your help Alexander, Jan and Quirin!
Topic can be closed.
After discussion and your informations, I plan to switch to this approach:
1) Use /var as the overlay storage path and encrypt the /var partition.
2) Symlink /home to /var/home, so the only persistent partition is /var (following the move-homedir-var recipe).
This way, there’s no major divergence from the upstream CIP layer, while the encrypted /var partition addresses the security concerns.
David