All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gylstorff Quirin <quirin.gylstorff@siemens.com>
To: cip-dev@lists.cip-project.org
Subject: Re: [cip-dev][isar-cip-core]RFC v2 6/9] Create systemd mount units for a etc overlay
Date: Thu, 18 Nov 2021 19:12:42 +0100	[thread overview]
Message-ID: <fcfd6bd1-12b0-cb73-e416-19d4d0e0a6f1@siemens.com> (raw)
In-Reply-To: <20211117121131.as2eyks3q76x75sq@MD1ZFJVC.ad001.siemens.net>



On 11/17/21 1:11 PM, Christian Storm via lists.cip-project.org wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> As /etc is read-only and needs to be accessed by the initrd
>> move the user defined settings to a overlay in /var/local/etc.
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>>   .../etc-overlay-fs/etc-overlay-fs_0.1.bb         | 16 ++++++++++++++++
>>   .../etc-overlay-fs/files/etc-hostname.service    | 14 ++++++++++++++
>>   .../etc-overlay-fs/files/etc-sysusers.service    | 14 ++++++++++++++
>>   recipes-core/etc-overlay-fs/files/etc.mount      | 13 +++++++++++++
>>   .../files/overlay-parse-etc.service              | 12 ++++++++++++
>>   recipes-core/etc-overlay-fs/files/postinst       |  6 ++++++
>>   recipes-core/images/cip-core-image-read-only.bb  |  1 +
>>   7 files changed, 76 insertions(+)
>>   create mode 100644 recipes-core/etc-overlay-fs/etc-overlay-fs_0.1.bb
>>   create mode 100644 recipes-core/etc-overlay-fs/files/etc-hostname.service
>>   create mode 100644 recipes-core/etc-overlay-fs/files/etc-sysusers.service
>>   create mode 100644 recipes-core/etc-overlay-fs/files/etc.mount
>>   create mode 100644 recipes-core/etc-overlay-fs/files/overlay-parse-etc.service
>>   create mode 100755 recipes-core/etc-overlay-fs/files/postinst
>>
>> diff --git a/recipes-core/etc-overlay-fs/etc-overlay-fs_0.1.bb b/recipes-core/etc-overlay-fs/etc-overlay-fs_0.1.bb
>> new file mode 100644
>> index 0000000..f1c8349
>> --- /dev/null
>> +++ b/recipes-core/etc-overlay-fs/etc-overlay-fs_0.1.bb
>> @@ -0,0 +1,16 @@
>> +inherit dpkg-raw
>> +
>> +SRC_URI = "file://postinst \
>> +           file://etc.mount \
>> +           file://overlay-parse-etc.service \
>> +           file://etc-hostname.service \
>> +           file://etc-sysusers.service"
>> +
>> +do_install[cleandirs]+="${D}/lib/systemd/system ${D}/var/local/etc ${D}/var/local/.atomic"
>> +do_install() {
>> +    TARGET=${D}/lib/systemd/system
>> +    install -m 0644 ${WORKDIR}/etc.mount ${TARGET}/etc.mount
>> +    install -m 0644 ${WORKDIR}/overlay-parse-etc.service  ${TARGET}/overlay-parse-etc.service
>> +    install -m 0644 ${WORKDIR}/etc-hostname.service ${TARGET}/etc-hostname.service
>> +    install -m 0644 ${WORKDIR}/etc-sysusers.service ${TARGET}/etc-sysusers.service
>> +}
>> diff --git a/recipes-core/etc-overlay-fs/files/etc-hostname.service b/recipes-core/etc-overlay-fs/files/etc-hostname.service
>> new file mode 100644
>> index 0000000..2306b9f
>> --- /dev/null
>> +++ b/recipes-core/etc-overlay-fs/files/etc-hostname.service
>> @@ -0,0 +1,14 @@
>> +[Unit]
>> +Description=set hostname /etc overlay-aware
>> +Before=network-pre.target
>> +Wants=network-pre.target
>> +Requires=etc.mount
>> +After=etc.mount
>> +
>> +[Service]
>> +Type=oneshot
>> +RemainAfterExit=yes
>> +ExecStart=/bin/hostname --boot --file /etc/hostname
>> +
>> +[Install]
>> +WantedBy=basic.target
>> diff --git a/recipes-core/etc-overlay-fs/files/etc-sysusers.service b/recipes-core/etc-overlay-fs/files/etc-sysusers.service
>> new file mode 100644
>> index 0000000..6caf6b0
>> --- /dev/null
>> +++ b/recipes-core/etc-overlay-fs/files/etc-sysusers.service
>> @@ -0,0 +1,14 @@
>> +[Unit]
>> +Description=make systemd-sysusers /etc overlay aware
>> +Before=network-pre.target
>> +Wants=network-pre.target
>> +Requires=etc.mount
>> +After=etc.mount
>> +
>> +[Service]
>> +Type=oneshot
>> +RemainAfterExit=yes
>> +ExecStart=/usr/bin/systemd-sysusers
>> +
>> +[Install]
>> +WantedBy=basic.target
> 
> Hm, why do you replace/create those services instead of augmenting the
> current default ones via conf.d'lets?
> Why is this one here dependent on network?
> Why does this differ that much from upstream service files, see, e.g.,
> https://github.com/systemd/systemd/blob/main/units/systemd-sysusers.service
> 

You right thats the better solution. Will test it and add it in a v3.


> 
>> diff --git a/recipes-core/etc-overlay-fs/files/etc.mount b/recipes-core/etc-overlay-fs/files/etc.mount
>> new file mode 100644
>> index 0000000..f0ae3c5
>> --- /dev/null
>> +++ b/recipes-core/etc-overlay-fs/files/etc.mount
>> @@ -0,0 +1,13 @@
>> +[Unit]
>> +Description=Overlay-mount /etc
>> +Requires=var.mount
>> +After=var.mount
>> +
>> +[Mount]
>> +What=overlay
>> +Where=/etc
>> +Type=overlay
>> +Options=noauto,x-systemd.automount,lowerdir=/etc,upperdir=/var/local/etc,workdir=/var/local/.atomic
>> +
>> +[Install]
>> +WantedBy=local-fs.target
>> diff --git a/recipes-core/etc-overlay-fs/files/overlay-parse-etc.service b/recipes-core/etc-overlay-fs/files/overlay-parse-etc.service
>> new file mode 100644
>> index 0000000..062bb40
>> --- /dev/null
>> +++ b/recipes-core/etc-overlay-fs/files/overlay-parse-etc.service
>> @@ -0,0 +1,12 @@
>> +[Unit]
>> +Description=Reload Configuration from the etc overlay
>> +Requires=etc.mount
>> +After=etc.mount
>> +
>> +[Service]
>> +Type=oneshot
>> +RemainAfterExit=yes
>> +ExecStartPre=!/bin/systemctl daemon-reload
>> +ExecStart=!/bin/systemctl --no-block isolate multi-user.target
> 
> Wow, this is a big cannon, why do you need this? Isn't there another way?

After testing in the current cip-core-image i don't need it.

Quirin
> 
> 
>> +[Install]
>> +WantedBy=local-fs.target
>> diff --git a/recipes-core/etc-overlay-fs/files/postinst b/recipes-core/etc-overlay-fs/files/postinst
>> new file mode 100755
>> index 0000000..35641af
>> --- /dev/null
>> +++ b/recipes-core/etc-overlay-fs/files/postinst
>> @@ -0,0 +1,6 @@
>> +#!/bin/sh
>> +
>> +deb-systemd-helper enable etc.mount  || true
>> +deb-systemd-helper enable overlay-parse-etc.service || true
>> +deb-systemd-helper enable etc-hostname.service || true
>> +deb-systemd-helper enable etc-sysusers.service || true
>> diff --git a/recipes-core/images/cip-core-image-read-only.bb b/recipes-core/images/cip-core-image-read-only.bb
>> index 7ef2dc2..ceb6ac4 100644
>> --- a/recipes-core/images/cip-core-image-read-only.bb
>> +++ b/recipes-core/images/cip-core-image-read-only.bb
>> @@ -2,6 +2,7 @@ require cip-core-image.bb
>>   
>>   SQUASHFS_EXCLUDE_DIRS += "home var"
>>   
>> +IMAGE_INSTALL += "etc-overlay-fs"
>>   IMAGE_INSTALL += "tmp-fs"
>>   IMAGE_INSTALL_remove += "initramfs-abrootfs-secureboot"
>>   
>> -- 
>> 2.30.2
>>
> 
> 
> 
> Kind regards,
>     Christian
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#6944): https://lists.cip-project.org/g/cip-dev/message/6944
> Mute This Topic: https://lists.cip-project.org/mt/87092661/1753640
> Group Owner: cip-dev+owner@lists.cip-project.org
> Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129121/1753640/1405269326/xyzzy [quirin.gylstorff@siemens.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


  reply	other threads:[~2021-11-18 18:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 11:27 [cip-dev][isar-cip-core]RFC v2 0/9] Read-only root file system with dm-verity Q. Gylstorff
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 1/9] Add new class to create a squashfs based root file system Q. Gylstorff
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 2/9] Add verity-img.bbclass for dm-verity based rootfs Q. Gylstorff
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 3/9] linux-cip-common: Add options necessary for dm-verity Q. Gylstorff
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 4/9] Create a initrd with support " Q. Gylstorff
2021-11-17 12:33   ` Christian Storm
2021-11-18 18:19     ` Gylstorff Quirin
2021-11-19 13:29       ` Christian Storm
2021-11-23 13:31         ` Gylstorff Quirin
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 5/9] Create an read-only rootfs with dm-verity Q. Gylstorff
2021-11-17 12:18   ` Christian Storm
2021-11-18 18:10     ` Gylstorff Quirin
2021-11-19  6:41       ` Jan Kiszka
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 6/9] Create systemd mount units for a etc overlay Q. Gylstorff
2021-11-17 12:11   ` Christian Storm
2021-11-18 18:12     ` Gylstorff Quirin [this message]
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 7/9] Mount writable home partition Q. Gylstorff
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 8/9] kas: Patch isar for correct permissions in var and home Q. Gylstorff
2021-11-17 10:27   ` Christian Storm
2021-11-17 11:41     ` Gylstorff Quirin
2021-11-16 11:27 ` [cip-dev][isar-cip-core]RFC v2 9/9] swupdate: Backport patches from SWUpdate Master Q. Gylstorff
2021-11-17 10:40   ` Christian Storm
2021-11-17 11:36     ` Gylstorff Quirin
2021-11-19  6:42       ` Jan Kiszka
2021-11-19 13:34         ` Christian Storm

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=fcfd6bd1-12b0-cb73-e416-19d4d0e0a6f1@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.