expand-on-first-boot: Add /tmp to ConditionPathIsReadWrite

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

Commit Message

Clara Kowalsky July 12, 2024, 2:03 p.m. UTC
This verifies that /tmp is readable and writable before starting the
service.

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

Jan Kiszka July 12, 2024, 2:09 p.m. UTC | #1
On 12.07.24 16:03, 'Clara Kowalsky' via isar-users wrote:
> This verifies that /tmp is readable and writable before starting the
> service.

Rather then repeating what the patch does, explain why it is doing this.

Jan

> 
> 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
>  
>  [Service]
>  Type=oneshot
MOESSBAUER, Felix July 18, 2024, 7:27 a.m. UTC | #2
On Fri, 2024-07-12 at 16:03 +0200, 'Clara Kowalsky' via isar-users
wrote:
> This verifies that /tmp is readable and writable before starting the
> service.
> 
> 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

Hi, can't we simply use PrivateTmp=true ? This would unshare /tmp and
/var/tmp from the host / calling environment.

I'm anyways wondering how the system will behave if /tmp is not
writable, as having this writable is mandated by systemd.

What data is stored there? If this is potentially big, we should not
use /tmp at all but instead /var/tmp.

Felix

>  
>  [Service]
>  Type=oneshot
> -- 
> 2.45.2
>
Clara Kowalsky July 24, 2024, 1:48 p.m. UTC | #3
> -----Original Message-----
> From: Moessbauer, Felix (T CED OES-DE) <felix.moessbauer@siemens.com>
> Sent: Thursday, July 18, 2024 9:27 AM
> To: isar-users@googlegroups.com; Kowalsky, Clara (T CED OES-DE)
> <clara.kowalsky@siemens.com>
> Cc: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com>
> Subject: Re: [PATCH] expand-on-first-boot: Add /tmp to
> ConditionPathIsReadWrite
> 
> On Fri, 2024-07-12 at 16:03 +0200, 'Clara Kowalsky' via isar-users
> wrote:
> > This verifies that /tmp is readable and writable before starting the
> > service.
> >
> > 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
> 
> Hi, can't we simply use PrivateTmp=true ? This would unshare /tmp and /var/tmp
> from the host / calling environment.

Thanks for the comment. I tested it with PrivateTmp=true and this also works fine. 
> 
> I'm anyways wondering how the system will behave if /tmp is not writable, as
> having this writable is mandated by systemd.
> 
> What data is stored there? If this is potentially big, we should not use /tmp at all
> but instead /var/tmp.

Mktemp just creates an empty directory that is used as mount point, so no need to switch to /var/tmp.

Clara

> Felix
> 
> >
> >  [Service]
> >  Type=oneshot
> > --
> > 2.45.2
> >
> 
> --
> Siemens AG, Technology
> Linux Expert Center
>

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