read error: input/output error trying to read mtdblocks

msxer

Young grasshopper
Joined
Jan 18, 2016
Messages
40
Reaction score
2
Location
netherlands
Still playing around with some bricked hikvision cams in order te get them working again.

Got a camera working again and wanted to copy the mtdblocks as a backup.

Got a problem with reading/copying mtdblock17.

Get the message 'read error: input/output error'

cat /proc/kmsg reveals some bad blocks in the flash memory, but all mtdblocks are created



<6>[ 0.534578] NAND device: Manufacturer ID: 0xc2, Chip ID: 0xf1 (MXIC NAND1 28MiB 3,3V 8-bit)
<4>[ 0.534624] ambarella_nand_config_flash: 0x02e00140, 0x02c00140
<7>[ 0.535052] Bad block table found at page 65472, version 0x01
<7>[ 0.535576] Bad block table found at page 65408, version 0x01
<7>[ 0.535897] nand_read_bbt: Bad block at 0x0000063c0000
<6>[ 0.541522] ambarella-nand ambarella-nand: ambarella_nand_probe: Partition infomation found!
<5>[ 0.541586] Creating 18 MTD partitions on "ambnand":
<5>[ 0.541624] 0x000000000000-0x000000020000 : "bst"
<5>[ 0.545835] 0x000000020000-0x000000120000 : "ptb"
<5>[ 0.549645] 0x000000120000-0x000000220000 : "bld"
<5>[ 0.553728] 0x000000220000-0x000000320000 : "hal"
<5>[ 0.557638] 0x000000320000-0x000000420000 : "ano_ptb"
<5>[ 0.561554] 0x000000420000-0x0000004a0000 : "env"
<5>[ 0.565851] 0x0000004a0000-0x000000520000 : "param"
<5>[ 0.569883] 0x000000520000-0x000000620000 : "dpt"
<5>[ 0.574226] 0x000000620000-0x000001020000 : "rcvy"
<5>[ 0.578442] 0x000001020000-0x000001820000 : "krn_pri"
<5>[ 0.582349] 0x000001820000-0x000002020000 : "krn_sec"
<5>[ 0.586591] 0x000002020000-0x000002420000 : "rmd_pri"
<5>[ 0.590585] 0x000002420000-0x000002820000 : "rmd_sec"
<5>[ 0.594914] 0x000002820000-0x000004020000 : "app_pri"
<5>[ 0.599054] 0x000004020000-0x000005820000 : "app_sec"
<5>[ 0.603519] 0x000005820000-0x000005c20000 : "cfg_pri"
<5>[ 0.607674] 0x000005c20000-0x000006020000 : "cfg_sec"
<5>[ 0.611987] 0x000006020000-0x000007020000 : "dbg"


But I can't copy the mtdblock17 from the camera to make a backup.
Gives a read error everytime.

Saving a working mtdblock17 from another cam doesn't give an error, but trying to read after writing still does.

Strangly camera seems to be working Ok.

Is there a way to 'repair' the flash memory and/or avoid it using the bad blocks ?

Something like diskrepair in windows maybe ?
 
Last edited by a moderator:

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,977
Reaction score
6,801
Location
Scotland
Is there a way to 'repair' the flash memory and/or avoid it using the bad blocks ?
What you are seeing is perfectly normal, and not a problem.
Bad blocks are pretty common - and just as in a HDD, are mapped out to the bad block tables, as is shown in your log above, and automatically avoided when using the mtdblock or UBIFs driver.

But I can't copy the mtdblock17 from the camera to make a backup.
By default it is locked for exclusive access by the debug process.
Best just left alone.
 

msxer

Young grasshopper
Joined
Jan 18, 2016
Messages
40
Reaction score
2
Location
netherlands
That's good to hear :)


Didn't have any problem before to copy the full set of mtdblocks of a 2332 and a 2432.

Just ran in to this by trying to backup mtdblock17 from a 2132.

Just tried the other two 2132's I've bought.

They do let me copy the mtdblock17, but give read errors on other mtdblocks.

One gives a read error on mtdblock9, the other on mtdblock 9 and 10.

Mhmm, strange coincidence or something related to the 2132 maybe ?
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,977
Reaction score
6,801
Location
Scotland
They do let me copy the mtdblock17, but give read errors on other mtdblocks.
I suspect, but don't know for sure, that when the 'system processes' have these devices open, what happens when you also have them open varies with what's happening at the time.
If you try the same one repeatably, you may find the resultant file size varies sometimes, for example.
Also, try the 'ro' access, you will get better results.
Code:
login as: root
[EMAIL="root@192.168.254.11's"]root@192.168.254.11's[/EMAIL] password:

BusyBox v1.19.3 (2014-07-11 11:25:54 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ls -ial /dev/mt*ro*
   1032 crw-rw----    1 root     root       90,   1 Feb  5 15:07 /dev/mtd0ro
   1047 crw-rw----    1 root     root       90,  21 Feb  5 15:07 /dev/mtd10ro
   1057 crw-rw----    1 root     root       90,  23 Feb  5 15:07 /dev/mtd11ro
   1067 crw-rw----    1 root     root       90,  25 Feb  5 15:07 /dev/mtd12ro
   1077 crw-rw----    1 root     root       90,  27 Feb  5 15:07 /dev/mtd13ro
   1087 crw-rw----    1 root     root       90,  29 Feb  5 15:07 /dev/mtd14ro
   1097 crw-rw----    1 root     root       90,  31 Feb  5 15:07 /dev/mtd15ro
   1107 crw-rw----    1 root     root       90,  33 Feb  5 15:07 /dev/mtd16ro
   1117 crw-rw----    1 root     root       90,  35 Feb  5 15:07 /dev/mtd17ro
   1122 crw-rw----    1 root     root       90,   3 Feb  5 15:07 /dev/mtd1ro
   1132 crw-rw----    1 root     root       90,   5 Feb  5 15:07 /dev/mtd2ro
   1142 crw-rw----    1 root     root       90,   7 Feb  5 15:07 /dev/mtd3ro
   1152 crw-rw----    1 root     root       90,   9 Feb  5 15:07 /dev/mtd4ro
   1162 crw-rw----    1 root     root       90,  11 Feb  5 15:07 /dev/mtd5ro
   1172 crw-rw----    1 root     root       90,  13 Feb  5 15:07 /dev/mtd6ro
   1182 crw-rw----    1 root     root       90,  15 Feb  5 15:07 /dev/mtd7ro
   1192 crw-rw----    1 root     root       90,  17 Feb  5 15:07 /dev/mtd8ro
   1202 crw-rw----    1 root     root       90,  19 Feb  5 15:07 /dev/mtd9ro
#
 

msxer

Young grasshopper
Joined
Jan 18, 2016
Messages
40
Reaction score
2
Location
netherlands
So when the camera is using the mtdblock I'm trying to copy this may result in a read error.

Understood and added to the knowledge database !

Like the learning process in getting these camera's back in working condition.


Copying the mtd ro files worked for all of the three 2132's without any errors !

Are the mtd ro files somekind of backup of the mtdblocks ?

Or does the 'ro' refer to 'root' maybe ?
 
Last edited by a moderator:

msxer

Young grasshopper
Joined
Jan 18, 2016
Messages
40
Reaction score
2
Location
netherlands
Aha, Ok :)

Regarding my backup strategy for future problems I made the following preparations :

- keep a copy of the installed firmware together with the TFTP updater used
- made a backup of the 18 mtdblock(mtd-ro) files

I think this should be sufficient.

Or is there something else worth saving ?
 
Top