wic: race window in modification of /etc/fstab in do_image_wic with do_image_tar and do_image_ext4

Fixed

Description

There is a race when editing the /etc/fstab to add e.g. an entry for /boot (well any) fstab entry from the .wks into the filesystem image used for wic. This appears sporadically an has been bugging us with spurious broken images and bugreports for some time.

The issue surfaces as after do_image there is a parallel invocation of

1: agl-image-ivi-crosssdk-1.0-r0 do_image_tar - 25s (pid 14242) 2: agl-image-ivi-crosssdk-1.0-r0 do_image_wic - 24s (pid 14272) 3: agl-image-ivi-crosssdk-1.0-r0 do_image_ext4 - 25s (pid 14282)

Now the nasty issue is that do_image_wic will actually modify /etc/fstab.

So depending on how far the other 2 processes are, they get the modification or not.

This results in broken ext4 images (as there in no /boot to mount there).

Like:

A start job is running for /dev/disk/by-uuid/94E3-F144 (10s / 4mi

Which is nonsense when using the ext4 under qemu.

Environment

None

Activity

Show:

Walt Miner 
June 1, 2023 at 3:47 PM

  I am guessing this can be closed. 

Paul Barker 
January 21, 2021 at 7:17 PM

Upstream fix (http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=36575a949399953f98fc1cfda4a3dcb5a295b02c) and optimisation (http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=da846838fc5d2a1b421767be68561cdaa08bca42) patches have now been accepted. Hopefully they'll be backported along with the other pseudo & wic changes which Steve Sakoman is looking at. Until they arrive in a branch we're using, we've got a workaround in place.

Jan-Simon Moeller 
October 12, 2020 at 7:33 PM

So i added a workaround in poky-agl.conf. But IMHO this should be fixed upstream.

This bug means ext4/tar images are not reproducible.

Jan-Simon Moeller 
October 6, 2020 at 8:23 PM

So from my point of view:

image_types_wic.bbclass  should include something like this to do the proper dependencies

+# make sure that ext4 and tar are completely written out before we modify files to create the wic format (e.g. /etc/fstab !) +do_image_wic[deptask] += "${@bb.utils.contains('IMAGE_FSTYPES', 'ext4', '%s:do_image_ext4' % d.getVar('PN'), '', d)}" +do_image_wic[deptask] += "${@bb.utils.contains('IMAGE_FSTYPES', 'tar', '%s:do_image_tar' % d.getVar('PN'), '', d)}"

Jan-Simon Moeller 
October 6, 2020 at 8:11 PM

We're breaking:

  • runqemu

  • netboot using  image.ext4   (a partition image, not a 'disk' image)

  • nfsroot using the tarball extracted

So the cases that I list above are outside of wic, they're not related to a multi-partition setup or disk-image.

 

Details

Assignee

Reporter

Labels

Hardware Platform(s) Affected

Intel Minnowboard
Intel Upsquare
QEMU x86_64

Priority

Created October 6, 2020 at 4:15 PM
Updated June 1, 2023 at 6:24 PM
Resolved June 1, 2023 at 6:24 PM

Flag notifications