Skip to contentSkip to conversation

UBIFS Problems After Upgrading Kernel

DISCUSSION Paul Black 2 participants 3 messages Apr 12, 2013 – Apr 16, 2013 Memory technology devices (MTD)

lore
Share & tools
lore

Paul Black

author
#0 lore raw

I'm looking at upgrading the kernel on an embedded product we have from 2.6.36 to 3.4.x (currently testing with 3.4.39).

The device has UBIFS that is created on 2.6.30 running on the device itself with the following commands:
flash_eraseall /dev/mtd8
ubiformat -y /dev/mtd8 -s 512
ubiattach /dev/ubi_ctrl -m 8
ubimkvol /dev/ubi0 -N rootfs -m

(I'm not sure why there is the "-s 512" there but I'm sure there was a good reason at the time!).

The various UBI utilitites would appear to be v1.0.

The UBIFS generated in this way works fine under 2.6.36:

[    0.580000] NAND device: Manufacturer ID: 0xad, Chip ID: 0xda (Hynix
NAND 256MiB 3,3V 8-bit)
[    0.590000] AT91 NAND: 8-bit, Software ECC
[    0.600000] Scanning device for bad blocks
[    0.790000] 0x000000800000-0x000010000000 : "rootfs"
[    0.800000] UBI: attaching mtd8 to ubi0
[    0.800000] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[    0.810000] UBI: logical eraseblock size:    129024 bytes
[    0.810000] UBI: smallest flash I/O unit:    2048
[    0.820000] UBI: sub-page size:              512
[    0.820000] UBI: VID header offset:          512 (aligned 512)
[    0.830000] UBI: data offset:                2048
[    1.100000] UBI: max. sequence number:       675
[    1.120000] UBI: attached mtd8 to ubi0
[    1.130000] UBI: MTD device name:            "rootfs"
[    1.130000] UBI: MTD device size:            248 MiB
[    1.140000] UBI: number of good PEBs:        1984
[    1.140000] UBI: number of bad PEBs:         0
[    1.150000] UBI: max. allowed volumes:       128
[    1.150000] UBI: wear-leveling threshold:    4096
[    1.160000] UBI: number of internal volumes: 1
[    1.160000] UBI: number of user volumes:     1
[    1.160000] UBI: available PEBs:             0
[    1.170000] UBI: total number of reserved PEBs: 1984
[    1.170000] UBI: number of PEBs reserved for bad PEB handling: 19
[    1.180000] UBI: max/mean erase counter: 1/0
[    1.180000] UBI: image sequence number:  0
[    1.190000] UBI: background thread "ubi_bgt0d" started, PID 30
[    1.530000] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[    1.530000] UBIFS: file system size:   251467776 bytes (245574 KiB,
239 MiB, 1949 LEBs)
[    1.540000] UBIFS: journal size:       12644352 bytes (12348 KiB, 12
MiB, 98 LEBs)
[    1.550000] UBIFS: media format:       w4/r0 (latest is w4/r0)
[    1.560000] UBIFS: default compressor: lzo
[    1.560000] UBIFS: reserved for root:  4952683 bytes (4836 KiB)
[    1.570000] VFS: Mounted root (ubifs filesystem) on device 0:11.

However, after upgrading to 3.4.39, the root FS doesn't mount:

[    0.710000] atmel_nand: Use On Flash BBT
[    0.720000] atmel_nand atmel_nand: No DMA support for NAND access.
[    0.720000] NAND device: Manufacturer ID: 0xad, Chip ID: 0xda (Hynix
NAND 256MiB 3,3V 8-bit)
[    0.730000] Bad block table not found for chip 0
[    0.740000] Bad block table not found for chip 0
[    0.740000] Scanning device for bad blocks
[    0.870000] Bad block table written to 0x00000ffe0000, version 0x01
[    0.880000] Bad block table written to 0x00000ffc0000, version 0x01
[    0.960000] 0x000000800000-0x000010000000 : "rootfs"
[    0.970000] UBI: attaching mtd8 to ubi0
[    0.970000] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[    0.980000] UBI: logical eraseblock size:    129024 bytes
[    0.980000] UBI: smallest flash I/O unit:    2048
[    0.990000] UBI: sub-page size:              512
[    0.990000] UBI: VID header offset:          512 (aligned 512)
[    1.000000] UBI: data offset:                2048
[    1.280000] UBI: max. sequence number:       745
[    1.290000] UBI warning: print_rsvd_warning: cannot reserve enough
PEBs for bad PEB handling, reserved 15, need 19
[    1.310000] UBI: attached mtd8 to ubi0
[    1.310000] UBI: MTD device name:            "rootfs"
[    1.310000] UBI: MTD device size:            248 MiB
[    1.320000] UBI: number of good PEBs:        1980
[    1.320000] UBI: number of bad PEBs:         4
[    1.330000] UBI: number of corrupted PEBs:   0
[    1.330000] UBI: max. allowed volumes:       128
[    1.340000] UBI: wear-leveling threshold:    4096
[    1.340000] UBI: number of internal volumes: 1
[    1.350000] UBI: number of user volumes:     1
[    1.350000] UBI: available PEBs:             0
[    1.360000] UBI: total number of reserved PEBs: 1980
[    1.360000] UBI: number of PEBs reserved for bad PEB handling: 15
[    1.370000] UBI: max/mean erase counter: 1/0
[    1.370000] UBI: image sequence number:  0
[    1.380000] UBI: background thread "ubi_bgt0d" started, PID 799
[    1.650000] UBIFS error (pid 1): ubifs_read_node: bad node type (255
but expected 6)
[    1.660000] UBIFS error (pid 1): ubifs_read_node: bad node at LEB
0:0, LEB mapping status 0
[    1.660000] Not a node, first 24 bytes:
[    1.670000] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff                          ........................
[    1.680000] [<c000d2d0>] (unwind_backtrace+0x0/0xf0) from
[<c00ccdf4>] (ubifs_read_node+0x22c/0x2a4)
[    1.690000] [<c00ccdf4>] (ubifs_read_node+0x22c/0x2a4) from
[<c00c94b8>] (ubifs_read_sb_node+0x54/0x78)
[    1.700000] [<c00c94b8>] (ubifs_read_sb_node+0x54/0x78) from
[<c00ca1d0>] (ubifs_read_superblock+0xca4/0x1674)
[    1.710000] [<c00ca1d0>] (ubifs_read_superblock+0xca4/0x1674) from
[<c00c7e38>] (ubifs_mount+0x6dc/0x1b44)
[    1.720000] [<c00c7e38>] (ubifs_mount+0x6dc/0x1b44) from [<c00749ac>]
(mount_fs+0x14/0xcc)
[    1.730000] [<c00749ac>] (mount_fs+0x14/0xcc) from [<c00888b4>]
(vfs_kern_mount+0x4c/0xac)
[    1.740000] [<c00888b4>] (vfs_kern_mount+0x4c/0xac) from [<c0088b74>]
(do_kern_mount+0x34/0xd4)
[    1.740000] [<c0088b74>] (do_kern_mount+0x34/0xd4) from [<c008a324>]
(do_mount+0x3f8/0x6b4)
[    1.750000] [<c008a324>] (do_mount+0x3f8/0x6b4) from [<c008a66c>]
(sys_mount+0x84/0xc4)
[    1.760000] [<c008a66c>] (sys_mount+0x84/0xc4) from [<c0346ab4>]
(mount_block_root+0xf0/0x298)
[    1.770000] [<c0346ab4>] (mount_block_root+0xf0/0x298) from
[<c0346d4c>] (prepare_namespace+0x8c/0x174)
[    1.780000] [<c0346d4c>] (prepare_namespace+0x8c/0x174) from
[<c0346884>] (kernel_init+0x16c/0x1a8)
[    1.790000] [<c0346884>] (kernel_init+0x16c/0x1a8) from [<c0009c24>]

(kernel_thread_exit+0x0/0x8)

(This is with all the UBI/UBIFS debugging options turned on that I could find).

Is there a way that I can get the FS mounted under the later kernel?

Cheers.

Paul

#1 lore raw
Quoted 7 lines · Paul Black
[    1.650000] UBIFS error (pid 1): ubifs_read_node: bad node type (255
but expected 6)
[    1.660000] UBIFS error (pid 1): ubifs_read_node: bad node at LEB
0:0, LEB mapping status 0
[    1.660000] Not a node, first 24 bytes:
[    1.670000] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

ff ff ff ff ff ff ff ff

UBIFS says that the eraseblock where it expects to find the Master node is empty. Somehow the data is not there anymore. Can you compare the contents of the corresponding /dev/mtd and /dev/ubi* before and after upgrade?

Signature · 2 lines
Best Regards,
Artem Bityutskiy
author
#2 lore raw
Quoted 10 lines · Artem Bityutskiy
Quoted 7 lines · Paul Black
[    1.650000] UBIFS error (pid 1): ubifs_read_node: bad node type (255
but expected 6)
[    1.660000] UBIFS error (pid 1): ubifs_read_node: bad node at LEB
0:0, LEB mapping status 0
[    1.660000] Not a node, first 24 bytes:
[    1.670000] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

ff ff ff ff ff ff ff ff

Quoted 4 lines

UBIFS says that the eraseblock where it expects to find the Master node is empty. Somehow the data is not there anymore. Can you compare the contents of the corresponding /dev/mtd and /dev/ubi* before and after upgrade?

Thanks for the reply.

Got the following difference in the file systems before and after booting 3.4.40:
< 1737000000 U B I # 001 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 4255 2349 0001 0000 0000 0000 0000 0000
< 1737000020 \0 \0 002 \0 \0 \0 \b \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0002 0000 0008 0000 0000 0000 0000
< 1737000040 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0000 0000 0000 0000 0000 0000 0000
< 1737000060 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 N 204 I 204

<             0000    0000    0000    0000    0000    0000    844e    8449
< 1737000100  377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
<             ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff

< *
< 1737400000 U B I # 001 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 4255 2349 0001 0000 0000 0000 0000 0000
< 1737400020 \0 \0 002 \0 \0 \0 \b \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0002 0000 0008 0000 0000 0000 0000
< 1737400040 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0000 0000 0000 0000 0000 0000 0000
< 1737400060 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 N 204 I 204

<             0000    0000    0000    0000    0000    0000    844e    8449
< 1737400100  377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
<             ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff

< *
< 1737401000 U B I ! 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 4255 2149 0101 0000 0000 0000 0000 0000
< 1737401020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0000 0000 0000 0000 0000 0000 0000
< 1737401040 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 004
< 0000 0000 0000 0000 0000 0000 0000 0400
< 1737401060 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 263 \b 301 301
< 0000 0000 0000 0000 0000 0000 08b3 c1c1
< 1737401100 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0000 0000 0000 0000 0000 0000 0000
< *
< 1737402000 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
< ffff ffff ffff ffff ffff ffff ffff ffff
< *
< 1737404000 1 030 020 006 320 I y 335 001 \0 \0 \0 \0 \0 \0 \0
< 1831 0610 49d0 dd79 0001 0000 0000 0000
< 1737404020 \0 020 \0 \0 006 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 1000 0000 0006 0000 0000 0000 0000 0000
< 1737404040 \0 \b \0 \0 \0 370 001 \0 251 \a \0 \0 251 \a \0 \0

<             0800    0000    f800    0001    07a9    0000    07a9    0000
< 1737404060   \0     265  \0  \0  \0  \0  \0 006  \0  \0  \0 002  \0  \0  \0
<             2000    00b5    0000    0000    0006    0000    0002    0000
< 1737404100  001  \0  \0  \0 001  \0  \0  \0  \b  \0  \0  \0  \0 001  \0  \0
<             0001    0000    0001    0000    0008    0000    0100    0000
< 1737404120  004  \0  \0  \0 001  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
<             0004    0000    0001    0000    0000    0000    0000    0000
< 1737404140   \0  \0   P  \0  \0  \0  \0  \0  \0 312 232   ; 332   - 305 213
<             0000    0050    0000    0000    ca00    3b9a    2dda    8bc5
< 1737404160  251 373   F 332 213   3   $   h 376   ! 300   r  \0  \0  \0  \0
<             fba9    da46    338b    6824    21fe    72c0    0000    0000

< 1737404200 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
< 0000 0000 0000 0000 0000 0000 0000 0000
< *
< 1737414000 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
< ffff ffff ffff ffff ffff ffff ffff ffff
< *

During booting, this is printed out. The addresses shown above, with offsets accounted for and converted to octal, overlap with the addresses in the last two lines below.

[    0.720000] atmel_nand: Use On Flash BBT
[    0.720000] atmel_nand atmel_nand: No DMA support for NAND access.
[    0.730000] NAND device: Manufacturer ID: 0xad, Chip ID: 0xda
(Hynix NAND 256MiB 3,3V 8-bit)
[    0.740000] Bad block table not found for chip 0
[    0.740000] Bad block table not found for chip 0
[    0.750000] Scanning device for bad blocks
[    0.880000] Bad block table written to 0x00000ffe0000, version 0x01
[    0.890000] Bad block table written to 0x00000ffc0000, version 0x01

I've also noticed that I don't have the "Use On Flash BBT" on my working 2.6.36 kernels. Finding and disabling this in the files for my boards of interest produces a working 3.4.40 kernel.

Thanks for the pointers.

--
Paul