#1008107 "mke2fs -E android_sparse" yields: "Unimplemented ext2 library function while setting up superblock" (not built against libsparse?) #1008107
- Package:
- libext2fs2
- Source:
- e2fsprogs
- Description:
- ext2/ext3/ext4 file system libraries
- Submitter:
- Daniel Kahn Gillmor
- Date:
- 2022-03-23 03:27:03 UTC
- Severity:
- normal
The -E android_sparse option for mke2fs fails because libext2fs2 reports EXT2_ET_UNIMPLEMENTED, presumably because libext2fs2 isn't built with ENABLE_LIBSPARSE . here's the failure: ``` 0 dkg@host:~$ /sbin/mke2fs tmp/control 1000 mke2fs 1.46.5 (30-Dec-2021) Creating regular file tmp/control Creating filesystem with 1000 1k blocks and 128 inodes Allocating group tables: done Writing inode tables: done Writing superblocks and filesystem accounting information: done 0 dkg@host:~$ /sbin/mke2fs -E android_sparse tmp/test 1000 mke2fs 1.46.5 (30-Dec-2021) Creating regular file tmp/test tmp/test: Unimplemented ext2 library function while setting up superblock 1 dkg@host:~$ ``` I ran into this because i wanted to call "fastboot format cache", which failed when trying to run mke2fs. it was trying to run it with -E android_sparse Looks like fastboot runs mke2fs from /usr/lib/android-sdk/platform-tools/mke2fs, which is just a symlink back to /sbin/mkfs, provided by android-sdk-platform-tools. the "fastboot format cache" command instead fails with: ``` mke2fs 1.46.5 (30-Dec-2021) /tmp/TemporaryFile-62XVjd: Unimplemented ext2 library function while setting up superblock /usr/lib/android-sdk/platform-tools/mke2fs failed with status 1 fastboot: error: Cannot generate image for cache ```
Yep. The explanation of why this is not easy to fix can be found at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928551#75 Given Debian's strong policy about using dynamic libraries everywhere, with no exception (an opinion for which I strongly disagree, but oh well, I don't make the rules), there's no way I can drag in libsparse as a dependency without bloating anything that requries e2fsprogs. Say, like the installer given that ext4 is still default file system for Debian. What is needed is to implement something like how libss (used by debufs) will try to look for one of the following shared libraries: #define DEFAULT_LIBPATH "libreadline.so.8:libreadline.so.7:libreadline.so.6:libreadline.so.5:libreadline.so.4:libreadline.so:libedit.so.2:libedit.so:libeditline.so.0:libeditline.so" ... and if present, it will dlopen it and use it. But if it is not present, it will return EXT2_ET_UNIMPLEMENTED. The implementation of this logic is in lib/et/get_readline.c in the e2fsprogs sources. We need to do something similar in lib/ext2fs/sparse_io.c. However, this is not high on my priority list to work upon, because there is a much simpler workaround --- just download the Android SDK from Google. :-) That being said, patches are greatefully accepted, so if you're interested in fixing this, please send patches, either attached to Debian bug #928551, or to the upstream development list: linux-ext4@vger.kernel.org Regards, - Ted