RSS Bot Posted March 10, 2024 Posted March 10, 2024 Description When trying to build an image with FIXED_IMAGE_SIZE=3000 ROOTFS_TYPE=f2fs with WSL2 as build host, I stumbled on an error pretty late in the build process when trying to mount the rootfs: [π²|πΏ] Creating rootfs [ f2fs on /dev/loop2p2 ] [π²|π¨] [π²|π¨] F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-08-24) [π²|π¨] [π²|π¨] Info: Disable heap-based policy [π²|π¨] Info: Debug level = 0 [π²|π¨] Info: Label = armbi_root [π²|π¨] Info: Trim is enabled [π²|π¨] Info: Segments per section = 1 [π²|π¨] Info: Sections per zone = 1 [π²|π¨] Info: sector size = 512 [π²|π¨] Info: total sectors = 5586911 (2727 MB) [π²|π¨] Info: zone aligned segment0 blkaddr: 512 [π²|π¨] Info: format version with [π²|π¨] "Linux version 6.1.21.2-microsoft-standard-WSL2+ (flash@DESKTOP-2VA4T55) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1 SMP Wed Jan 31 20:29:07 CET 2024" [π²|π¨] Info: [/dev/loop2p2] Discarding device [π²|π¨] Info: This device doesn't support BLKSECDISCARD [π²|π¨] Info: Discarded 2727 MB [π²|π¨] Info: Overprovision ratio = 3.860% [π²|π¨] Info: Overprovision segments = 108 (GC reserved = 59) [π²|π¨] Info: format successful [π²|πΏ] Mounting rootfs [ /dev/loop2p2 (UUID=02dfb13e-172d-44b1-b71c-25164f29cc0b) ] [π²|π¨] mount: /home/user/build-fork/.tmp/mount-bfedd4e1-02f1-4bac-99c1-88d420d40809: unknown filesystem type 'f2fs'. [π²|π₯] Error 32 occurred in main shell [ at /home/flash/build-fork/lib/functions/logging/runners.sh:211 run_host_command_logged_raw() --> lib/functions/logging/runners.sh:211 run_host_command_logged() --> lib/functions/logging/runners.sh:193 prepare_partitions() --> lib/functions/image/partitioning.sh:275 do_with_logging() --> lib/functions/logging/section-logging.sh:81 build_rootfs_and_image() --> lib/functions/main/rootfs-image.sh:86 full_build_packages_rootfs_and_image() --> lib/functions/main/default-build.sh:36 do_with_default_build() --> lib/functions/main/default-build.sh:42 cli_standard_build_run() --> lib/functions/cli/cli-build.sh:25 armbian_cli_run_command() --> lib/functions/cli/utils-cli.sh:136 cli_entrypoint() --> lib/functions/cli/entrypoint.sh:176 main() --> compile.sh:50 ] [π²|π₯] Cleaning up [ please wait for cleanups to finish ] I found out that this is because the WSL2 kernel does not have support for the F2FS filesystem. f2fs-tools could be installed normally though. To make the build script exit at the beginning instead of at a late stage and to tell the user a more exact reason why it failed, I added a check if the chosen ROOTFS_TYPE is supported by the host the build script is running on. The check checks /proc/filesystems which should be present in all Linux distros. But just in case /proc/filesystems is not present, the build won't fail and instead print a warning that the build might fail just like if it can't install python2. How Has This Been Tested? Build host: Linux version 6.1.21.2-microsoft-standard-WSL2+ (no F2FS support, but BTRFS and EXT4 support) Command: ./compile.sh build BOARD=nanopi-r5c BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no RELEASE=bookworm FIXED_IMAGE_SIZE=3000 ROOTFS_TYPE=f2fs [x] Ran build with FIXED_IMAGE_SIZE=3000 ROOTFS_TYPE=f2fs --> build exits at an early stage with [π²|π₯] error! [ Filesystem type unsupported by build host: f2fs ] [x] Ran build with ROOTFS_TYPE=btrfs --> build success [x] Ran build without ROOTFS_TYPE option --> build success Might need some testing with other more exotic build hosts like Docker. Checklist: [x] My code follows the style guidelines of this project [x] I have performed a self-review of my own code [x] I have commented my code, particularly in hard-to-understand areas [ ] I have made corresponding changes to the documentation [x] My changes generate no new warnings View the full article
Recommended Posts