Dmesg/mtdblock is giving me warnings about several MTD devices that are NAND flash that should be UBI block devices. How can I fix this?

Title largely sums it up. To be honest im a bit confused on how exactly NAND Flash, MTD devices, UBI devices, ubi block devices, and the squashfs image containing the filesystem are supposed to be related to each other, so its possible nothing is actually wrong here.

At any rate, here are the dmesg warnings:

[   91.490635] mtdblock: MTD device 'kernel' is NAND, please consider using UBI block devices instead.
[   91.540622] mtdblock: MTD device 'ART' is NAND, please consider using UBI block devices instead.
[   91.608488] mtdblock: MTD device 'u-boot' is NAND, please consider using UBI block devices instead.
[   91.644688] mtdblock: MTD device 'ubi' is NAND, please consider using UBI block devices instead.
[   91.676579] mtdblock: MTD device 'ART.bak' is NAND, please consider using UBI block devices instead.
[   91.699876] mtdblock: MTD device 'u-boot-env' is NAND, please consider using UBI block devices instead.
[   91.929478] mtdblock: MTD device 'reserve' is NAND, please consider using UBI block devices instead.

These occasionally (but not always) also show up on logread as kernel warnings.

The warning seem strange since the router already uses ubifs...in particular MTD device ubi doesnt seem right to be, since this is already used in device ubi0. This in turn contains volumes ubi0_0 and ubi0_1 and block device ubiblock0_0, which seems to be the ro squashfs rom image and the rw ubifs overlay.

What should I do to fix this? (I suspect the answer is likely "recompile the firmware with different config options", which is fine.) Is this something I should even worry about?

Thanks in advance.


Here is some additional info about the router.

Router: Netgear R9000

Kernel version: 5.15.40

Firmware: uses egorenar's openwrt fork. It is quite heavily customized (both via make menuconfig and make kernel_menuconfig).

Note: Looking over the kernel config, I noticed that both CONFIG_MTD_BLOCK and CONFIG_MTD_UBI_BLOCK were active. Any chance this is causing these warnings?

MTD/UBI config options used when building the firmware

Note: only enabled configuration options that relate to MTD or UBI are are shown. Other than the 2 CONFIG_PACKAGE_kmod, these are all in kernel config.

CONFIG_PACKAGE_kmod-block2mtd=y
CONFIG_PACKAGE_kmod-mtd-rw=y
CONFIG_CMDLINE="console=ttyS0,115200 pci=pcie_bus_perf ubi.mtd=ubi earlycon"
CONFIG_MTD=y
CONFIG_MTD_ROOTFS_ROOT_DEV=y
CONFIG_MTD_SPLIT=y
CONFIG_MTD_SPLIT_SUPPORT=y
CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_OF_PARTS=y
CONFIG_MTD_AFS_PARTS=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_NAND_CORE=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_NAND_AL=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_FASTMAP=y
CONFIG_MTD_UBI_BLOCK=y
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ZSTD=y
CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_AUTHENTICATION=y
CONFIG_CRAMFS_MTD=y
output of `ubinfo -a`
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:126
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     3716 (471842816 bytes, 449.9 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  80
Current maximum erase counter value:     3
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        408 LEBs (51806208 bytes, 49.4 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        3222 LEBs (409116672 bytes, 390.1 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
output of `mtdinfo -a -u`
Count of MTD devices:           7
Present MTD devices:            mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6
Sysfs interface supported:      yes

mtd0
Name:                           u-boot
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          15 (1966080 bytes, 1.8 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:0
Bad blocks are allowed:         true
Device is writable:             false
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

mtd1
Name:                           u-boot-env
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          9 (1179648 bytes, 1.1 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:2
Bad blocks are allowed:         true
Device is writable:             false
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

mtd2
Name:                           ART
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          10 (1310720 bytes, 1.2 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:4
Bad blocks are allowed:         true
Device is writable:             false
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

mtd3
Name:                           ART.bak
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          10 (1310720 bytes, 1.2 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:6
Bad blocks are allowed:         true
Device is writable:             false
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

mtd4
Name:                           kernel
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          256 (33554432 bytes, 32.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:8
Bad blocks are allowed:         true
Device is writable:             true
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

mtd5
Name:                           ubi
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          3716 (487063552 bytes, 464.5 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:10
Bad blocks are allowed:         true
Device is writable:             true
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

mtd6
Name:                           reserve
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          80 (10485760 bytes, 10.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       128 bytes
Character device major/minor:   90:12
Bad blocks are allowed:         true
Device is writable:             false
Default UBI VID header offset:  2048
Default UBI data offset:        4096
Default UBI LEB size:           126976 bytes, 124.0 KiB
Maximum UBI volumes count:      128

Those are the remnants of the vendor partitioning, you can't change that (without breaking everything or replacing the u-boot and coming up with your own flash partitioning (don't, just don't)).

1 Like

they are also read only and they are flashed only one time from the oem soooo...
I should just backport a fixup that mute the warning on read only partition :smiley:

1 Like