Ubi Error when using eudev when building with Buildroot

This forum is for users of Atmel's SAM Series and who are interested in using Linux OS.

Moderator: nferre

AntoineC
Posts: 105
Joined: Wed Oct 03, 2012 11:33 am

Ubi Error when using eudev when building with Buildroot

Wed Oct 05, 2016 3:58 pm

Hello,

I am building a complet boot/kernel/rootfs using the last Buildroot Release: 08-2016. My board is SAM9G25EK.

Under buildroot, I use the at91sam9x5ek_defconfig to generate images. I just change the uboot env to make it read the device tree before reading kernel and booting it. The "/dev management" is set to "Dynamic using devtmpfs only" (default).

On boot, no error displayed. Everything seems ok.

I need to change "/dev management" to "Dynamic using devtmpfs + eudev" (to use Atmel Wifi Card: https://github.com/linux4sc/wireless-dr ... e-for-WiFi). After new generation, the following errors are displayed:

Code: Select all

udevd[633]: starting eudev-3.2
UBI error: ubi_open_volume: cannot open device 0, volume 0, error -16
UBI error: ubi_open_volume: cannot open device 0, volume 0, error -16
What is strange is that device 0 volume 0 seems to be th rootfs ( cat /sys/class/ubi/ubi0_0/name --> rootfs) and rootfs seems to work fine.
I made a "touch test" and "sync". After reboot, the file is still there. So rootfs is working.

Any idea what could be those errors?
AntoineC
Posts: 105
Joined: Wed Oct 03, 2012 11:33 am

Re: Ubi Error when using eudev when building with Buildroot

Thu Oct 06, 2016 3:52 pm

I made some modifications in /etc/init.d/S10udev to see what causes the error.

Here is part of the original version :

Code: Select all

    start)
        printf "Populating ${udev_root:-/dev} using udev: "
        printf '\000\000\000\000' > /proc/sys/kernel/hotplug
        $UDEV_BIN -d || (echo "FAIL" && exit 1)
        udevadm trigger --type=subsystems --action=add
        udevadm trigger --type=devices --action=add
        udevadm settle --timeout=30 || echo "udevadm settle failed"
        echo "done"
If I comment the line "udevadm trigger --type=devices --action=add", there is no more error.

I am not so familiar with udev, so I do not know what could be wrong with that... Any idea?
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Ubi Error when using eudev when building with Buildroot

Fri Oct 07, 2016 1:26 am

I've also seen that message in Atmel demo releases dating back to Linux4SAM 4.4.
The Linux4SAM 5.3 demo still has that message, although there's only one instance compared to the two lines you report.
I don't see the message in the Linux4SAM 5.4 demo (there's also a version for AT91SAM9x5-EK board).

I've treated that message as benign.

Is there anything unusual about your UBI volume?

Regards
AntoineC
Posts: 105
Joined: Wed Oct 03, 2012 11:33 am

Re: Ubi Error when using eudev when building with Buildroot

Thu Oct 13, 2016 2:53 pm

Hello,

There is nothing unusual on the UBI volume.
I was wondering what was the error for. Strange to have this message if everything is ok...

Thanks
Antoine
AntoineC
Posts: 105
Joined: Wed Oct 03, 2012 11:33 am

Re: Ubi Error when using eudev when building with Buildroot

Thu Oct 13, 2016 3:08 pm

I have now a SAMA5D3-Xplained demo board, and I build complete images Bootstrap/UBoot/Kernel/RootFS with last version of buildroot.
I still got the same errors...
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Ubi Error when using eudev when building with Buildroot

Tue Oct 18, 2016 1:11 am

If you really want to get to the bottom of this, then rebuild the kernel after inserting a `#define DEBUG` statement to the beginning of drivers/mtd/ubi/kapi.c to get a bit more information when the error occurs in ubi_open_volume().

Regards
cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

Re: Ubi Error when using eudev when building with Buildroot

Wed Jan 11, 2017 6:27 pm

I see the same thing on my new build of Debian testing (stretch) on a sama5d36 running kernel 4.8.12.

I added DEBUG and this is the ubi related output.

[ 3.060000] ubi0: attaching mtd3
[ 5.910000] ubi0: scanning is finished
[ 5.930000] ubi0: attached mtd3 (name "rootfs", size 510 MiB)
[ 5.940000] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 5.940000] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 5.950000] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 5.950000] ubi0: good PEBs: 4084, bad PEBs: 0, corrupted PEBs: 0
[ 5.960000] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 5.970000] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 193039147
[ 5.970000] ubi0: available PEBs: 0, total reserved PEBs: 4084, PEBs reserved for bad PEB handling: 80
[ 5.980000] ubi0: background thread "ubi_bgt0d" started, PID 754
[ 6.010000] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 761
[ 6.100000] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs"
[ 6.110000] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 6.120000] UBIFS (ubi0:1): FS size: 505872384 bytes (482 MiB, 3984 LEBs), journal size 25395200 bytes (24 MiB, 200 LEBs)
[ 6.130000] UBIFS (ubi0:1): reserved for root: 4952683 bytes (4836 KiB)
[ 6.130000] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID 9E16D31E-60DB-45EE-B893-0038C9399C62, small LPT model
[ 6.140000] VFS: Mounted root (ubifs filesystem) on device 0:13.
[ 15.670000] ubi0 error: ubi_open_volume.part.0: cannot open device 0, volume 1, error -16
[ 15.800000] ubi0 error: ubi_open_volume.part.0: cannot open device 0, volume 1, error -16

Nothing jumps out, but I am no ubi expert. This doesn't appear to cause any problems but I am curious to understand why it happens.
Last edited by cajjed on Mon Jan 16, 2017 8:03 pm, edited 1 time in total.
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Ubi Error when using eudev when building with Buildroot

Thu Jan 12, 2017 1:53 am

cajjed wrote:I added DBUG and this is the ubi related output.
...
Nothing jumps out, but I am no ubi expert.
That looks like a normal log without any debug output.
The required symbol is DEBUG, not DBUG, and you need to view the full log, e.g.open-up the log level to 7 for KERN_DEBUG.
cajjed wrote:... but I am curious to understand why it happens.
Then figure out who (and why) calls this routine when the message is issued.
http://lxr.free-electrons.com/ident?v=4 ... pen_volume
cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

Re: Ubi Error when using eudev when building with Buildroot

Mon Jan 16, 2017 8:32 pm

Thanks for the response and sorry for the mistype (I fixed it above).

I went back into the kernel and updated the default setting to 7 for debug so I will see everything:

cat /proc/sys/kernel/printk
7 7 1 7

and still no extra debug data. I think the functions making the call our outside of kapi.c.

I added

Code: Select all

printk(KERN_WARNING "ubi Caller is %pS\n", __builtin_return_address(0));
to kapi.c and got the following:

Code: Select all

[   15.720000] ubi Caller is gluebi_get_device+0x54/0x90
[   15.760000] ubi0 error: ubi_open_volume: cannot open device 0, volume 1, error -16
[   15.820000] ubi Caller is gluebi_get_device+0x54/0x90
[   15.820000] ubi0 error: ubi_open_volume: cannot open device 0, volume 1, error -16
Thus, it looks like it is attempting to create a fake MTD device after creating the new UBI volume.

Not sure where to go from here. Do I need to make a fake MTD device? Can I turn it off?
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Ubi Error when using eudev when building with Buildroot

Mon Jan 16, 2017 11:50 pm

Try dumping the stack to get a more complete picture.
Enabling Stack Dumping in Linux Kernel

Regards
cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

Re: Ubi Error when using eudev when building with Buildroot

Fri Jan 20, 2017 9:12 pm

So here is the output of the stack dump

Code: Select all

[   15.570000] CPU: 0 PID: 1095 Comm: systemd-udevd Not tainted 4.8.12-nelson #7
[   15.570000] Hardware name: Atmel SAMA5
[   15.570000] [<c010d130>] (unwind_backtrace) from [<c010aa34>] (show_stack+0x10/0x14)
[   15.570000] [<c010aa34>] (show_stack) from [<c0414e3c>] (ubi_open_volume+0x28/0x2f8)
[   15.570000] [<c0414e3c>] (ubi_open_volume) from [<c041ff68>] (gluebi_get_device+0x68/0xa4)
[   15.570000] [<c041ff68>] (gluebi_get_device) from [<c03f7808>] (__get_mtd_device+0x2c/0x64)
[   15.570000] [<c03f7808>] (__get_mtd_device) from [<c03fe97c>] (blktrans_open+0xa4/0x178)
[   15.570000] [<c03fe97c>] (blktrans_open) from [<c01ebedc>] (__blkdev_get+0x94/0x364)
[   15.570000] [<c01ebedc>] (__blkdev_get) from [<c01ecbb0>] (blkdev_get+0x118/0x3a8)
[   15.570000] [<c01ecbb0>] (blkdev_get) from [<c01b3724>] (do_dentry_open.constprop.3+0x1d4/0x2fc)
[   15.570000] [<c01b3724>] (do_dentry_open.constprop.3) from [<c01c2f60>] (path_openat+0x33c/0xf50)
[   15.570000] [<c01c2f60>] (path_openat) from [<c01c4e08>] (do_filp_open+0x60/0xc4)
[   15.570000] [<c01c4e08>] (do_filp_open) from [<c01b48a0>] (do_sys_open+0x110/0x1c0)
[   15.570000] [<c01b48a0>] (do_sys_open) from [<c01077a0>] (ret_fast_syscall+0x0/0x3c)
[   15.570000] ubi0 error: ubi_open_volume: cannot open device 0, volume 1, error -16
[   15.710000] CPU: 0 PID: 1338 Comm: mtd_probe Not tainted 4.8.12-nelson #7
[   15.710000] Hardware name: Atmel SAMA5
[   15.710000] [<c010d130>] (unwind_backtrace) from [<c010aa34>] (show_stack+0x10/0x14)
[   15.710000] [<c010aa34>] (show_stack) from [<c0414e3c>] (ubi_open_volume+0x28/0x2f8)
[   15.710000] [<c0414e3c>] (ubi_open_volume) from [<c041ff68>] (gluebi_get_device+0x68/0xa4)
[   15.710000] [<c041ff68>] (gluebi_get_device) from [<c03f7808>] (__get_mtd_device+0x2c/0x64)
[   15.710000] [<c03f7808>] (__get_mtd_device) from [<c03f78c0>] (get_mtd_device+0x80/0x114)
[   15.710000] [<c03f78c0>] (get_mtd_device) from [<c03fb578>] (mtdchar_open+0x3c/0xe8)
[   15.710000] [<c03fb578>] (mtdchar_open) from [<c01ba184>] (chrdev_open+0xc4/0x1b8)
[   15.710000] [<c01ba184>] (chrdev_open) from [<c01b3724>] (do_dentry_open.constprop.3+0x1d4/0x2fc)
[   15.710000] [<c01b3724>] (do_dentry_open.constprop.3) from [<c01c2f60>] (path_openat+0x33c/0xf50)
[   15.710000] [<c01c2f60>] (path_openat) from [<c01c4e08>] (do_filp_open+0x60/0xc4)
[   15.710000] [<c01c4e08>] (do_filp_open) from [<c01b48a0>] (do_sys_open+0x110/0x1c0)
[   15.710000] [<c01b48a0>] (do_sys_open) from [<c01077a0>] (ret_fast_syscall+0x0/0x3c)
[   15.710000] ubi0 error: ubi_open_volume: cannot open device 0, volume 1, error -16

Any insight on what I can tweak to have this go away?
cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

Re: Ubi Error when using eudev when building with Buildroot

Fri Jan 20, 2017 10:37 pm

I turned off MTD_UBI_GLUEBI in the kernel because I don't have any legacy software and that removed the error.

This was turned on by default in the atmel sama5_defconfig found in arch/arm/configs.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest