public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] classes/rootfs: remove content of /dev in postprocessing
@ 2024-04-23  9:49 Quirin Gylstorff
  2024-04-23 10:45 ` MOESSBAUER, Felix
  0 siblings, 1 reply; 4+ messages in thread
From: Quirin Gylstorff @ 2024-04-23  9:49 UTC (permalink / raw)
  To: isar-users, felix.moessbauer

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

`/dev` is populated by the kernel/initrd during boot up and non
reproducable.

Use a seperate function as /dev must not be mount before the content
is removed.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 498fbfd6..1d4bea59 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -340,6 +340,14 @@ python do_rootfs_postprocess() {
 }
 addtask rootfs_postprocess before do_rootfs after do_unpack
 
+# use a seperate function instead of postprocessing as dev should
+# not be mount on removal
+do_rootfs_clean_dev[network] = "${TASK_USE_SUDO}"
+do_rootfs_clean_dev() {
+    sudo rm -rf "${ROOTFSDIR}/dev/"*
+}
+addtask rootfs_clean_dev before do_rootfs after do_rootfs_postprocess
+
 python do_rootfs() {
     """Virtual task"""
     pass
-- 
2.43.0


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

* Re: [PATCH] classes/rootfs: remove content of /dev in postprocessing
  2024-04-23  9:49 [PATCH] classes/rootfs: remove content of /dev in postprocessing Quirin Gylstorff
@ 2024-04-23 10:45 ` MOESSBAUER, Felix
  2024-04-23 20:39   ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: MOESSBAUER, Felix @ 2024-04-23 10:45 UTC (permalink / raw)
  To: quirin.gylstorff, isar-users

On Tue, 2024-04-23 at 11:49 +0200, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> `/dev` is populated by the kernel/initrd during boot up and non
> reproducable.
> 
> Use a seperate function as /dev must not be mount before the content
> is removed.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>

+ Reported-by: Felix Moessbauer <felix.moessbauer@siemens.com>

That helps to keep the original people in the loop in case further bugs
show up.

> ---
>  meta/classes/rootfs.bbclass | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meta/classes/rootfs.bbclass
> b/meta/classes/rootfs.bbclass
> index 498fbfd6..1d4bea59 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -340,6 +340,14 @@ python do_rootfs_postprocess() {
>  }
>  addtask rootfs_postprocess before do_rootfs after do_unpack
>  
> +# use a seperate function instead of postprocessing as dev should
> +# not be mount on removal
> +do_rootfs_clean_dev[network] = "${TASK_USE_SUDO}"
> +do_rootfs_clean_dev() {
> +    sudo rm -rf "${ROOTFSDIR}/dev/"*

I just found out that /run also needs to be cleared.

In addition, the ".old" kernel parts should also be removed:

- initrd.img.old
- vmlinuz.old

Felix

> +}
> +addtask rootfs_clean_dev before do_rootfs after
> do_rootfs_postprocess
> +
>  python do_rootfs() {
>      """Virtual task"""
>      pass

-- 
Siemens AG, Technology
Linux Expert Center



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

* Re: [PATCH] classes/rootfs: remove content of /dev in postprocessing
  2024-04-23 10:45 ` MOESSBAUER, Felix
@ 2024-04-23 20:39   ` Jan Kiszka
  2024-04-24  8:28     ` MOESSBAUER, Felix
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2024-04-23 20:39 UTC (permalink / raw)
  To: MOESSBAUER, Felix, quirin.gylstorff, isar-users

On 23.04.24 12:45, 'MOESSBAUER, Felix' via isar-users wrote:
> On Tue, 2024-04-23 at 11:49 +0200, Quirin Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> `/dev` is populated by the kernel/initrd during boot up and non
>> reproducable.
>>
>> Use a seperate function as /dev must not be mount before the content
>> is removed.
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> + Reported-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> 
> That helps to keep the original people in the loop in case further bugs
> show up.
> 
>> ---
>>  meta/classes/rootfs.bbclass | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/meta/classes/rootfs.bbclass
>> b/meta/classes/rootfs.bbclass
>> index 498fbfd6..1d4bea59 100644
>> --- a/meta/classes/rootfs.bbclass
>> +++ b/meta/classes/rootfs.bbclass
>> @@ -340,6 +340,14 @@ python do_rootfs_postprocess() {
>>  }
>>  addtask rootfs_postprocess before do_rootfs after do_unpack
>>  
>> +# use a seperate function instead of postprocessing as dev should
>> +# not be mount on removal
>> +do_rootfs_clean_dev[network] = "${TASK_USE_SUDO}"
>> +do_rootfs_clean_dev() {
>> +    sudo rm -rf "${ROOTFSDIR}/dev/"*
> 
> I just found out that /run also needs to be cleared.
> 
> In addition, the ".old" kernel parts should also be removed:
> 
> - initrd.img.old
> - vmlinuz.old
> 

I wonder why none of this so far triggered the repro test of
isar-cip-core. Any idea why?

Jan

-- 
Siemens AG, Technology
Linux Expert Center


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

* Re: [PATCH] classes/rootfs: remove content of /dev in postprocessing
  2024-04-23 20:39   ` Jan Kiszka
@ 2024-04-24  8:28     ` MOESSBAUER, Felix
  0 siblings, 0 replies; 4+ messages in thread
From: MOESSBAUER, Felix @ 2024-04-24  8:28 UTC (permalink / raw)
  To: quirin.gylstorff, Kiszka, Jan, isar-users

On Tue, 2024-04-23 at 22:39 +0200, Jan Kiszka wrote:
> On 23.04.24 12:45, 'MOESSBAUER, Felix' via isar-users wrote:
> > On Tue, 2024-04-23 at 11:49 +0200, Quirin Gylstorff wrote:
> > > From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > > 
> > > `/dev` is populated by the kernel/initrd during boot up and non
> > > reproducable.
> > > 
> > > Use a seperate function as /dev must not be mount before the
> > > content
> > > is removed.
> > > 
> > > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > 
> > + Reported-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > 
> > That helps to keep the original people in the loop in case further
> > bugs
> > show up.
> > 
> > > ---
> > >  meta/classes/rootfs.bbclass | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/meta/classes/rootfs.bbclass
> > > b/meta/classes/rootfs.bbclass
> > > index 498fbfd6..1d4bea59 100644
> > > --- a/meta/classes/rootfs.bbclass
> > > +++ b/meta/classes/rootfs.bbclass
> > > @@ -340,6 +340,14 @@ python do_rootfs_postprocess() {
> > >  }
> > >  addtask rootfs_postprocess before do_rootfs after do_unpack
> > >  
> > > +# use a seperate function instead of postprocessing as dev
> > > should
> > > +# not be mount on removal
> > > +do_rootfs_clean_dev[network] = "${TASK_USE_SUDO}"
> > > +do_rootfs_clean_dev() {
> > > +    sudo rm -rf "${ROOTFSDIR}/dev/"*
> > 
> > I just found out that /run also needs to be cleared.
> > 
> > In addition, the ".old" kernel parts should also be removed:
> > 
> > - initrd.img.old
> > - vmlinuz.old
> > 
> 
> I wonder why none of this so far triggered the repro test of
> isar-cip-core. Any idea why?

The squashfs in isar-cip-core also contains all these files. These are
likely "reproducible", as these are just symlinks and dirs.

The /dev mount is a devtmpfs though. By that, the content might depend
on the kernel of the build system - and this reproducibility issue we
can't detect in our test as both builds are performed on the same host.

OT: This also applies to all loopback mounts, which we must avoid to be
reproducible (didn't check if we currently have any).

Anyways, the mentioned dirs should be cleared as they are overmounted
by systemd anyways (man file-hierarchy).

Felix

> 
> Jan
> 

-- 
Siemens AG, Technology
Linux Expert Center



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

end of thread, other threads:[~2024-04-24  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23  9:49 [PATCH] classes/rootfs: remove content of /dev in postprocessing Quirin Gylstorff
2024-04-23 10:45 ` MOESSBAUER, Felix
2024-04-23 20:39   ` Jan Kiszka
2024-04-24  8:28     ` MOESSBAUER, Felix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox