Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does ubiattach on a freshly formatted device fail with “Invalid argument”?

0
Posted

Why does ubiattach on a freshly formatted device fail with “Invalid argument”?

0

On NAND devices that support sub-page accesses, ubiformat may choose a different location for the VID header to the kernel UBI driver This can result in the following error when attaching to a UBI device: $ ubiformat /dev/mtd0 ubiformat: mtd0 (NAND), size 260046848 bytes (248.0 MiB), 131072 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes […] $ ubiattach /dev/ubi_ctrl -m 0 ubiattach: error!: cannot attach mtd0 error 22 (Invalid argument) and in dmesg you will see: UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512 UBI error: validate_ec_hdr: bad EC header UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0 This happens because ubiformat assumes the flash does not support sub-pages, because the kernel does not expose sub-page information to user-space (which should be fixed when sysfs support is added to MTD). However, the kernel UBI driver assumes sub-pages are supported and sub-page size is 512 bytes in our example. To fix this, you should o

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123