update failure ubifs

707 views
Skip to first unread message

Francesco

unread,
May 25, 2018, 4:59:11 AM5/25/18
to swup...@googlegroups.com
Hello Stefano,
I was wondering if you could help me with this problem.
I'm trying out swupdate and I would like to upgrade the whole rootfs on an mtd partition.  In order to do this,I would like to flash into mtd7 my current ubi.img.
The ubi.img works fine when it is flashed using this command (this means that the image should work):
    ubiformat -f ubi.img /dev/mtd7

I then tried to do the same thing using swupdate, my sw-description file look like this:
root@isar:~/swupdate-test# cat sw-description
software =
{
    version = "0.1.0";
    description = "Firmware update for lynx Project";
    hardware-compatibility: [ "1.0", "1.2", "1.3"];
    images: (
         {
    filename = "ubi.img";
    type = "ubivol";
        volume = "rootfs";
        }
    );
}
(I'm not entirely sure if this is 100% correct. I also tried using device = /dev/mtd7, but it gave me the same sort of error)
my swupdate.cfg is this:
globals :
{

    verbose = true;
    loglevel = 5;
    mtd-blacklist = "0 1 2 3 4 5 6 8 9 10 11 12 13 14";

};
As you can see I left out 7, since that is the destination of my mtd partition.

Then I tried to update the rootfs while the system is running on mmc in this way:
swupdate -v -f swupdate.cfg -i lynx-image-test_1.0.swu

Here is the output:
root@isar:~/swupdate-test# ls
lynx-image-test_1.0.swu  script_image.sh  sw-description  swupdate.cfg    ubi.img  ubinize.cfg
root@isar:~/swupdate-test# swupdate -v -f swupdate.cfg -i lynx-image-test_1.0.swu
Swupdate v2018.3.0

Licensed under GPLv2. See source distribution for detailed copyright notices.

[INFO ] : SWUPDATE running :  [lua_handlers_init] : No Lua handler(s) found.
[TRACE] : SWUPDATE running :  [lua_handlers_init] : Lua handler search path:
/usr/local/share/lua/5.2/swupdate_handlers.lua
/usr/local/share/lua/5.2/swupdate_handlers/init.lua
/usr/local/lib/lua/5.2/swupdate_handlers.lua
/usr/local/lib/lua/5.2/swupdate_handlers/init.lua
/usr/share/lua/5.2/swupdate_handlers.lua
/usr/share/lua/5.2/swupdate_handlers/init.lua
./swupdate_handlers.lua
Running on lynx Revision 1.0
Registered handlers:
    dummy
    archive
    tar
    flash
    flash-hamming1
    raw
    rawfile
    ubivol
    ubipartition
    lua
    shellscript
    preinstall
    postinstall
    remote
    uboot
    bootloader
    swuforward
[TRACE] : SWUPDATE running :  [extract_sw_description] : Found file:
    filename sw-description
    size 245
    checksum 0x447b VERIFIED

[TRACE] : SWUPDATE running :  [parse_cfg] : Version 0.1.0
[TRACE] : SWUPDATE running :  [parse_cfg] : Description Firmware update for lynx Project
[TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : 1.0
[TRACE] : SWUPDATE running :  [listener_create] : creating socket at /tmp/swupdateprog
[TRACE] : SWUPDATE running :  [network_initializer] : Main loop Daemon
[TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : 1.2
[TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : 1.3
[TRACE] : SWUPDATE running :  [parse_images] : Found Image: ubi.img in volume : rootfs for handler ubivol

[TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware lynx Revision: 1.0
[TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware compatibility verified
[TRACE] : SWUPDATE running :  [cpio_scan] : Found file:
    filename ubi.img
    size 179044352
    REQUIRED

[TRACE] : SWUPDATE running :  [listener_create] : creating socket at /tmp/sockinstctrl
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
scan_for_ubi_devices
[TRACE] : SWUPDATE running :  [scan_ubi_volumes] : mtd7:    Volume found :     rootfs
[TRACE] : SWUPDATE running :  [install_single_image] : Found installer for stream ubi.img ubivol
[INFO ] : SWUPDATE running :  Installing image ubi.img into volume /dev/ubi0_0(rootfs)
[TRACE] : SWUPDATE running :  [update_volume] : Updating UBI : ubi.img 179044352

Software updated successfully
Please reboot the device to start the new software
[INFO ] : SWUPDATE successful !

The output of dmesg is the following:

[  100.402772] ubi0: attaching mtd7
[  112.417938] ubi0: scanning is finished
[  112.471207] ubi0 warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 2, need 160
[  112.498256] ubi0: attached mtd7 (name "nand-ubi", size 1000 MiB)
[  112.512657] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[  112.519570] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[  112.527582] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[  112.535304] ubi0: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0
[  112.542174] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[  112.549546] ubi0: max/mean erase counter: 21/18, WL threshold: 4096, image sequence number: 1454903147
[  112.560044] ubi0: available PEBs: 0, total reserved PEBs: 8000, PEBs reserved for bad PEB handling: 2
[  112.569328] ubi0: background thread "ubi_bgt0d" started, PID 378

Booting the board with rootfs in mtds ends up in a kernel panic, here is the output:
    4.709162] imx_thermal 2000000.aips-bus:tempmon: Industrial CPU temperature grade - max:105C critical:100C passive:95C
[    4.730035] ubi0: attaching mtd7
[   16.909265] ubi0: scanning is finished
[   16.959382] ubi0 warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 2, need 160
[   16.978779] ubi0: attached mtd7 (name "nand-ubi", size 1000 MiB)
[   16.984947] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[   16.991915] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[   16.998728] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[   17.005746] ubi0: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0
[   17.011923] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[   17.019173] ubi0: max/mean erase counter: 21/18, WL threshold: 4096, image sequence number: 1454903147
[   17.028535] ubi0: available PEBs: 0, total reserved PEBs: 8000, PEBs reserved for bad PEB handling: 2
[   17.037845] ubi0: background thread "ubi_bgt0d" started, PID 77
[   17.044475] snvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 2018-05-25 08:52:01 UTC (1527238321)
[   17.076673] SWBST: disabling
[   17.080198] usb_otg1_vbus: disabling
[   17.083875] wilink-wl-en: disabling
[   17.087723] ALSA device list:
[   17.090714]   No soundcards found.
[   17.099158] List of all partitions:
[   17.102842] 0100           65536 ram0  (driver?)
[   17.107504] 0101           65536 ram1  (driver?)
[   17.112281] 0102           65536 ram2  (driver?)
[   17.116937] 0103           65536 ram3  (driver?)
[   17.121709] 0104           65536 ram4  (driver?)
[   17.126368] 0105           65536 ram5  (driver?)
[   17.131022] 0106           65536 ram6  (driver?)
[   17.135740] 0107           65536 ram7  (driver?)
[   17.140395] 0108           65536 ram8  (driver?)
[   17.145167] 0109           65536 ram9  (driver?)
[   17.149821] 010a           65536 ram10  (driver?)
[   17.154625] 010b           65536 ram11  (driver?)
[   17.159367] 010c           65536 ram12  (driver?)
[   17.164144] 010d           65536 ram13  (driver?)
[   17.168882] 010e           65536 ram14  (driver?)
[   17.173674] 010f           65536 ram15  (driver?)
[   17.178423] 1f00            8192 mtdblock0  (driver?)
[   17.183548] 1f01            1024 mtdblock1  (driver?)
[   17.188634] 1f02            1024 mtdblock2  (driver?)
[   17.193771] 1f03            1024 mtdblock3  (driver?)
[   17.198859] 1f04            1024 mtdblock4  (driver?)
[   17.203983] 1f05            8192 mtdblock5  (driver?)
[   17.209069] 1f06            4096 mtdblock6  (driver?)
[   17.214205] 1f07         1024000 mtdblock7  (driver?)
[   17.219292] 1f08            1024 mtdblock8  (driver?)
[   17.224414] 1f09             256 mtdblock9  (driver?)
[   17.229500] 1f0a             256 mtdblock10  (driver?)
[   17.234721] 1f0b             512 mtdblock11  (driver?)
[   17.239894] 1f0c            8192 mtdblock12  (driver?)
[   17.245102] 1f0d            4096 mtdblock13  (driver?)
[   17.250275] 1f0e           18432 mtdblock14  (driver?)
[   17.255497] b300        15126528 mmcblk0  driver: mmcblk
[   17.260848]   b301          849920 mmcblk0p1 be8a6d62-01
[   17.266232]   b302        14174208 mmcblk0p2 be8a6d62-02
[   17.271610] No filesystem could mount root, tried:  ubifs
[   17.277064] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[   17.285350] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.15-xuelk-2.0.1-dirty #2
[   17.292844] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[   17.299080] [<80016ca0>] (unwind_backtrace) from [<80013400>] (show_stack+0x10/0x14)
[   17.306858] [<80013400>] (show_stack) from [<8084fa08>] (dump_stack+0x84/0xc4)
[   17.314111] [<8084fa08>] (dump_stack) from [<8084d79c>] (panic+0xa0/0x1f8)
[   17.321016] [<8084d79c>] (panic) from [<80bc92b0>] (mount_block_root+0x21c/0x230)
[   17.328524] [<80bc92b0>] (mount_block_root) from [<80bc9568>] (prepare_namespace+0xa8/0x1d8)
[   17.336987] [<80bc9568>] (prepare_namespace) from [<80bc8e64>] (kernel_init_freeable+0x1d4/0x1e4)
[   17.345887] [<80bc8e64>] (kernel_init_freeable) from [<8084b7d0>] (kernel_init+0x8/0xe8)
[   17.354007] [<8084b7d0>] (kernel_init) from [<800101e8>] (ret_from_fork+0x14/0x2c)
[   17.361601] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Is this approach correct?
I hope you could give me some tips about these warnings/errors.

Thank you.

Francesco






Stefano Babic

unread,
May 25, 2018, 6:43:06 AM5/25/18
to Francesco, swup...@googlegroups.com
Hi Francesco,

On 25/05/2018 10:59, Francesco wrote:
> Hello Stefano,
> I was wondering if you could help me with this problem.
> I'm trying out swupdate and I would like to upgrade the whole rootfs on
> an mtd partition.  In order to do this,I would like to flash into mtd7
> my current ubi.img.
> The ubi.img works fine when it is flashed using this command (this means
> that the image should work):
>    /ubiformat -f ubi.img /dev/mtd7

ubiformat saves a UBI image, while SWUpdate is able to set and store
volumes.

If you want to let SWUpdate to set Volumes, you have to add a partitions
section in sw-description. The file in the image section belongs to a
volume, that is it is a UBIFS.

>
> /I then tried to do the same thing using swupdate, my sw-description
> file look like this:
> root@isar:~/swupdate-test# cat sw-description
> /software =//
> //{//
> //    version = "0.1.0";//
> //    description = "Firmware update for lynx Project";//
> //    hardware-compatibility: [ "1.0", "1.2", "1.3"];//
> //    images: (//
> //         {//
> //    filename = "ubi.img";//
> //    type = "ubivol";//

If destination is a UBI volume, it cannot be a UBI (generated by
ubinize). It does not work.

Add partitions (volumes) and put your ubifs into the image section.

> //        volume = "rootfs";//
> //        }//
> //    );//
> //}/
> (I'm not entirely sure if this is 100% correct. I also tried using
> device = /dev/mtd7, but it gave me the same sort of error)
> my swupdate.cfg is this:
> /globals ://
> //{//
> //
> //    verbose = true;//
> //    loglevel = 5;//
> //    mtd-blacklist = "0 1 2 3 4 5 6 8 9 10 11 12 13 14";//
> //
> //};/
> As you can see I left out 7, since that is the destination of my mtd
> partition.
>
> Then I tried to update the rootfs while the system is running on mmc in
> this way:
> /swupdate -v -f swupdate.cfg -i lynx-image-test_1.0.swu
>
> /Here is the output:/
You pushed a UBI inside a ubivol, of course it crashes...

>
> Software updated successfully
> Please reboot the device to start the new software
> [INFO ] : SWUPDATE successful !
>
> /The output of dmesg is the following:
>
> /[  100.402772] ubi0: attaching mtd7//
> //[  112.417938] ubi0: scanning is finished//
> //[  112.471207] ubi0 warning: print_rsvd_warning: cannot reserve enough
> PEBs for bad PEB handling, reserved 2, need 160//
> //[  112.498256] ubi0: attached mtd7 (name "nand-ubi", size 1000 MiB)//
> //[  112.512657] ubi0: PEB size: 131072 bytes (128 KiB), LEB size:
> 126976 bytes//
> //[  112.519570] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page
> size 2048//
> //[  112.527582] ubi0: VID header offset: 2048 (aligned 2048), data
> offset: 4096//
> //[  112.535304] ubi0: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0//
> //[  112.542174] ubi0: user volume: 1, internal volumes: 1, max. volumes
> count: 128//
> //[  112.549546] ubi0: max/mean erase counter: 21/18, WL threshold:
> 4096, image sequence number: 1454903147//
> //[  112.560044] ubi0: available PEBs: 0, total reserved PEBs: 8000,
> PEBs reserved for bad PEB handling: 2//
> //[  112.569328] ubi0: background thread "ubi_bgt0d" started, PID 378//
> //
> /Booting the board with rootfs in mtds ends up in a kernel panic, here
No.

> I hope you could give me some tips about these warnings/errors.
>

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Francesco

unread,
May 25, 2018, 9:00:12 AM5/25/18
to Stefano Babic, swup...@googlegroups.com
Thanks for clearing things out Stefano.
Now I see where the problem was.
I would like to ask you another thing, when I install the updated rootfs using swupdate I always get these errors:

libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
libmtd: error!: ECCGETLAYOUT ioctl request failed
        error 95 (Operation not supported)
scan_for_ubi_devices

(the os on my target board is debian 8)

At first, I thought that they where caused by the mtd-utils that come with debian.  I tried to remove them and I installed a newer release  from the sources. This did not solve the problem. I reckon that the error may come from the kernel. My kernel version is 4.1.15.
Does swupdate require a specific kernel version? In alternative, what could be the source of this error?
Thanks again for your help.
Francesco

Stefano Babic

unread,
May 25, 2018, 11:12:58 AM5/25/18
to Francesco, Stefano Babic, swup...@googlegroups.com
On 25/05/2018 15:00, Francesco wrote:
> Thanks for clearing things out Stefano.
> Now I see where the problem was.

Have you changed sw-description as I told you ?

> I would like to ask you another thing, when I install the updated rootfs
> using swupdate I always get these errors:
> /libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//

This is deprecated and I cannot find it in libmtd.a

> //libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//
> //libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//
> //libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//
> //libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//
> //libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//
> //libmtd: error!: ECCGETLAYOUT ioctl request failed//
> //        error 95 (Operation not supported)//
> //scan_for_ubi_devices
>
> /(the os on my target board is debian 8)
>
> At first, I thought that they where caused by the mtd-utils that come
> with debian.  I tried to remove them and I installed a newer release 
> from the sources.

Have you rebuilt SWUpdate ? SWUpdate is linked with libmtd.a

> This did not solve the problem. I reckon that the
> error may come from the kernel. My kernel version is 4.1.15.
> Does swupdate require a specific kernel version? In alternative, what
> could be the source of this error?
> Thanks again for your help.

Best regards,
Stefano Babic
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To post to this group, send email to swup...@googlegroups.com
> <mailto:swup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Francesco

unread,
May 29, 2018, 2:42:38 AM5/29/18
to Stefano Babic, swup...@googlegroups.com
Hello Stefano,


On 25/05/2018 17:12, Stefano Babic wrote:
> On 25/05/2018 15:00, Francesco wrote:
>> Thanks for clearing things out Stefano.
>> Now I see where the problem was.
> Have you changed sw-description as I told you ?
Yes I have and it works. Thanks.
>
>> I would like to ask you another thing, when I install the updated rootfs
>> using swupdate I always get these errors:
>> /libmtd: error!: ECCGETLAYOUT ioctl request failed//
>> //        error 95 (Operation not supported)//
> This is deprecated and I cannot find it in libmtd.a
 I tried to cross compile the mtd-utils and then I rebuilt the debian
pkg. Unfortunatly the error still persist.  These errors however, do not
prevent the system from upgrading, they seems more like warnings.

Thanks and best regards.

Francesco.

Stefano Babic

unread,
May 29, 2018, 11:23:18 AM5/29/18
to Francesco, Stefano Babic, swup...@googlegroups.com
Hi Francesco,

On 29/05/2018 08:42, Francesco wrote:
> Hello Stefano,
>
>
> On 25/05/2018 17:12, Stefano Babic wrote:
>> On 25/05/2018 15:00, Francesco wrote:
>>> Thanks for clearing things out Stefano.
>>> Now I see where the problem was.
>> Have you changed sw-description as I told you ?
> Yes I have and it works. Thanks.

You're welcome.

>>
>>> I would like to ask you another thing, when I install the updated rootfs
>>> using swupdate I always get these errors:
>>> /libmtd: error!: ECCGETLAYOUT ioctl request failed//
>>> //        error 95 (Operation not supported)//
>> This is deprecated and I cannot find it in libmtd.a
>  I tried to cross compile the mtd-utils and then I rebuilt the debian
> pkg. Unfortunatly the error still persist.  These errors however, do not
> prevent the system from upgrading, they seems more like warnings.

Yes, they are just telling that the ioctl() is unsupported because it is
marked as obsolete in kernel. Anyway, I do not see this ioctl() in quite
new mtd-utils, and it looks like that you have still an old version.
This is not a problme becase the API is the same and SWUpdate, apart the
warnings you are seeing, can work with older (1.5) and newer (2.0+)
versions.

>
> Thanks and best regards.

You're welcome.

Best regards,
Stefano Babic

sabhl...@gmail.com

unread,
Aug 26, 2019, 12:51:31 PM8/26/19
to swupdate

Hi ,

I am first time using SWUpdate and trying to update rootfs.ubi image after update my board is does not load ROOTFS .

scenario - 
copied and booted all artifacts on nand (uboot,dtb,kernel,rootfs).

once booted succefully ..



     


system partition looks like :
NAND.SPL
NAND.SPL.backup1
NAND.SPL.backup2
NAND.SPL.backup3
NAND.u-boot-os
NAND.u-boot
NAND.u-boot-env
NAND.u-boot-env_bkup
NAND.kernel
NAND.file-system

i ran command :
swupdate -i my_file.swu


contents of my_file.swu
   
images: (
        {
                filename = "rootfs.ubi";
                type = "flash";
                device = "/dev/mtd9";

        }


-------- got error messages like:
libmtd: error!: MEMUNLOCK ioctl failed for eraseblock 2007 (mtd9)
        error 95 (Operation not supported) 

so many lines 

and after that ---got notifivation - sw update successfull - reboot your machine ..
i rebooted 


result:
during rootfs load :

    2.254313] ubi0: attaching mtd9
[    2.314727] random: fast init done
[    2.350009] ubi0 error: ubi_attach: bad image sequence number 954504525 in PEB 189, expected 1392551105
[    2.360036] Erase counter header dump:
[    2.364108]  magic          0x55424923
[    2.368085]  version        1
[    2.371282]  ec             2
[    2.374431]  vid_hdr_offset 4096
[    2.377855]  data_offset    8192
[    2.381325]  image_seq      954504525
[    2.385208]  hdr_crc        0x3d20152
[    2.389090] erase counter header hexdump:
[    2.393648] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
[    2.401343] UBI error: cannot attach mtd9
[    2.406222] hctosys: unable to open rtc device (rtc0)
[    2.411680] sr_init: No PMIC hook to init smartreflex
[    2.417321] sr_init: platform driver register failed for SR
[    2.424406] evm_v3_3d: disabling
[    2.427928] vmmcwl_fixed: disabling
[    2.434997] VFS: Cannot open root device "ubi0:am437x-hs-evm-rootfs" or unknown-block(0,0): error -19
[    2.444967] Please append a correct "root=" boot option; here are the available partitions:
[    2.453922] 0100           16384 ram0

[    2.614795]  (driver?)
[    2.621783] 1f09          514048 mtdblock9
[    2.621793]  (driver?)
[    2.628731] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.637686] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Reply all
Reply to author
Forward
0 new messages