buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target
@ 2020-06-05 22:48 Norbert Lange
  2020-06-05 22:48 ` [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories Norbert Lange
  2020-06-06 20:39 ` [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Thomas Petazzoni
  0 siblings, 2 replies; 11+ messages in thread
From: Norbert Lange @ 2020-06-05 22:48 UTC (permalink / raw)
  To: buildroot

this is only relevant for staging (if at all)

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ce1c08a6f6..6a76e87b5e 100644
--- a/Makefile
+++ b/Makefile
@@ -748,7 +748,7 @@ target-finalize: $(PACKAGES) $(TARGET_DIR) host-finalize
 	rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
 		$(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
 		$(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \
-		$(TARGET_DIR)/usr/doc
+		$(TARGET_DIR)/usr/lib/rpm $(TARGET_DIR)/usr/doc
 	find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
 	find $(TARGET_DIR)/lib/ $(TARGET_DIR)/usr/lib/ $(TARGET_DIR)/usr/libexec/ \
 		\( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | xargs -0 rm -f
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-05 22:48 [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Norbert Lange
@ 2020-06-05 22:48 ` Norbert Lange
  2020-06-06 20:42   ` Thomas Petazzoni
  2022-01-09  9:11   ` Arnout Vandecappelle
  2020-06-06 20:39 ` [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Thomas Petazzoni
  1 sibling, 2 replies; 11+ messages in thread
From: Norbert Lange @ 2020-06-05 22:48 UTC (permalink / raw)
  To: buildroot

Scripts in the fakeroot environment could call
tools preparing the early environment, leaving
traces in /run or /tmp.

mkusers might create home directories in /run for
example.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 fs/common.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/common.mk b/fs/common.mk
index 842ea924a5..a5c6b4ea96 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -171,6 +171,7 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
 
 	$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
 		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
+	echo "rm -rf $$(TARGET_DIR)/run/* $$(TARGET_DIR)/run/.[^.]* $$(TARGET_DIR)/tmp/* $$(TARGET_DIR)/tmp/.[^.]*" >> $$(FAKEROOT_SCRIPT)
 	$$(call PRINTF,$$(ROOTFS_REPRODUCIBLE)) >> $$(FAKEROOT_SCRIPT)
 	$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
 	chmod a+x $$(FAKEROOT_SCRIPT)
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target
  2020-06-05 22:48 [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Norbert Lange
  2020-06-05 22:48 ` [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories Norbert Lange
@ 2020-06-06 20:39 ` Thomas Petazzoni
  2020-06-06 22:51   ` Norbert Lange
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2020-06-06 20:39 UTC (permalink / raw)
  To: buildroot

On Sat,  6 Jun 2020 00:48:56 +0200
Norbert Lange <nolange79@gmail.com> wrote:

> this is only relevant for staging (if at all)
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index ce1c08a6f6..6a76e87b5e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -748,7 +748,7 @@ target-finalize: $(PACKAGES) $(TARGET_DIR) host-finalize
>  	rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
>  		$(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
>  		$(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \
> -		$(TARGET_DIR)/usr/doc
> +		$(TARGET_DIR)/usr/lib/rpm $(TARGET_DIR)/usr/doc

What have you found installed in $(TARGET_DIR)/usr/lib/rpm ? Why does
this needs to be done in target-finalize and not in the rpm package ?
Is it because other packages install stuff in /usr/lib/rpm ? If so,
what ?

Again, we need better commit logs, otherwise for each of your changes
we'll have to ask for additional clarifications/details.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-05 22:48 ` [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories Norbert Lange
@ 2020-06-06 20:42   ` Thomas Petazzoni
  2020-06-06 22:57     ` Norbert Lange
  2022-01-09  9:11   ` Arnout Vandecappelle
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2020-06-06 20:42 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat,  6 Jun 2020 00:48:57 +0200
Norbert Lange <nolange79@gmail.com> wrote:

> Scripts in the fakeroot environment could call
> tools preparing the early environment, leaving
> traces in /run or /tmp.
> 
> mkusers might create home directories in /run for
> example.
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>

Looping Yann on this. I agree that we definitely want /tmp and /run to
be empty, as we are anyway going to mount a tmpfs over them, so
whatever they contains is not visible on the target system, but takes
up some space on the filesystem.

However, I'm not sure if removing all what they contain is the right
approach. Shouldn't we avoid creating things in /tmp and /run in the
first place ?

Yann, any feedback on this ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target
  2020-06-06 20:39 ` [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Thomas Petazzoni
@ 2020-06-06 22:51   ` Norbert Lange
  2020-06-07 18:43     ` Norbert Lange
  0 siblings, 1 reply; 11+ messages in thread
From: Norbert Lange @ 2020-06-06 22:51 UTC (permalink / raw)
  To: buildroot

Am Sa., 6. Juni 2020 um 22:39 Uhr schrieb Thomas Petazzoni
<thomas.petazzoni@bootlin.com>:
>
> On Sat,  6 Jun 2020 00:48:56 +0200
> Norbert Lange <nolange79@gmail.com> wrote:
>
> > this is only relevant for staging (if at all)
> >
> > Signed-off-by: Norbert Lange <nolange79@gmail.com>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index ce1c08a6f6..6a76e87b5e 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -748,7 +748,7 @@ target-finalize: $(PACKAGES) $(TARGET_DIR) host-finalize
> >       rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
> >               $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
> >               $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \
> > -             $(TARGET_DIR)/usr/doc
> > +             $(TARGET_DIR)/usr/lib/rpm $(TARGET_DIR)/usr/doc
>
> What have you found installed in $(TARGET_DIR)/usr/lib/rpm ? Why does
> this needs to be done in target-finalize and not in the rpm package ?
> Is it because other packages install stuff in /usr/lib/rpm ? If so,
> what ?

I believe this to be a common occurrence, like /usr/share/aclocal. But
I need to check that again

>
> Again, we need better commit logs, otherwise for each of your changes
> we'll have to ask for additional clarifications/details.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-06 20:42   ` Thomas Petazzoni
@ 2020-06-06 22:57     ` Norbert Lange
  2020-06-07  8:47       ` Thomas Petazzoni
  0 siblings, 1 reply; 11+ messages in thread
From: Norbert Lange @ 2020-06-06 22:57 UTC (permalink / raw)
  To: buildroot

Am Sa., 6. Juni 2020 um 22:42 Uhr schrieb Thomas Petazzoni
<thomas.petazzoni@bootlin.com>:
>
> Hello,
>
> On Sat,  6 Jun 2020 00:48:57 +0200
> Norbert Lange <nolange79@gmail.com> wrote:
>
> > Scripts in the fakeroot environment could call
> > tools preparing the early environment, leaving
> > traces in /run or /tmp.
> >
> > mkusers might create home directories in /run for
> > example.
> >
> > Signed-off-by: Norbert Lange <nolange79@gmail.com>
>
> Looping Yann on this. I agree that we definitely want /tmp and /run to
> be empty, as we are anyway going to mount a tmpfs over them, so
> whatever they contains is not visible on the target system, but takes
> up some space on the filesystem.
>
> However, I'm not sure if removing all what they contain is the right
> approach. Shouldn't we avoid creating things in /tmp and /run in the
> first place ?

Yeah we should avoid creating stuff there, but it's sometimes hard to do.
One example is defining a user with home dir in /run, mkusers will
then create a dir there
(pretty late to clear it up otherwise)

More important would be tools that lazily create stuff on the first boot,
and either buildroot or a custom fakeroot stage script would run this
on the host instead (worstcase in some sort of container/chroot).


>
> Yann, any feedback on this ?
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Norbert

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-06 22:57     ` Norbert Lange
@ 2020-06-07  8:47       ` Thomas Petazzoni
  2020-06-07 18:41         ` Norbert Lange
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2020-06-07  8:47 UTC (permalink / raw)
  To: buildroot

On Sun, 7 Jun 2020 00:57:23 +0200
Norbert Lange <nolange79@gmail.com> wrote:

> > However, I'm not sure if removing all what they contain is the right
> > approach. Shouldn't we avoid creating things in /tmp and /run in the
> > first place ?  
> 
> Yeah we should avoid creating stuff there, but it's sometimes hard to do.
> One example is defining a user with home dir in /run, mkusers will
> then create a dir there
> (pretty late to clear it up otherwise)

But our skeleton has a fstab that always mounts a tmpfs filesystem on
/run, so how can it make sense for mkusers to create a home directory
in /run ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-07  8:47       ` Thomas Petazzoni
@ 2020-06-07 18:41         ` Norbert Lange
  2020-06-10 22:55           ` Norbert Lange
  0 siblings, 1 reply; 11+ messages in thread
From: Norbert Lange @ 2020-06-07 18:41 UTC (permalink / raw)
  To: buildroot

Am So., 7. Juni 2020 um 10:47 Uhr schrieb Thomas Petazzoni
<thomas.petazzoni@bootlin.com>:
>
> On Sun, 7 Jun 2020 00:57:23 +0200
> Norbert Lange <nolange79@gmail.com> wrote:
>
> > > However, I'm not sure if removing all what they contain is the right
> > > approach. Shouldn't we avoid creating things in /tmp and /run in the
> > > first place ?
> >
> > Yeah we should avoid creating stuff there, but it's sometimes hard to do.
> > One example is defining a user with home dir in /run, mkusers will
> > then create a dir there
> > (pretty late to clear it up otherwise)
>
> But our skeleton has a fstab that always mounts a tmpfs filesystem on
> /run, so how can it make sense for mkusers to create a home directory
> in /run ?

Think of system users, where the "home" is usually non-persistent or
just some sort of jail.
For ex. my openssh patch sets the sshd user's home to /run/sshd - A
directory that's automatically
created when the service starts and deleted when it stops.

>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Norbert

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target
  2020-06-06 22:51   ` Norbert Lange
@ 2020-06-07 18:43     ` Norbert Lange
  0 siblings, 0 replies; 11+ messages in thread
From: Norbert Lange @ 2020-06-07 18:43 UTC (permalink / raw)
  To: buildroot

Am So., 7. Juni 2020 um 00:51 Uhr schrieb Norbert Lange <nolange79@gmail.com>:
>
> Am Sa., 6. Juni 2020 um 22:39 Uhr schrieb Thomas Petazzoni
> <thomas.petazzoni@bootlin.com>:
> >
> > On Sat,  6 Jun 2020 00:48:56 +0200
> > Norbert Lange <nolange79@gmail.com> wrote:
> >
> > > this is only relevant for staging (if at all)
> > >
> > > Signed-off-by: Norbert Lange <nolange79@gmail.com>
> > > ---
> > >  Makefile | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index ce1c08a6f6..6a76e87b5e 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -748,7 +748,7 @@ target-finalize: $(PACKAGES) $(TARGET_DIR) host-finalize
> > >       rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
> > >               $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
> > >               $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \
> > > -             $(TARGET_DIR)/usr/doc
> > > +             $(TARGET_DIR)/usr/lib/rpm $(TARGET_DIR)/usr/doc
> >
> > What have you found installed in $(TARGET_DIR)/usr/lib/rpm ? Why does
> > this needs to be done in target-finalize and not in the rpm package ?
> > Is it because other packages install stuff in /usr/lib/rpm ? If so,
> > what ?
>
> I believe this to be a common occurrence, like /usr/share/aclocal. But
> I need to check that again
>

Turns out that systemd drops some "macros" there.

Norbert

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-07 18:41         ` Norbert Lange
@ 2020-06-10 22:55           ` Norbert Lange
  0 siblings, 0 replies; 11+ messages in thread
From: Norbert Lange @ 2020-06-10 22:55 UTC (permalink / raw)
  To: buildroot

Am So., 7. Juni 2020 um 20:41 Uhr schrieb Norbert Lange <nolange79@gmail.com>:
>
> Am So., 7. Juni 2020 um 10:47 Uhr schrieb Thomas Petazzoni
> <thomas.petazzoni@bootlin.com>:
> >
> > On Sun, 7 Jun 2020 00:57:23 +0200
> > Norbert Lange <nolange79@gmail.com> wrote:
> >
> > > > However, I'm not sure if removing all what they contain is the right
> > > > approach. Shouldn't we avoid creating things in /tmp and /run in the
> > > > first place ?
> > >
> > > Yeah we should avoid creating stuff there, but it's sometimes hard to do.
> > > One example is defining a user with home dir in /run, mkusers will
> > > then create a dir there
> > > (pretty late to clear it up otherwise)
> >
> > But our skeleton has a fstab that always mounts a tmpfs filesystem on
> > /run, so how can it make sense for mkusers to create a home directory
> > in /run ?
>
> Think of system users, where the "home" is usually non-persistent or
> just some sort of jail.
> For ex. my openssh patch sets the sshd user's home to /run/sshd - A
> directory that's automatically
> created when the service starts and deleted when it stops.
>

Some other example is dbus, creates a user with homedir=/var/run/dbus. So
not only my hackjobs are affected ;)

Should I somehow ping you if some patches are ready BTW (not sure if
you read through all discussions)?
On that note, can you upgrade fakeroot to 1.24 now?
https://patchwork.ozlabs.org/project/buildroot/list/?series=176013

Norbert

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories
  2020-06-05 22:48 ` [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories Norbert Lange
  2020-06-06 20:42   ` Thomas Petazzoni
@ 2022-01-09  9:11   ` Arnout Vandecappelle
  1 sibling, 0 replies; 11+ messages in thread
From: Arnout Vandecappelle @ 2022-01-09  9:11 UTC (permalink / raw)
  To: Norbert Lange, buildroot

  Hi Norbert,

On 06/06/2020 00:48, Norbert Lange wrote:
> Scripts in the fakeroot environment could call
> tools preparing the early environment, leaving
> traces in /run or /tmp.
> 
> mkusers might create home directories in /run for
> example.
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>

  I finally applied to master, thanks. I extended the commit message based on 
the discussion on the patch.

  Regards,
  Arnout

> ---
>   fs/common.mk | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/common.mk b/fs/common.mk
> index 842ea924a5..a5c6b4ea96 100644
> --- a/fs/common.mk
> +++ b/fs/common.mk
> @@ -171,6 +171,7 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
>   
>   	$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
>   		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
> +	echo "rm -rf $$(TARGET_DIR)/run/* $$(TARGET_DIR)/run/.[^.]* $$(TARGET_DIR)/tmp/* $$(TARGET_DIR)/tmp/.[^.]*" >> $$(FAKEROOT_SCRIPT)
>   	$$(call PRINTF,$$(ROOTFS_REPRODUCIBLE)) >> $$(FAKEROOT_SCRIPT)
>   	$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
>   	chmod a+x $$(FAKEROOT_SCRIPT)
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-09  9:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 22:48 [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Norbert Lange
2020-06-05 22:48 ` [Buildroot] [PATCH 2/2] fs: clean the volatile /run and /tmp directories Norbert Lange
2020-06-06 20:42   ` Thomas Petazzoni
2020-06-06 22:57     ` Norbert Lange
2020-06-07  8:47       ` Thomas Petazzoni
2020-06-07 18:41         ` Norbert Lange
2020-06-10 22:55           ` Norbert Lange
2022-01-09  9:11   ` Arnout Vandecappelle
2020-06-06 20:39 ` [Buildroot] [PATCH 1/2] Makefile: remove /usr/lib/rpm directory on target Thomas Petazzoni
2020-06-06 22:51   ` Norbert Lange
2020-06-07 18:43     ` Norbert Lange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).