Files are not displayed by “ls” command

Hi,

After storing the “setting.json” file in the “data” directory created under “/home”, the “ls -la” command did not display the “setting.json” file.The following is the result of the “dmesg” command when the “ls -la” command was executed.
What is the status of the “data” directory and the files inside it from the result of the “dmesg” command?
Also, what are the conditions for this state?

▼The following is the result of executing the “ls -la . /data” command. Before this problem occurred, “setting.json” was displayed. But after the problem occurred, only hidden files are displayed.
ls -la ./data
drwxrwx— 2 root root 904 Jan 1 09:16 .
drwxrwx— 6 root root 416 Jan 1 09:17 ..

▼The attributes of the “data” directory after this problem occurred were unchanged from before this problem occurred.
drwxrwx— 2 root root 904 Jan 1 09:16 data

▼The following is the result of executing the “ls -la” command with the file specified. In this case, “setting.json” is displayed.
ls -la ./data/setting.json
-rwxrwx— 1 root root 149 Jan 1 09:03 ./data/setting.json

▼The following is the result of the “dmesg” command.
[ 614.088563] UBIFS error (ubi3:0 pid 2600): ubifs_read_node: bad node type (1 but expected 2)
[ 614.088602] UBIFS error (ubi3:0 pid 2600): ubifs_read_node: bad node at LEB 252:73728, LEB mapping status 1
[ 614.088617] magic 0x6101831
[ 614.088629] crc 0x3308e309
[ 614.088642] node_type 1 (data node)
[ 614.088656] group_type 0 (no node group)
[ 614.088670] sqnum 354287548
[ 614.088681] len 1510
[ 614.088699] key (11890115, data, 207)
[ 614.088711] size 4096
[ 614.088723] compr_typ 1
[ 614.088734] data size 1462
[ 614.088744] data:
[ 614.088765] 00000000: 00 63 50 53 4f 76 34 0a 4a 61 6e 20 31 36 20 31 39 3a 34 39 3a 34 00 00 00 00 00 00 00 00 00 00
[ 614.088781] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc c4 e7 c0 3c c5 e7 c0
[ 614.088796] 00000040: f4 d2 e7 c0 74 7a 0b ce 5c 68 03 c0 00 00 00 00 80 74 29 cd 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.088811] 00000060: 00 00 00 00 00 00 00 00 00 e0 01 00 18 a0 01 00 22 00 00 00 0a 00 00 00 0d 00 00 00 00 00 00 00
[ 614.088827] 00000080: 00 00 00 00 28 b5 03 00 01 00 00 00 0b 00 00 00 dc 00 00 00 00 00 00 00 00 00 00 00 20 c1 03 00
[ 614.088842] 000000a0: 01 00 00 00 0c 00 00 00 db 00 00 00 00 00 00 00 00 00 00 00 18 c1 03 00 01 00 00 00 0d 00 00 00
[ 614.088857] 000000c0: de 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 79 0b ce 01 00 00 00 ad 4e ad de ff ff ff ff
[ 614.088872] 000000e0: ff ff ff ff 14 75 0b ce 14 75 0b ce 00 00 00 00 00 00 00 00 00 75 0b ce 01 00 00 00 ad 4e ad de
[ 614.088888] 00000100: ff ff ff ff ff ff ff ff 38 75 0b ce 38 75 0b ce 00 00 00 00 02 00 00 00 10 00 00 00 00 00 00 00
[ 614.088903] 00000120: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 80 f8 e8 cf 00 00 00 00 00 00 00 00
[ 614.088919] 00000140: 00 d0 13 cd fc c4 e7 c0 00 00 00 00 00 00 00 00 00 00 00 00 ed 41 00 00 00 00 00 00 00 00 00 00
[ 614.088935] 00000160: 00 00 00 00 00 00 00 00 0e 00 00 00 7b af 2a 23 04 01 00 00 1d 33 02 3b 04 01 00 00 1d 33 02 3b
[ 614.088951] 00000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0 75 0b ce c0 75 0b ce 01 00 00 00 ad 4e ad de
[ 614.088966] 000001a0: ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.088982] 000001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff a1 00 00 00 00 00 00 00 00 00 00
[ 614.088996] 000001e0: 00 00 00 00 00 00 00 00 0e 00 00 00 7b af 2a 23 0e 00 00 00 7b af 2a 23 0e 00 00 00 7b af 2a 23
[ 614.089012] 00000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 76 0b ce 40 76 0b ce 01 00 00 00 ad 4e ad de
[ 614.089027] 00000220: ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089042] 00000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 81 00 00 00 00 00 00 00 00 00 00
[ 614.089057] 00000260: 00 00 00 00 00 00 00 00 0e 00 00 00 7b af 2a 23 0e 00 00 00 7b af 2a 23 0e 00 00 00 7b af 2a 23
[ 614.089073] 00000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0 76 0b ce c0 76 0b ce 01 00 00 00 ad 4e ad de
[ 614.089088] 000002a0: ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089103] 000002c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b4 81 00 00 00 00 00 00 00 00 00 00
[ 614.089118] 000002e0: 00 00 00 00 00 00 00 00 10 00 00 00 fa da 7d 2e 10 00 00 00 fa da 7d 2e 10 00 00 00 fa da 7d 2e
[ 614.089134] 00000300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 77 0b ce 40 77 0b ce 01 00 00 00 ad 4e ad de
[ 614.089149] 00000320: ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089165] 00000340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 7e 0b ce 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089180] 00000360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089196] 00000380: ff ff ff ff 3f 00 00 00 ff ff ff ff 3f 00 00 00 ff ff ff ff 3f 00 00 00 00 00 00 00 00 00 00 00
[ 614.089212] 000003a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc c4 e7 c0 3c c5 e7 c0
[ 614.089227] 000003c0: f4 d2 e7 c0 f4 7c 0b ce 5c 68 03 c0 00 00 00 00 80 7c 0b ce 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089242] 000003e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089257] 00000400: ff ff ff ff 3f 00 00 00 ff ff ff ff 3f 00 00 00 ff ff ff ff 3f 00 00 00 00 00 00 00 00 00 00 00
[ 614.089272] 00000420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc c4 e7 c0 3c c5 e7 c0
[ 614.089288] 00000440: f4 d2 e7 c0 74 74 0b ce 5c 68 03 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089303] 00000460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 614.089319] 00000480: ff ff ff ff 3f 00 00 00 ff ff ff ff 3f 00 00 00 ff ff ff ff 3f 00 00 00 00 00 00 00 00 00 00 00
[ 614.089334] 000004a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc c4 e7 c0 3c c5 e7 c0
[ 614.089350] 000004c0: f4 d2 e7 c0 00 04 14 cd 5c 68 03 c0 00 00 00 00 00 d0 34 ce 00 00 00 00 00 00 00 00 03 00 00 00
[ 614.089365] 000004e0: 00 00 00 00 17 00 00 00 00 00 00 00 80 bb 03 00 00 00 00 00 66 00 00 00 f0 72 0b ce 40 79 0b ce
[ 614.089380] 00000500: 00 00 00 00 28 c3 03 00 00 00 00 00 67 00 00 00 28 79 0b ce f0 b6 ba cd 00 00 00 00 40 bd 03 00
[ 614.089395] 00000520: 00 00 00 00 68 00 00 00 28 7c 26 ce 70 41 13 ce 00 00 00 00 20 cd 03 00 01 00 00 00 69 00 00 00
[ 614.089411] 00000540: 08 00 00 00 00 00 00 00 5c 68 03 c0 00 00 00 00 00 71 0b ce 01 00 00 00 ad 4e ad de ff ff ff ff
[ 614.089427] 00000560: ff ff ff ff 94 79 0b ce 94 79 0b ce 00 00 00 00 00 00 00 00 80 79 0b ce 01 00 00 00 ad 4e ad de
[ 614.089443] 00000580: ff ff ff ff ff ff ff ff b8 79 0b ce b8 79 0b ce 00 00 00 00 02 00 00 00 10 00 00 00 00 00 00 00
[ 614.089458] 000005a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 40 06
[ 614.089480] CPU: 0 PID: 2600 Comm: ls Not tainted 3.18.131 #1
[ 614.089552] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 614.089586] [] (show_stack) from [] (ubifs_read_node+0x25c/0x338)
[ 614.089617] [] (ubifs_read_node) from [] (ubifs_tnc_read_node+0xd0/0x1f0)
[ 614.089643] [] (ubifs_tnc_read_node) from [] (tnc_read_node_nm+0x1b8/0x1e8)
[ 614.089669] [] (tnc_read_node_nm) from [] (ubifs_tnc_next_ent+0x22c/0x28c)
[ 614.089696] [] (ubifs_tnc_next_ent) from [] (ubifs_readdir+0x224/0x4ec)
[ 614.089725] [] (ubifs_readdir) from [] (iterate_dir+0x78/0xfc)
[ 614.089753] [] (iterate_dir) from [] (SyS_getdents64+0x7c/0x100)
[ 614.089778] [] (SyS_getdents64) from [] (ret_fast_syscall+0x0/0x44)
[ 614.089801] UBIFS error (ubi3:0 pid 2600): ubifs_readdir: cannot find next direntry, error -22

Best regards

how about a simple text file?
Can you display it?

Hi jyijyi,
I was able to create a simple file and display its contents.
However, this file was not displayed using the “ls -la” command.

▼The following is the result of writing “abcde” using “vi ./data/simple_file” and displaying simple_file.
vi ./data/simple_file
cat ./data/simple_file
abcde
ls -la ./data
drwxrwx— 2 root root 976 Jan 1 09:05 .
drwxrwx— 6 root root 416 Jan 1 09:17 ..

I download the following setting.json to /home/root/data folder:

I don’t see such problem:

root@swi-mdm9x28-wp:~# ls -la /home/root/data/
drwxr-xr-x    2 root     root           232 Jan  6 08:03 .
drwxr-xr-x    4 root     root           520 Jan  6 08:03 ..
-rw-r--r--    1 root     root         18961 Jun 23  2025 settings.json

Is there anything that can be learned from dmseg?
Also, are there any other logs that should be obtained?

i think you need to first find a way to reproduce the issue.
For example, is this only happening to your setting.json?
How about above setting.json?

What if you do a cleaning of userapp partition?

I would like to find a way to reproduce this if possible, but because of the following, it is difficult to create a reproduction environment as it is expected to be a probabilistic issue.

  • The setting.json file is copied only once at the time of shipment.
  • In addition to setting.json, the service.json file is also copied at the time of shipment, but the same result has occurred.
  • This issue occurred in one out of several thousand products equipped with Legato on the market.

As we only have one sample, I would like to try to recover this environment as a last resort.

First of all, could you tell me the content of the following message?

[ 614.088563] UBIFS error (ubi3:0 pid 2600): ubifs_read_node: bad node type (1 but expected 2)
[ 614.088602] UBIFS error (ubi3:0 pid 2600): ubifs_read_node: bad node at LEB 252:73728, LEB mapping status 1

i guess there is some flash partition corruption
But without reproducible steps or further testing, it is hard to conclude…

Since there are still devices on which the issue occurs, is there any way to approach diagnosing “flash partition corruption”?

i have asked the AI, it gave the following suggestion:

Error Analysis
The error message indicates issues with reading nodes from the UBIFS file system:

[ 614.088563] UBIFS error (ubi3:0 pid 2600): ubifs_read_node: bad node type (1 but expected 2)
[ 614.088602] UBIFS error (ubi3:0 pid 2600): ubifs_read_node: bad node at LEB 252:73728, LEB mapping status 1
[ 614.088617] magic 0x6101831
[ 614.088629] crc 0x3308e309
[ 614.088642] node_type 1 (data node)
[ 614.088656] group_type 0 (no node group)
[ 614.088670] sqnum 354287548
[ 614.088681] len 1510
[ 614.088699] key (11890115, data, 207)
[ 614.088711] size 4096
[ 614.088723] compr_typ 1
[ 614.088734] data size 1462


Key Points from the Error Log
Bad Node Type: The node type read is 1 (data node) but expected 2 (likely a different type of node).
Bad Node Location: The error occurs at Logical Erase Block (LEB) 252, offset 73728.
Node Details: The node has a magic number 0x6101831, CRC 0x3308e309, and various other attributes.



Potential Causes
Power Failures: Sudden power cuts can corrupt the UBIFS partition, especially during write operations
Firmware Bugs: Bugs in the firmware can lead to improper handling of flash writes and cause corruption 
Hardware Issues: Problems with the NAND flash hardware, such as bad blocks or wear-out, can result in read/write errors 


Diagnostic Steps
Check for Power Failures: Ensure that the device is not experiencing sudden power cuts. Implement power-fail-safe mechanisms if necessary.
Firmware Update: Verify that the firmware is up-to-date and includes fixes for known UBIFS issues. Consider updating to the latest stable release.
Bad Block Management: Use tools like nandtest to check for bad blocks and manage them appropriately
UBIFS Recovery: Attempt to recover the UBIFS partition using tools like ubiformat and ubiattach



Example Recovery Commands


# Attach the UBI device
ubiattach /dev/ubi_ctrl -m 0

# Format the UBI device
ubiformat /dev/mtd0 -y

# Create a new UBI volume
ubimkvol /dev/ubi0 -N rootfs -s 512MiB

# Mount the UBIFS file system
mount -t ubifs ubi0:rootfs /mnt/flash