• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: problems enabling UBIFS on NAND  (Read 4799 times)
olivine
Newbie
*

Karma: 0
Posts: 5


View Profile
« on: February 13, 2010, 07:34:17 AM »

This is my first post here. I have only limited experience with devices like the sheevaplug, but hopefully my explanations will make sense.

I first followed the 'Installing Debian to Flash' howto:
http://plugcomputer.org/plugwiki/index.php/Installing_Debian_To_Flash
I installed debian on a USB-key, and later got stuck at the ubimkvol command when trying to convert the internal flash tu ubifs:
Code:
ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 517386240
[10341.904532] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
[10341.913664] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 0
[10341.923269] UBI: try another PEB
[10341.926701] UBI: run torture test for PEB 0
[10341.931504] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4055:512, written 0 bytes
[10341.940874] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 4055
[10341.976543] UBI: try another PEB
[10342.147505] UBI: PEB 0 passed torture test, do not mark it a bad
[10342.155682] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4054:512, written 0 bytes
[10342.165058] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 4054
[10342.175067] UBI: run torture test for PEB 4055
[10342.196798] UBI: try another PEB
[10342.376145] UBI: PEB 4055 passed torture test, do not mark it a bad
[10342.384607] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
[10342.393726] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 0
[10342.403170] UBI: run torture test for PEB 4054
[10342.419413] UBI warning: ubi_ro_mode: switch to read-only mode
[10342.436434] UBI error: ubi_create_volume: cannot create volume 0, error -30
ubimkvol: error!: cannot UBI create volume
          error 30 (Read-only file system)

My problem seems very similar to this thread: http://plugcomputer.org/plugforum/index.php?topic=1279.msg8119#msg8119
I followed pingtoo's advice, and went along this howto: http://www.plugcomputer.org/plugwiki/index.php/Enabling_UBIFS
My system is on a USB-key. I plugged the key into my laptop, and made the ubi.img file this way:

sudo mkfs.ubifs -r /mnt/sheeva/ -m 2048 -e 129024 -c 4096 -o ubifs.img
sudo ubinize -v -o ubi.img -m 2048 -p 128KiB -s 512 ubi.cfg

I copied ubi.img (242MB) back to the USB-key, rebooted the sheevaplug with it, and went along:

Code:
ubiformat /dev/mtd2 -s 512 -f ubi.img

ubiformat: mtd2 (nand), size 531628032 bytes (507.0 MiB), 4056 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4055 -- 100 % complete 
ubiformat: 4052 eraseblocks have valid erase counter, mean value is 5
ubiformat: 2 eraseblocks are supposedly empty
ubiformat: bad eraseblocks: 1075, 2684
ubiformat: flashing eraseblock 449 -- 22 % complete  ubiformat: error!: bad UBI magic 0x5744444e, should be 0x55424923
ubiformat: error!: bad EC header at eraseblock 449 of "/home/shami/ubi/ubi.img"

I tried the procedure twice, with similar errors. Did I misunderstand how to  create ubi.img on another pc? Is there a proper way?
Thanks in advance for any help.
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #1 on: February 13, 2010, 08:26:06 AM »

Never have this problem before. then again I am not a regular user of mtd-utils.

What is your mtd-utils version? may be this version have some bugs. the error message you encounter seems to indicate during scan ubiformat did not find the bad block but when it try to write it can not successful write ubi.img in. Another possibility is the ubi.img on your SD is corrupted, can you verify that?
Logged

Good Luck Smiley

olivine
Newbie
*

Karma: 0
Posts: 5


View Profile
« Reply #2 on: February 13, 2010, 09:01:10 AM »

I haven't used an SD card. To make the ubi.img file, I plugged my USB-key on a laptop with an up-to-date karmic system. I later rebooted the plug with the USB-key with 2.6.32-trunk-kirkwood, with a copy of ubi.img . On both systems, I have mtd-utils 20090606-1.

How can I check if the ubi.img is corrupted?

I am thinking about trying with an SD card, so I can do the whole procedure on the plug.
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #3 on: February 13, 2010, 10:49:44 AM »

I haven't used an SD card. To make the ubi.img file, I plugged my USB-key on a laptop with an up-to-date karmic system. I later rebooted the plug with the USB-key with 2.6.32-trunk-kirkwood, with a copy of ubi.img . On both systems, I have mtd-utils 20090606-1.

How can I check if the ubi.img is corrupted?

I am thinking about trying with an SD card, so I can do the whole procedure on the plug.
you don't need SD card, it is my mistake I thought you were on SD card.

I am not sure about the 20090606 version. I am on Gentoo system my version is 20090630. Are you familiar with re-build the mtd-utils from source code? I suggest you get more recent version and give it a try.   

Edit, forgot about the question about how to check corruption. You can use md5sum at both source and destination to see if the check sum match.
« Last Edit: February 13, 2010, 11:01:59 AM by pingtoo » Logged

Good Luck Smiley

olivine
Newbie
*

Karma: 0
Posts: 5


View Profile
« Reply #4 on: February 14, 2010, 01:38:28 PM »

duh! You were right, the md5sums did not match. That'll teach me not to check large files when I copy them (especially on USB keys).

Now ubiformat works, but it fails when I try to ubiattach it. The problem looks very similar  to this thread:
http://plugcomputer.org/plugforum/index.php?topic=1279.15
Same ubimkvol error initially, similar ubiattach errors. Apparently the same kernel. At some point, I may try to rebuild the kernel as suggested, but not in the short term...

thanks for your precious help, pingtoo.

Logged

diefrisur
Newbie
*

Karma: 0
Posts: 11


View Profile
« Reply #5 on: February 17, 2010, 06:10:00 AM »

I hope to update the kernel to the most recent version maybe tonight or tomorrow using http://plugcomputer.org/plugforum/index.php?topic=1316.0 and let you know if this solves the problem.
Logged

dodiak
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #6 on: February 19, 2010, 03:41:48 AM »

I hope to update the kernel to the most recent version maybe tonight or tomorrow using http://plugcomputer.org/plugforum/index.php?topic=1316.0 and let you know if this solves the problem.

O.K. I played a bit with it and finally it started to work. On 2 different SheevaPlug. (1 of them with bad block during the formating).
The trick was to ignore (and do not even try) ubiattach after flashing new UBI immage on the NAND. I just run: <br>
ubiformat /dev/mtd2 -s 512 -f /tmp/ubi.img
<br>
and the restarted the SheevaPlug with rootfs from nand. In one case the fsck was automatically started to fix some problems, in second case it was running straightforward.
So I have finally 2 SheevaPlugs with Debian running.

There are still some minor issues, but it WORKS.

BTW, after first reboot (and very likely some fixes of FS) of Sheeva NAND  system I was able to attach and mount UBIFS when I booted from USB again (still ro only). So I have feeling there are some issues with mkfs.ubifs or ubinize ....
Logged

diefrisur
Newbie
*

Karma: 0
Posts: 11


View Profile
« Reply #7 on: February 20, 2010, 04:20:38 PM »

After updating the kernel I got UBIFS working as well. Pls see here: http://plugcomputer.org/plugforum/index.php?topic=1279.msg8411#msg8411
Logged

Pages: [1]
Print
Jump to: