• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1] 2
Author Topic: ubimkvol fails  (Read 11269 times)
stevenm
Newbie
*

Karma: 0
Posts: 4


View Profile
« on: January 29, 2010, 12:55:23 PM »

I am following the instructions to install Debian to Flash and got as far as to set up the UBI;

Convert internal flash root partition to UBIFS

   ubiformat /dev/mtd2 -s 512
   ubiattach /dev/ubi_ctrl -m 2
   ubimkvol /dev/ubi0 -N rootfs -m
   mount -t ubifs ubi0:rootfs /mnt

However, the ubimkvol command returns errors (see below) in all variations I have tried.  Any suggestions?

some info:
----------
uname -a
Linux debianplug 2.6.32-trunk-kirkwood #1 Mon Jan 11 10:57:12 UTC 2010 armv5tel GNU/Linux


debianplug:/dev# ubinfo --all
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           0
Logical eraseblock size:                 129024 bytes, 126.0 KiB
Total amount of logical eraseblocks:     4055 (523192320 bytes, 499.0 MiB)
Amount of available logical eraseblocks: 4011 (517515264 bytes, 493.5 MiB)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       1
Count of reserved physical eraseblocks:  40
Current maximum erase counter value:     18
Minimum input/output unit size:          2048 bytes
Character device major/minor:            252:0
debianplug:/dev#

result:
-------

debianplug:/dev# ubimkvol /dev/ubi0 -N"rootfs" -s490MiB
[ 3491.439972] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
[ 3491.449102] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 0
[ 3491.458809] UBI: try another PEB
[ 3491.462240] UBI: run torture test for PEB 0
[ 3491.467051] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4055:512, written 0 bytes
[ 3491.476423] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 4055
[ 3491.511568] UBI: try another PEB
[ 3491.686891] UBI: PEB 0 passed torture test, do not mark it a bad
[ 3491.695949] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4051:512, written 0 bytes
[ 3491.705328] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 4051
[ 3491.715051] UBI: run torture test for PEB 4055
[ 3491.731852] UBI: try another PEB
[ 3491.913343] UBI: PEB 4055 passed torture test, do not mark it a bad
[ 3491.922647] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
[ 3491.931768] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 0
[ 3491.941238] UBI: run torture test for PEB 4051
[ 3491.958377] UBI warning: ubi_ro_mode: switch to read-only mode
[ 3491.972541] UBI error: ubi_create_volume: cannot create volume 0, error -30
ubimkvol: error!: cannot UBI create volume
          error 30 (Read-only file system)
debianplug:/dev# [ 3492.036981] UBI error: ubi_io_write: read-only mode
[ 3492.041908] UBI error: erase_worker: failed to erase PEB 4051, error -30
[ 3492.048643] UBI error: do_work: work failed with error code -30
[ 3492.054601] UBI error: ubi_thread: ubi_bgt0d: work failed with error code -30
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #1 on: January 29, 2010, 01:40:07 PM »

I think ubi have buildin protection when write encounter error it will switch to read-only mode to prevent further damage flush chip. You can try to start from beginning to reformat again. ubiformat will re-scan for bad block.
Logged

Good Luck Smiley

stevenm
Newbie
*

Karma: 0
Posts: 4


View Profile
« Reply #2 on: January 29, 2010, 01:44:49 PM »

Tried that already, quie a few times!  Is this an indication of bad hardware?
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #3 on: January 29, 2010, 01:55:41 PM »

Tried that already, quie a few times!  Is this an indication of bad hardware?
I know nothing about hardware, so I don't know if this is a indication of bad hardware.

Have you try to build a ubi image and use ubiformat directly?
Logged

Good Luck Smiley

stevenm
Newbie
*

Karma: 0
Posts: 4


View Profile
« Reply #4 on: January 29, 2010, 02:15:52 PM »

no, I have not used UBI before.  The only tools I know of are the ones in the mtd package;

ubiformat,  ubiattach, ubidetach,   ubimkvol, ubinfo etc.


 
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #5 on: January 29, 2010, 03:40:50 PM »

no, I have not used UBI before.  The only tools I know of are the ones in the mtd package;

ubiformat,  ubiattach, ubidetach,   ubimkvol, ubinfo etc.
ok, there are few steps to make a ubi image to load into NAND.
  • Create a storage place for your content.
  • Create a ubifs image
  • Create a ubi image
  • Flush ubi image into NAND use ubiformat
You can find better explain from this wiki page
Here is the command procedure
Code:
unix root# mkdir /tmp/ubi-content
unix root# tar -C /tmp/ubi-content -xf /path/to/your/rootfs.tar
unix root# mkfs.ubifs -v -r /tmp/ubi-content -m 2048 -e 129024 -c 4096 -o /tmp/ubifs.img
unix root# cat > /tmp/ubi.cfg <<_EOF_
[rootfs-volume]
mode=ubi
image=/tmp/ubifs.img
vol_id=0
vol_size=400MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
_EOF_
unix root# uninize -v -o /tmp/ubi.img -m 2048 -p 128KiB -s 512 /tmp/ubi.cfg
If everything run ok you should have a /tmp/ubi.img. Write the ubi.img use ubiformat
Code:
unix root# ubiformat /dev/mtd2 -s 512 -f /tmp/ubi.img
Now, if the format successful write the ubi.img you can mount it using
Code:
unix root# ubiattach /dev/ubi_ctrl -m 2
unix root# mount -t ubifs ubi0:rootfs /mnt

Edit: to include ubiattach before mount.
Good luck Smiley
« Last Edit: February 11, 2010, 02:08:21 PM by pingtoo » Logged

Good Luck Smiley

stevenm
Newbie
*

Karma: 0
Posts: 4


View Profile
« Reply #6 on: January 31, 2010, 08:05:48 PM »

Thanks.  Some success, but not complete.  I get past the ubiformat ok, but the mount fails.

What about ubiattach and ubimkvol?  I tried them too after the ubiformat, without any success either.

Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #7 on: January 31, 2010, 08:17:29 PM »

using mkfs.ubifs and ubizine pre-create the volume so you no longer need to create volume. I think I miss a step you need to attach the ubi device before you can mount it.
Logged

Good Luck Smiley

diefrisur
Newbie
*

Karma: 0
Posts: 11


View Profile
« Reply #8 on: February 09, 2010, 04:13:03 PM »

I'm struggling with ubimkvol as well. The above procedure didn't work. After ubiformat finished I received a long list of messages from the kernel.

I came across this link http://www.linux-mtd.infradead.org/faq/ubi.html#L_subpage_verify_fail

According to this it might help to turn off CONFIG_MTD_NAND_VERIFY_WRITE in the kernel. Has anybody tried this before? How would I do this? I'm pretty new to Linux and therefore a bit reluctant to do such steps without a good description of the relevant steps.
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #9 on: February 09, 2010, 08:09:21 PM »

I'm struggling with ubimkvol as well. The above procedure didn't work. After ubiformat finished I received a long list of messages from the kernel.

I came across this link http://www.linux-mtd.infradead.org/faq/ubi.html#L_subpage_verify_fail

According to this it might help to turn off CONFIG_MTD_NAND_VERIFY_WRITE in the kernel. Has anybody tried this before? How would I do this? I'm pretty new to Linux and therefore a bit reluctant to do such steps without a good description of the relevant steps.
Can you post what you did and the error messages?
Logged

Good Luck Smiley

diefrisur
Newbie
*

Karma: 0
Posts: 11


View Profile
« Reply #10 on: February 10, 2010, 03:16:00 PM »

I downloaded a rootfs.tar.gz from http://www.mediafire.com/sheeva-with-debian

Then I followed exactly the steps described above,i.e.

Code:
unix root# mkdir /tmp/ubi-content
unix root# tar -C /tmp/ubi-content -xf /path/to/your/rootfs.tar
unix root# mkfs.ubifs -v -r /tmp/ubi-content -m 2048 -e 129024 -c 4096 -o /tmp/ubifs.img
unix root# cat > /tmp/ubi.cfg <<_EOF_
[rootfs-volume]
mode=ubi
image=/tmp/ubifs.img
vol_id=0
vol_size=400MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
_EOF_
unix root# ubinize -v -o /tmp/ubi.img -m 2048 -p 128KiB -s 512 /tmp/ubi.cfg
unix root# ubiformat /dev/mtd2 -s 512 -f /tmp/ubi.img

I'm too stupid though to get the screen output copied from my putty console to past it here. So I can only describe. The error messages are first the same as when using ubimkvol, i.e. ubi_io_write: error -5 while writing ... and loads of similar errors

Then at some point it says kernel BUG at /build/buildd-linux-2.6_2.6.32-5-armel-EFZj80/linux-2.6-2.6.32/debian/build/source_armel_none/mm/slub.c:2969!

At the end there are messages like Message from syslogd@JGServer1 at date kernel xyz Internal error: Oops: 817

and further messages of this style.

How can I get a copy from my putty console output copied to insert it here? There are so many errors I can't possibly mention all of them here.

Any idea? The above is probably not really helpful.
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #11 on: February 10, 2010, 04:06:51 PM »

I downloaded a rootfs.tar.gz from http://www.mediafire.com/sheeva-with-debian

Then I followed exactly the steps described above,i.e.

Code:
unix root# mkdir /tmp/ubi-content
unix root# tar -C /tmp/ubi-content -xf /path/to/your/rootfs.tar
unix root# mkfs.ubifs -v -r /tmp/ubi-content -m 2048 -e 129024 -c 4096 -o /tmp/ubifs.img
unix root# cat > /tmp/ubi.cfg <<_EOF_
[rootfs-volume]
mode=ubi
image=/tmp/ubifs.img
vol_id=0
vol_size=400MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
_EOF_
unix root# ubinize -v -o /tmp/ubi.img -m 2048 -p 128KiB -s 512 /tmp/ubi.cfg
unix root# ubiformat /dev/mtd2 -s 512 -f /tmp/ubi.img

I'm too stupid though to get the screen output copied from my putty console to past it here. So I can only describe. The error messages are first the same as when using ubimkvol, i.e. ubi_io_write: error -5 while writing ... and loads of similar errors

Then at some point it says kernel BUG at /build/buildd-linux-2.6_2.6.32-5-armel-EFZj80/linux-2.6-2.6.32/debian/build/source_armel_none/mm/slub.c:2969!

At the end there are messages like Message from syslogd@JGServer1 at date kernel xyz Internal error: Oops: 817

and further messages of this style.

How can I get a copy from my putty console output copied to insert it here? There are so many errors I can't possibly mention all of them here.

Any idea? The above is probably not really helpful.


From your description let me to think you were rootfs was on NAND while you try to create a new one a write it back. this is no no. you can not change your running rootfs while system is up.

You need to boot and mount your rootfs from USB or SD before you can follow my instruction to build a rootfs for NAND.

Let me know if my guess is incorrect.

P.S. the reason I think you were on NAND because if your rootfs is not on NAND then you can not get a error right after ubiformat .... your were just writing data to a storage. if this writing cause problem then your running kernel may have problem that got nothing to do with this procedure.
Logged

Good Luck Smiley

diefrisur
Newbie
*

Karma: 0
Posts: 11


View Profile
« Reply #12 on: February 11, 2010, 03:05:28 AM »

I had really thought I started the system from USB, in particular because I formatted the nand with ubiformat before I tried ubiattach. Sorry, I think I forgot to mention that everything worked fine including ubiformat. The error messages come up when I start ubiattach.

I wanted to install a clean system on SD and try it all over again anyway either tonight or tomorrow. I then hope to transfer the console output into a file by using "> output.txt" or something similar and then get such file from the plug onto a USB drive from where I can copy the entire output.

Anyway, if you have any thoughts nevertheless assuming that I bootet from USB and not from nand, that be great.
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #13 on: February 11, 2010, 06:25:46 AM »

I had really thought I started the system from USB, in particular because I formatted the nand with ubiformat before I tried ubiattach. Sorry, I think I forgot to mention that everything worked fine including ubiformat. The error messages come up when I start ubiattach.

I wanted to install a clean system on SD and try it all over again anyway either tonight or tomorrow. I then hope to transfer the console output into a file by using "> output.txt" or something similar and then get such file from the plug onto a USB drive from where I can copy the entire output.

Anyway, if you have any thoughts nevertheless assuming that I bootet from USB and not from nand, that be great.
If it is possible please capture the whole process include command you issue and its output. Also version of kernel and mtd-utils so I have a reference point.
Logged

Good Luck Smiley

dodiak
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #14 on: February 11, 2010, 07:50:45 AM »

Hi, I have exactly the same problem. And I am relatively Smiley sure I booted from the SD card.
Here what's happening:
root@sheeva:~# uname -r
2.6.32-trunk-kirkwood
root@sheeva:~# dmesg |less
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.32-trunk-kirkwood (Debian 2.6.32-5) (ben@decadent.org.uk) (gcc version 4.3.4 (Debian 4.3.4-6) ) #1 Mon Jan 11 10:57:12 UTC0
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Marvell SheevaPlug Reference Board
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 131072
[    0.000000] free_area_init_node: node 0, pgdat c03d0904, node_mem_map c0cda000
[    0.000000]   Normal zone: 1024 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 130048 pages, LIFO batch:31
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 256MB 256MB = 512MB total
root@sheeva:~# ubidetach /dev/ubi_ctrl -m 2                                                                                                                 
[ 1220.656760] UBI: mtd2 is detached from ubi0
root@sheeva:~# ubiformat /dev/mtd2 -s 512
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 76 --  1 % complete   2
libscan: scanning eraseblock 4055 -- 100 % complete 
ubiformat: 4053 eraseblocks have valid erase counter, mean value is 1
ubiformat: 1 eraseblocks are supposedly empty
ubiformat: bad eraseblocks: 166, 2366
ubiformat: formatting eraseblock 4055 -- 100 % complete 
root@sheeva:~#    ubiattach /dev/ubi_ctrl -m 2
[ 1271.664780] UBI: attaching mtd2 to ubi0
[ 1271.668637] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[ 1271.674970] UBI: logical eraseblock size:    129024 bytes
[ 1271.680389] UBI: smallest flash I/O unit:    2048
[ 1271.685127] UBI: sub-page size:              512
[ 1271.689764] UBI: VID header offset:          512 (aligned 512)
[ 1271.695632] UBI: data offset:                2048
[ 1272.107616] UBI: attached mtd2 to ubi0
[ 1272.111420] UBI: MTD device name:            "root"
[ 1272.116320] UBI: MTD device size:            507 MiB
[ 1272.121320] UBI: number of good PEBs:        4054
[ 1272.126042] UBI: number of bad PEBs:         2
[ 1272.130506] UBI: max. allowed volumes:       128
[ 1272.135156] UBI: wear-leveling threshold:    4096
[ 1272.139880] UBI: number of internal volumes: 1
[ 1272.144355] UBI: number of user volumes:     0
[ 1272.148818] UBI: available PEBs:             4010
[ 1272.153554] UBI: total number of reserved PEBs: 44
[ 1272.158367] UBI: number of PEBs reserved for bad PEB handling: 40
[ 1272.164499] UBI: max/mean erase counter: 12/2
[ 1272.168874] UBI: image sequence number: 0
[ 1272.173754] UBI: background thread "ubi_bgt0d" started, PID 1047
UBI device number 0, total 4054 LEBs (523063296 bytes, 498.8 MiB), available 4010 LEBs (517386240 bytes, 493.4 MiB), LEB size 129024 bytes (126.0 KiB)
root@sheeva:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 517386240
[ 1286.379273] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
[ 1286.388397] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 0
[ 1286.398034] UBI: try another PEB
[ 1286.401461] UBI: run torture test for PEB 0
[ 1286.406244] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4055:512, written 0 bytes
[ 1286.415618] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 4055
[ 1286.451400] UBI: try another PEB
[ 1286.630962] UBI: PEB 0 passed torture test, do not mark it a bad
[ 1286.639260] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4052:512, written 0 bytes
[ 1286.648637] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 4052
[ 1286.658330] UBI: run torture test for PEB 4055
[ 1286.681622] UBI: try another PEB
[ 1286.864542] UBI: PEB 4055 passed torture test, do not mark it a bad
[ 1286.873033] UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
[ 1286.882151] UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 0
[ 1286.891702] UBI: run torture test for PEB 4052
[ 1286.908047] UBI warning: ubi_ro_mode: switch to read-only mode
[ 1286.922099] UBI error: ubi_create_volume: cannot create volume 0, error -30
ubimkvol: error!: cannot UBI create volume
          error 30 (Read-only file system)
root@sheeva:~# [ 1286.990259] UBI error: ubi_io_write: read-only mode
[ 1286.995188] UBI error: erase_worker: failed to erase PEB 4052, error -30
[ 1287.001932] UBI error: do_work: work failed with error code -30
[ 1287.007884] UBI error: ubi_thread: ubi_bgt0d: work failed with error code -30

root@sheeva:~# ls /mnt/
root@sheeva:~# mount -t ubifs ubi0:rootfs /mnt
[ 1302.236814] UBIFS error (pid 1050): ubifs_get_sb: cannot open "ubi0:rootfs", error -19
mount: unknown filesystem type 'ubifs'
root@sheeva:~#
root@sheeva:~# mount
rootfs on / type rootfs (rw)
none on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
none on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type tmpfs (rw,relatime,size=10240k,mode=755)
/dev/disk/by-uuid/868f3fab-0151-445f-a6ea-993b29ad39b2 on / type ext3 (rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,relatime,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type ext2 (rw,relatime,errors=continue)

I just followed the debian instalation process on SD card. And now I would like to transfer my system to flash.

thanks for any hint

Dodiak ...
Logged

Pages: [1] 2
Print
Jump to: