diff mbox series

[meta-oe] wic/direct.py: ignore root mountpoint in fstab updater

Message ID 20220727134512.4033-1-f_l_k@t-online.de
State New
Headers show
Series [meta-oe] wic/direct.py: ignore root mountpoint in fstab updater | expand

Commit Message

Markus Volk July 27, 2022, 1:45 p.m. UTC
We already have a root entry in fstab. This commit prevents processing root
mountpoint in fstab_updater and thus avoids duplicate entries for root in fstab.

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 scripts/lib/wic/plugins/imager/direct.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ross Burton July 27, 2022, 3:44 p.m. UTC | #1
This looks like a fix for https://bugzilla.yoctoproject.org/show_bug.cgi?id=14865, can you confirm that?

Ross

> On 27 Jul 2022, at 14:45, Markus Volk via lists.openembedded.org <f_l_k=t-online.de@lists.openembedded.org> wrote:
> 
> We already have a root entry in fstab. This commit prevents processing root
> mountpoint in fstab_updater and thus avoids duplicate entries for root in fstab.
> 
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
> scripts/lib/wic/plugins/imager/direct.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index c44159b235..75004ab320 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -117,7 +117,8 @@ class DirectPlugin(ImagerPlugin):
>         updated = False
>         for part in self.parts:
>             if not part.realnum or not part.mountpoint \
> -               or not part.mountpoint.startswith('/'):
> +               or not part.mountpoint.startswith('/') \
> +               or part.mountpoint == "/":
>                 continue
> 
>             if part.use_uuid:
> -- 
> 2.34.1
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168561): https://lists.openembedded.org/g/openembedded-core/message/168561
> Mute This Topic: https://lists.openembedded.org/mt/92649199/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk July 27, 2022, 4:31 p.m. UTC | #2
Yes. With the patch the warning disappears from dmesg

Am Mi, 27. Jul 2022 um 15:44:48 +0000 schrieb Ross Burton 
<ross.burton@arm.com>:
> This looks like a fix for 
> <https://bugzilla.yoctoproject.org/show_bug.cgi?id=14865>, can you 
> confirm that?
> 
> Ross
> 
>>  On 27 Jul 2022, at 14:45, Markus Volk via lists.openembedded.org 
>> <f_l_k=t-online.de@lists.openembedded.org 
>> <mailto:f_l_k=t-online.de@lists.openembedded.org>> wrote:
>> 
>>  We already have a root entry in fstab. This commit prevents 
>> processing root
>>  mountpoint in fstab_updater and thus avoids duplicate entries for 
>> root in fstab.
>> 
>>  Signed-off-by: Markus Volk <f_l_k@t-online.de 
>> <mailto:f_l_k@t-online.de>>
>>  ---
>>  scripts/lib/wic/plugins/imager/direct.py | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>>  diff --git a/scripts/lib/wic/plugins/imager/direct.py 
>> b/scripts/lib/wic/plugins/imager/direct.py
>>  index c44159b235..75004ab320 100644
>>  --- a/scripts/lib/wic/plugins/imager/direct.py
>>  +++ b/scripts/lib/wic/plugins/imager/direct.py
>>  @@ -117,7 +117,8 @@ class DirectPlugin(ImagerPlugin):
>>          updated = False
>>          for part in self.parts:
>>              if not part.realnum or not part.mountpoint \
>>  -               or not part.mountpoint.startswith('/'):
>>  +               or not part.mountpoint.startswith('/') \
>>  +               or part.mountpoint == "/":
>>                  continue
>> 
>>              if part.use_uuid:
>>  --
>>  2.34.1
>> 
>> 
>> 
>> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168572): 
> <https://lists.openembedded.org/g/openembedded-core/message/168572>
> Mute This Topic: <https://lists.openembedded.org/mt/92649199/3618223>
> Group Owner: openembedded-core+owner@lists.openembedded.org 
> <mailto:openembedded-core+owner@lists.openembedded.org>
> Unsubscribe: 
> <https://lists.openembedded.org/g/openembedded-core/unsub> 
> [f_l_k@t-online.de <mailto:f_l_k@t-online.de>]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk July 27, 2022, 5:04 p.m. UTC | #3
But looking at the commit that introduced the problem, I see that it 
completely undoes it.
In general, I like the idea of having the fstab_updater create the root 
entry, but for this to work without duplication, the /dev/root entry 
would have to be removed from fstab.
This would force any wic image to use the fstab_updater (which can also 
be disabled) and would otherwise result in an fstab file with no root 
entry.
Probably removing the /dev/root entry would also break the boot of 
images that do not use wic

Translated with www.DeepL.com/Translator (free version)

Am Mi, 27. Jul 2022 um 18:31:38 +0200 schrieb Markus Volk 
<f_l_k@t-online.de>:
> Yes. With the patch the warning disappears from dmesg
> 
> Am Mi, 27. Jul 2022 um 15:44:48 +0000 schrieb Ross Burton 
> <ross.burton@arm.com>:
>> This looks like a fix for 
>> <https://bugzilla.yoctoproject.org/show_bug.cgi?id=14865>, can you 
>> confirm that?
>> 
>> Ross
>> 
>>>  On 27 Jul 2022, at 14:45, Markus Volk via lists.openembedded.org 
>>> <f_l_k=t-online.de@lists.openembedded.org 
>>> <mailto:f_l_k=t-online.de@lists.openembedded.org>> wrote:
>>> 
>>>  We already have a root entry in fstab. This commit prevents 
>>> processing root
>>>  mountpoint in fstab_updater and thus avoids duplicate entries for 
>>> root in fstab.
>>> 
>>>  Signed-off-by: Markus Volk <f_l_k@t-online.de 
>>> <mailto:f_l_k@t-online.de>>
>>>  ---
>>>  scripts/lib/wic/plugins/imager/direct.py | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>> 
>>>  diff --git a/scripts/lib/wic/plugins/imager/direct.py 
>>> b/scripts/lib/wic/plugins/imager/direct.py
>>>  index c44159b235..75004ab320 100644
>>>  --- a/scripts/lib/wic/plugins/imager/direct.py
>>>  +++ b/scripts/lib/wic/plugins/imager/direct.py
>>>  @@ -117,7 +117,8 @@ class DirectPlugin(ImagerPlugin):
>>>          updated = False
>>>          for part in self.parts:
>>>              if not part.realnum or not part.mountpoint \
>>>  -               or not part.mountpoint.startswith('/'):
>>>  +               or not part.mountpoint.startswith('/') \
>>>  +               or part.mountpoint == "/":
>>>                  continue
>>> 
>>>              if part.use_uuid:
>>>  --
>>>  2.34.1
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
>>
Ross Burton July 28, 2022, 4:15 p.m. UTC | #4
Added Tobias to distribution list as this is about a patch he sent.

On 27 Jul 2022, at 18:04, Markus Volk via lists.openembedded.org <f_l_k=t-online.de@lists.openembedded.org> wrote:
> 
> But looking at the commit that introduced the problem, I see that it completely undoes it.
> In general, I like the idea of having the fstab_updater create the root entry, but for this to work without duplication, the /dev/root entry would have to be removed from fstab.
> This would force any wic image to use the fstab_updater (which can also be disabled) and would otherwise result in an fstab file with no root entry.
> Probably removing the /dev/root entry would also break the boot of images that do not use wic

Tobias, looks like we’ve found a problem with your wic patch from May:

https://git.openembedded.org/openembedded-core/commit/?h=20d43a2599d7622b96e2fb0da87a886da1a3794a

Specifically, this bug:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=14865

It’s looking like the easiest fix here is to revert your patch, so at least we don’t have warnings and unexpected behaviour on boot.  Unless you’re willing to rework your patch so that it allows edits to the root mount point but doesn’t end up creating duplicates?

Thanks,
Ross
Markus Volk Aug. 2, 2022, 2:05 p.m. UTC | #5
Maybe we could do like this in base-files.bb ?

FSTAB_HAVE_WIC = "${@bb.utils.contains('IMAGE_FSTYPES', 'wic', 'true', 
'false', d)}"
FSTAB_WIC_UPDATER = "${@bb.utils.contains('WIC_CREATE_EXTRA_ARGS', 
'--no-fstab-update', 'false', 'true', d)}"

do_install:append() {
	if [ ${FSTAB_HAVE_WIC} = true ] && [ ${FSTAB_WIC_UPDATER} = true ]; 
then
		sed -i '/\/dev\/root/d' ${D}${sysconfdir}/fstab
	fi
}

This would remove the hardcoded '/dev/root' entry  if all conditions 
are met to add the root entry with wic fstab-update
> 
It’s looking like the easiest fix here is to revert your patch, so 
> at least we don’t have warnings and unexpected behaviour on boot.  
> Unless you’re willing to rework your patch so that it allows edits 
> to the root mount point but doesn’t end up creating duplicates?
diff mbox series

Patch

diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index c44159b235..75004ab320 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -117,7 +117,8 @@  class DirectPlugin(ImagerPlugin):
         updated = False
         for part in self.parts:
             if not part.realnum or not part.mountpoint \
-               or not part.mountpoint.startswith('/'):
+               or not part.mountpoint.startswith('/') \
+               or part.mountpoint == "/":
                 continue
 
             if part.use_uuid: