[v2] expand-on-first-boot: Add /tmp to ConditionPathIsReadWrite

Message ID 20240712153929.772552-1-clara.kowalsky@siemens.com
State Superseded, archived
Headers show
Series [v2] expand-on-first-boot: Add /tmp to ConditionPathIsReadWrite | expand

Commit Message

Clara Kowalsky July 12, 2024, 3:39 p.m. UTC
Since mktemp is used and creates a temporary file, we need to ensure
that /tmp is writable.

Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
---
 .../expand-on-first-boot/files/expand-on-first-boot.service     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Uladzimir Bely July 18, 2024, 5:35 a.m. UTC | #1
On Fri, 2024-07-12 at 17:39 +0200, 'Clara Kowalsky' via isar-users
wrote:
> Since mktemp is used and creates a temporary file, we need to ensure
> that /tmp is writable.
> 
> Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
> ---
>  .../expand-on-first-boot/files/expand-on-first-boot.service     | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-
> on-first-boot.service b/meta/recipes-support/expand-on-first-
> boot/files/expand-on-first-boot.service
> index 90c92a39..9daae719 100644
> --- a/meta/recipes-support/expand-on-first-boot/files/expand-on-
> first-boot.service
> +++ b/meta/recipes-support/expand-on-first-boot/files/expand-on-
> first-boot.service
> @@ -9,7 +9,7 @@ DefaultDependencies=no
>  Conflicts=shutdown.target
>  After=systemd-remount-fs.service
>  Before=local-fs-pre.target shutdown.target
> -ConditionPathIsReadWrite=/etc
> +ConditionPathIsReadWrite=/etc /tmp
>  

In a downstream we have read-only rootfs and some writable last
partition that we want to expand. Having writable "/etc" condition in
Isar recipe makes us use .bbappend rewrite the service file.

Would not it be better not to depend on writable "/etc" at all in Isar?

>  [Service]
>  Type=oneshot
> -- 
> 2.45.2
> 

BTW, in the same downstream something close we do for sshd-regen-keys
service. Due to readonly rootfs, instead of writable "/etc" condition
we use more narrow "/etc/ssh" one. So it might be changed in Isar also,
but it is a topic for a separate discussion.
MOESSBAUER, Felix July 18, 2024, 7:11 a.m. UTC | #2
On Thu, 2024-07-18 at 08:35 +0300, Uladzimir Bely wrote:
> On Fri, 2024-07-12 at 17:39 +0200, 'Clara Kowalsky' via isar-users
> wrote:
> > Since mktemp is used and creates a temporary file, we need to
> > ensure
> > that /tmp is writable.
> > 
> > Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
> > ---
> >  .../expand-on-first-boot/files/expand-on-first-boot.service     |
> > 2
> > +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meta/recipes-support/expand-on-first-
> > boot/files/expand-
> > on-first-boot.service b/meta/recipes-support/expand-on-first-
> > boot/files/expand-on-first-boot.service
> > index 90c92a39..9daae719 100644
> > --- a/meta/recipes-support/expand-on-first-boot/files/expand-on-
> > first-boot.service
> > +++ b/meta/recipes-support/expand-on-first-boot/files/expand-on-
> > first-boot.service
> > @@ -9,7 +9,7 @@ DefaultDependencies=no
> >  Conflicts=shutdown.target
> >  After=systemd-remount-fs.service
> >  Before=local-fs-pre.target shutdown.target
> > -ConditionPathIsReadWrite=/etc
> > +ConditionPathIsReadWrite=/etc /tmp
> >  
> 
> In a downstream we have read-only rootfs and some writable last
> partition that we want to expand. Having writable "/etc" condition in
> Isar recipe makes us use .bbappend rewrite the service file.
> 
> Would not it be better not to depend on writable "/etc" at all in
> Isar?

According to systemd, /etc must be RW when transitioning out of the
initrd. The reason for that is the creation of the machine-id.

Felix

> 
> >  [Service]
> >  Type=oneshot
> > -- 
> > 2.45.2
> > 
> 
> BTW, in the same downstream something close we do for sshd-regen-keys
> service. Due to readonly rootfs, instead of writable "/etc" condition
> we use more narrow "/etc/ssh" one. So it might be changed in Isar
> also,
> but it is a topic for a separate discussion.
> 
> -- 
> Best regards,
> Uladzimir.
>

Patch

diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-on-first-boot.service b/meta/recipes-support/expand-on-first-boot/files/expand-on-first-boot.service
index 90c92a39..9daae719 100644
--- a/meta/recipes-support/expand-on-first-boot/files/expand-on-first-boot.service
+++ b/meta/recipes-support/expand-on-first-boot/files/expand-on-first-boot.service
@@ -9,7 +9,7 @@  DefaultDependencies=no
 Conflicts=shutdown.target
 After=systemd-remount-fs.service
 Before=local-fs-pre.target shutdown.target
-ConditionPathIsReadWrite=/etc
+ConditionPathIsReadWrite=/etc /tmp
 
 [Service]
 Type=oneshot