diff mbox series

[scarthgap,v2] wic: Fix updating fstab for nvme0n1

Message ID 20260522045949.184811-1-aleksandar.nikolic22@pm.me
State New
Headers show
Series [scarthgap,v2] wic: Fix updating fstab for nvme0n1 | expand

Commit Message

Aleksandar Nikolic May 22, 2026, 4:59 a.m. UTC
From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>

In case wks file references nvme0n1, update_fstab() function creates wrong entries
in /etc/fstab, as it is not adding prefix 'p' before the partition number (at the
moment this happens only for mmcblk). This leads that entries in /etc/fstab start
with:

    /dev/nvme0n11
    /dev/nvme0n13

instead with:

    /dev/nvme0n1p1
    /dev/nvme0n1p3

The patch fixes this as it extends the if condition and adds prefix 'p' for
both mmcblk and nvme0n1.

Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
---
 scripts/lib/wic/plugins/imager/direct.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Barker May 22, 2026, 10:53 a.m. UTC | #1
On Fri, 2026-05-22 at 06:59 +0200, Aleksandar Nikolic via
lists.openembedded.org wrote:
> From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
> 
> In case wks file references nvme0n1, update_fstab() function creates wrong entries
> in /etc/fstab, as it is not adding prefix 'p' before the partition number (at the
> moment this happens only for mmcblk). This leads that entries in /etc/fstab start
> with:
> 
>     /dev/nvme0n11
>     /dev/nvme0n13
> 
> instead with:
> 
>     /dev/nvme0n1p1
>     /dev/nvme0n1p3
> 
> The patch fixes this as it extends the if condition and adds prefix 'p' for
> both mmcblk and nvme0n1.

This is an interesting case for our backport policy, as wic is no longer
embedded within OE-core on wrynose or master. However, I think this
should be submitted against the standalone wic repository first (see the
readme [1] for contributing instructions) and we should get feedback
from the maintainer.

[1]: https://git.yoctoproject.org/wic/tree/README.md?h=master

This should also handle other NVMe devices beyond the first, what about
/dev/nvme1n1? Or an NVMe device with a second namespace /dev/nvme1n2?

Best regards,
Aleksandar Nikolic May 22, 2026, 11:13 a.m. UTC | #2
On Fri, May 22, 2026 at 12:53 PM, Paul Barker wrote:

> 
> On Fri, 2026-05-22 at 06:59 +0200, Aleksandar Nikolic via
> lists.openembedded.org wrote:
> 
>> From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
>> 
>> In case wks file references nvme0n1, update_fstab() function creates wrong
>> entries
>> in /etc/fstab, as it is not adding prefix 'p' before the partition number
>> (at the
>> moment this happens only for mmcblk). This leads that entries in
>> /etc/fstab start
>> with:
>> 
>> /dev/nvme0n11
>> /dev/nvme0n13
>> 
>> instead with:
>> 
>> /dev/nvme0n1p1
>> /dev/nvme0n1p3
>> 
>> The patch fixes this as it extends the if condition and adds prefix 'p'
>> for
>> both mmcblk and nvme0n1.
> 
> This is an interesting case for our backport policy, as wic is no longer
> embedded within OE-core on wrynose or master. However, I think this
> should be submitted against the standalone wic repository first (see the
> readme [1] for contributing instructions) and we should get feedback
> from the maintainer.

Yes, makes sense. I'll post a patch there as soon as I have added your suggestions. When/if it gets accepted we can backport it to scarthgap and whinlatter.

> 
> [1]: https://git.yoctoproject.org/wic/tree/README.md?h=master
> 
> This should also handle other NVMe devices beyond the first, what about
> /dev/nvme1n1? Or an NVMe device with a second namespace /dev/nvme1n2?

Thanks, will add your suggestions in the patch for the wic repository.

Cheers,
Aleksandar
> 
> Best regards,
> 
> --
> Paul Barker
diff mbox series

Patch

diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index a1d152659b..5600d72e61 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -133,8 +133,8 @@  class DirectPlugin(ImagerPlugin):
             elif part.use_label:
                 device_name = "LABEL=%s" % part.label
             else:
-                # mmc device partitions are named mmcblk0p1, mmcblk0p2..
-                prefix = 'p' if  part.disk.startswith('mmcblk') else ''
+                # mmc and nvme0n1 device partitions are named <disk>p1, <disk>p2..
+                prefix = 'p' if  part.disk.startswith(('mmcblk', 'nvme0n1')) else ''
                 device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum)
 
             opts = part.fsopts if part.fsopts else "defaults"