Yocto/Mender: bmaptool fails on ZFS/Linux

Hi there,

I am trying to bake Yocto/Mender based images for the RPi3, with the build directory residing on a ZFS filesystem on Linux.

Unfortunately, I am running into

bmaptool: ERROR: cannot generate bmap for file 'core-image-full-cmdline-raspberrypi3-64-20201103121352.sdimg': the file-system does not support "SEEK_HOLE" and "SEEK_DATA" but only provides a stub implementation

Is there a way to work around this (without moving the build directory to a different FS)?

Thanks for any hints!

Cheers,
/Tobias


Full traceback during build (while in final stage of writing image files):

| Command (m for help): The partition table has been altered.
| Syncing disks.
| 
| + false
| + cd /home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/deploy-core-image-full-cmdline-image-complete
| + bmaptool create core-image-full-cmdline-raspberrypi3-64-20201103121352.sdimg -o core-image-full-cmdline-raspberrypi3-64-20201103121352.sdimg.bmap
| bmaptool: ERROR: An error occurred, here is the traceback:
| Traceback (most recent call last):
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 383, in _invoke_fiemap
|     fcntl.ioctl(self._f_image, _FIEMAP_IOCTL, self._buf, 1)
| OSError: [Errno 95] Operation not supported
| 
| During handling of the above exception, another exception occurred:
| 
| Traceback (most recent call last):
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 528, in filemap
|     return FilemapFiemap(image)
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 357, in __init__
|     self.block_is_mapped(0)
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 404, in block_is_mapped
|     struct_fiemap = self._invoke_fiemap(block, 1)
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 391, in _invoke_fiemap
|     raise ErrorNotSupp(errstr)
| bmaptools.Filemap.ErrorNotSupp: FilemapFiemap: the FIEMAP ioctl is not supported by the file-system
| 
| During handling of the above exception, another exception occurred:
| 
| Traceback (most recent call last):
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/BmapCreate.py", line 176, in __init__
|     self.filemap = Filemap.filemap(self._f_image)
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 530, in filemap
|     return FilemapSeek(image)
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 203, in __init__
|     self._probe_seek_hole()
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/Filemap.py", line 238, in _probe_seek_hole
|     raise ErrorNotSupp("the file-system does not support "
| bmaptools.Filemap.ErrorNotSupp: the file-system does not support "SEEK_HOLE" and "SEEK_DATA" but only provides a stub implementation
| 
| During handling of the above exception, another exception occurred:
| 
| Traceback (most recent call last):
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/CLI.py", line 554, in create_command
|     creator = BmapCreate.BmapCreate(args.image, output, "sha256")
|   File "/home/buildbot/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/bmaptools/BmapCreate.py", line 178, in __init__
|     raise Error("cannot generate bmap for file '%s': %s"
| 
| bmaptool: ERROR: cannot generate bmap for file 'core-image-full-cmdline-raspberrypi3-64-20201103121352.sdimg': the file-system does not support "SEEK_HOLE" and "SEEK_DATA" but only provides a stub implementation
| 
| + bb_exit_handler
| + ret=1
| + echo WARNING: exit code 1 from a shell command.
| WARNING: exit code 1 from a shell command.
| + exit 1

Manually rerunning the failed command:

buildbot@matterhorn:~/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/deploy-core-image-full-cmdline-image-complete$ bmaptool create core-image-full-cmdline-raspberrypi3-64-20201103121352.mender -o core-image-full-cmdline-raspberrypi3-64-20201103121352.mender.bmap
bmaptool: ERROR: cannot generate bmap for file 'core-image-full-cmdline-raspberrypi3-64-20201103121352.mender': the file-system does not support "SEEK_HOLE" and "SEEK_DATA" but only provides a stub implementation
buildbot@matterhorn:~/.yocto/simplethings-hub/build/tmp-glibc/work/raspberrypi3_64-oe-linux/core-image-full-cmdline/1.0-r0/deploy-core-image-full-cmdline-image-complete$ ll
insgesamt 9521792
drwxr-xr-x  2 buildbot buildbot         15 Nov  3 13:42 ./
drwxrwxr-x 13 buildbot buildbot         20 Nov  3 13:20 ../
-rw-rw-r--  1 buildbot buildbot       3170 Nov  3 13:19 core-image-full-cmdline.env
-rw-r--r--  1 buildbot buildbot  134217728 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64-20201103121352.dataimg
-rw-r--r--  1 buildbot buildbot 4143972352 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64-20201103121352.ext4
-rw-r--r--  1 buildbot buildbot     162570 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64-20201103121352.manifest
-rw-rw-r--  1 buildbot buildbot  310602752 Nov  3 13:20 core-image-full-cmdline-raspberrypi3-64-20201103121352.mender
-rw-r--r--  1 buildbot buildbot          0 Nov  3 13:42 core-image-full-cmdline-raspberrypi3-64-20201103121352.mender.bmap
-rw-r--r--  1 buildbot buildbot 8581545984 Nov  3 13:20 core-image-full-cmdline-raspberrypi3-64-20201103121352.sdimg
-rw-r--r--  1 buildbot buildbot          0 Nov  3 13:20 core-image-full-cmdline-raspberrypi3-64-20201103121352.sdimg.bmap
-rw-r--r--  1 buildbot buildbot     354028 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64-20201103121352.testdata.json
lrwxrwxrwx  1 buildbot buildbot         62 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64.dataimg -> core-image-full-cmdline-raspberrypi3-64-20201103121352.dataimg
lrwxrwxrwx  1 buildbot buildbot         59 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64.ext4 -> core-image-full-cmdline-raspberrypi3-64-20201103121352.ext4
lrwxrwxrwx  1 buildbot buildbot         63 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64.manifest -> core-image-full-cmdline-raspberrypi3-64-20201103121352.manifest
lrwxrwxrwx  1 buildbot buildbot         68 Nov  3 13:19 core-image-full-cmdline-raspberrypi3-64.testdata.json -> core-image-full-cmdline-raspberrypi3-64-20201103121352.testdata.json

Host info:

buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ uname -a
Linux matterhorn 4.15.0-122-generic #124-Ubuntu SMP Thu Oct 15 13:03:05 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ 
buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ uname -a
Linux matterhorn 4.15.0-122-generic #124-Ubuntu SMP Thu Oct 15 13:03:05 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic
buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ lscpu 
Architektur:                   x86_64
CPU Operationsmodus:           32-bit, 64-bit
Byte-Reihenfolge:              Little Endian
CPU(s):                        32
Liste der Online-CPU(s):       0-31
Thread(s) pro Kern:            2
Kern(e) pro Socket:            16
Sockel:                        1
NUMA-Knoten:                   1
Anbieterkennung:               GenuineIntel
Prozessorfamilie:              6
Modell:                        86
Modellname:                    Intel(R) Xeon(R) CPU D-1587 @ 1.70GHz
Stepping:                      4
CPU MHz:                       801.828
Maximale Taktfrequenz der CPU: 2300,0000
Minimale Taktfrequenz der CPU: 800,0000
BogoMIPS:                      3400.09
Virtualisierung:               VT-x
L1d Cache:                     32K
L1i Cache:                     32K
L2 Cache:                      256K
L3 Cache:                      24576K
NUMA-Knoten0 CPU(s):           0-31
Markierungen:                  fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts md_clear flush_l1d
buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
tank                   171G   907G   192K  /tank
tank/buildbot          161G   907G   161G  /home/buildbot
tank/cbbenchmark      1,26G   907G  1,26G  /home/cbbenchmark
tank/cbbuilder        2,50G   907G  2,50G  /data/cbbuilder
tank/oberstet-python  1,25G   907G  1,25G  /home/oberstet/python
tank/oberstet-scm     3,28G   907G  3,28G  /home/oberstet/scm
tank/scratch           242M   907G   242M  /scratch
buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ 

Newer bmaptools have a check and warning for this now, however i don’t expect this to of been pulled into yocto project yet.

the solution is in the Known issues section at the end of the bmap-tools README.

2 Likes

Thanks for that hint! It seems like above change in bmap would then detect and bail out orderly? As in:

buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ cat /sys/module/zfs/parameters/zfs_dmu_offset_next_sync
0

yep, fails with a better description on why its failing, and where to look for the fix.
You will need to be admin user on your machine to change the zfs parameters as outlined in the readme.

Thanks again!

I’ve updated the box to ubuntu 20.04 and added above zfs kernel module option

echo "options zfs zfs_dmu_offset_next_sync=1" | sudo tee -a /etc/modprobe.d/zfs.conf

the option is set

buildbot@matterhorn:~/scm/crossbario/crossbarfx-os$ cat /sys/module/zfs/parameters/zfs_dmu_offset_next_sync
1

and it now works=) mender build runs successfully.

2 Likes

glad its all working for you :slight_smile:

1 Like