Welcome! Log In Create A New Profile

Advanced

flash_erase errors with PP V3 Pro

Posted by flashless 
flash_erase errors with PP V3 Pro
October 21, 2015 08:59PM
Hi,

I'm trying to use a PogoPlug V3 Pro as a wireless squeezebox player, and I ran into an error from flash_erase while following Qnology (GreyMan?)'s instructions for V3 Oxnas at this link:
...
/tmp # tar -xf uboot.2013.10-tld-4.ox820.bodhi.tar
/tmp # /tmp/flash_erase /dev/mtd0 0x0 6
Erase Total 6 Units
Performing Flash Erase of length 131072 at offset 0xa0000 done
/tmp # /tmp/nandwrite /dev/mtd0 uboot.spl.2013.10.ox820.850mhz.mtd0.img
Writing data to block 0 at offset 0x0
/tmp # /tmp/nandwrite -s 262144 /dev/mtd0 uboot.2013.10-tld-4.ox820.mtd0.img
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
Writing data to block 4 at offset 0x80000
Writing data to block 5 at offset 0xa0000
/tmp # /tmp/flash_erase /dev/mtd0 0x00100000 1
Erase Total 1 Units
Performing Flash Erase of length 131072 at offset 0x100000
MTD Erase failure: Input/output error
I can still ssh into the box using 'ceadmin', and I'm looking for assistance with deciding what I should do next. It looks like the uboot environment goes at the location that I had trouble erasing.
~ # /tmp/fw_printenv 
Too few good blocks within range
~ #
Should I try erasing again, programing the env, and seeing what it looks like with fw_printenv? Or can I locate the env at a different address?
Re: flash_erase errors with PP V3 Pro
October 21, 2015 11:56PM
flashless,

SSH into the stock kernel with root/ceadmin, and get the output of
dmesg
cat /proc/mtd
cat /etc/fw_env.config
Please post the entire log here (include any errors). The area that you tried to flash the envs to might have bad blocks.

Since you have installed new u-boot, if you have serial console then post the entire boot log. The good thing is your u-boot flashing was successful, so the worst case is you need to set up a default envs file in uEnv.txt and boot with it. But first, the log is important to see what is working.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase errors with PP V3 Pro
October 22, 2015 09:08AM
Thanks, Bodhi! My complete log is attached. Some selected lines I noticed in the last little bit:
<6>[  377.670000] XCE: BLPARAMS: reading 2048 bytes @ a1800
<4>[ 4058.500000] nand_erase: attempt to erase a bad block at page 0x00000200
<4>[ 4113.010000] nand_erase: attempt to erase a bad block at page 0x00000200
...
~ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 08000000 00020000 "NAND 128MiB 3,3V 8-bit"
mtd1: 00e00000 00020000 "boot"
mtd2: 07200000 00020000 "rootfs"
~ # cat /etc/fw_env.config 
/dev/mtd0 0x00100000 0x20000 0x20000
Attachments:
open | download - flashless.log (16.2 KB)
Re: flash_erase errors with PP V3 Pro
October 22, 2015 02:41PM
1. Do you have serial console?
2. Have you created the rootfs on a USB drive as instructed in the kernel/rootfs thread: http://forum.doozan.com/read.php?2,16044. If you did, plug in the USB drive, mount it to /tmp and get the listing of
ls -latr /tmp/sda1/boot

BTW, and you have not rebooted after you install u-boot image, and saw the error while flashing the envs image?

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase errors with PP V3 Pro
October 23, 2015 09:34PM
bodhi Wrote:
-------------------------------------------------------
> 1. Do you have serial console?

Not yet, but with my background and the various PogoPlugs I have, I should definitely have one of those. I'll poke around elsewhere in this forum and see what is suggested. Update: Ordered cables. Looks like they will be good for 'plugs, Rasp pies, and routers.

> 2. Have you created the rootfs on a USB drive as
> instructed in the kernel/rootfs thread:
> http://forum.doozan.com/read.php?2,16044.

I was following Qnology.com's instructions (link in first post) which has uBoot before rootfs. And I was thinking that the instructions you link to suggest having new uBoot before rootfs. But, I have a USB from another debian PP V3, so...

> If you
> did, plug in the USB drive, mount it to /tmp and
> get the listing of
> ls -latr /tmp/sda1/boot

I still had another USB in the pogoplug from pogoplug.com activation, so the debian USB I put in was /dev/sdb1
~ # mkdir /tmp/sdb1
~ # mount /dev/sdb1 /tmp/sdb1
~ # ls -latr /tmp/sdb1/boot
-rwxr-xr-x    1 root     root       4170000 Feb 12  2015 zImage-3.18.5-oxnas-tld-1
-rw-r--r--    1 root     root        100778 Feb 12  2015 config-3.18.5-oxnas-tld-1
-rw-r--r--    1 root     root       1544413 Feb 12  2015 System.map-3.18.5-oxnas-tld-1
-rwxr-xr-x    1 root     root       4170000 Feb 12  2015 vmlinuz-3.18.5-oxnas-tld-1
-rw-r--r--    1 root     root       9098838 Feb 12  2015 linux-headers-3.18.5-oxnas-tld-1_1_armel.deb
-rw-r--r--    1 root     root      11616738 Feb 12  2015 linux-image-3.18.5-oxnas-tld-1_1_armel.deb
-rw-r--r--    1 root     root        413571 Feb 12  2015 linux-3.18.5-oxnas-tld-1.patch
drwxr-xr-x    2 root     root          4096 Oct 18 15:13 dts
drwxr-xr-x   22 root     root          4096 Oct 18 20:57 ..
drwxr-xr-x    2 root     root          4096 Oct 18 21:14 backup
-rw-r--r--    1 root     root       4170064 Oct 18 22:07 uImage
-rw-r--r--    1 root     root       1976811 Oct 18 22:07 uInitrd
-rw-r--r--    1 root     root       1976771 Oct 18 22:53 initrd.img-3.18.5-oxnas-tld-1
drwxr-xr-x    4 root     root          4096 Oct 18 22:53 .

> BTW, and you have not rebooted after you install
> u-boot image, and saw the error while flashing the
> envs image?

I haven't rebooted after uboot install. The error message was from erasing before flashing the envs image (from what I understand) as shown in my first post above.

Thanks again, Bodhi.



Edited 1 time(s). Last edit at 10/23/2015 10:14PM by flashless.
Re: flash_erase errors with PP V3 Pro
October 24, 2015 12:48AM
OK. Here is the situation.

- The new u-boot image was flashed OK. So currently in your mtd0, you have the new u-boot.
- The new u-boot env image was not flashed because there was bad block. So the area where the new envs suppose to be has no valid values.

Without serial console, it is not possible to set the envs explicitly to allow booting with this u-boot version.

Here is what you can do. I have built and uploaded a newer u-boot version, but not officially released. This version will allow you to recover from a bad block in NAND area where the envs are!

Please install this tld-5 version. You only need to flash u-boot image (the SPL is the same).

Dropbox:
uboot.2013.10-tld-5.ox820.bodhi.tar
md5:
bf385f83b42cdeee1f2ecbf53f6cdec5


And create the uEnv file in your rootfs and put the content below in it.

Content of /boot/uEnv.txt
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run bootcmd_uenv; run dt_bootcmd_usb; reset
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
console=console=ttyS0,115200n8
devices=usb ide
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
ethact=mii0
ethaddr=5e:2b:15:71:ec:b6
if_netconsole=ping $serverip
ipaddr=192.168.0.222
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot=run safeboot
preboot_nc=run if_netconsole start_netconsole
serverip=192.168.0.220
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_device=0:1
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

If you can flash the tld-5 version successfully, and prepare the rootfs with that uEnv.txt file, then it will boot OK.

Warning: If for whatever reasons the steps above were not successful in booting for you, then you will need serial console to recover.

Update: I saw you are getting serial console, so all should be well.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 2 time(s). Last edit at 10/24/2015 12:50AM by bodhi.
Re: flash_erase errors with PP V3 Pro
October 26, 2015 08:40PM
Thanks, bodhi.

I got my new serial cable, but I'm trying not to need it :)
I was going through the instructions at http://forum.doozan.com/read.php?3,16017 and I noticed that my /proc/mtd isn't as listed. Mine is

/tmp # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 08000000 00020000 "NAND 128MiB 3,3V 8-bit"
mtd1: 00e00000 00020000 "boot"
mtd2: 07200000 00020000 "rootfs"
and the webpage referenced has
cat /proc/mtd 

dev:    size   erasesize  name
mtd0: 00e00000 00020000 "boot"
mtd1: 07200000 00020000 "data"
Is this a concern? I just noticed that you had me cat /proc/mtd above in this thread, so I'm guessing that what I have is OK.
Re: flash_erase errors with PP V3 Pro
October 27, 2015 12:04AM
flashless,

> /tmp # cat /proc/mtd
> dev: size erasesize name
> mtd0: 08000000 00020000 "NAND 128MiB 3,3V 8-bit"
> mtd1: 00e00000 00020000 "boot"
> mtd2: 07200000 00020000 "rootfs"

> cat /proc/mtd
>
> dev: size erasesize name
> mtd0: 00e00000 00020000 "boot"
> mtd1: 07200000 00020000 "data"

They are basically the same as far as flashing u-boot. As long as you flash the new u-boot to mtd0 exactly like you did before, it will be OK. Once you rebooted into Debian, leave it on like that and come back here for more investigation tips!

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase errors with PP V3 Pro
October 27, 2015 07:56PM
And "that's a bingo!". I installed uboot, installed uEnv.txt (only edited ethaddr) and rebooted into Debian.

(And how should I have rebooted from stock? There wasn't a reboot or shutdown, and I didn't have any luck running those commands from the mounted Debian stick, GLIBC errors and such. I ended up doing a sync and pulling the plug.)

Here's a few things, and I've attached dmesg. And again, thanks a bunch, bodhi!
root@PProDeb:~#  grep -a --null-data U-Boot /dev/mtd0ro          
U-Boot 2013.10-tld-5 for ox820 bU-Boot console  *** U-Boot Boot Menu ***Warning: U-Boot configured device %s at address %llx,
^C
root@PProDeb:~# uname -a
Linux PProDeb 3.18.5-oxnas-tld-1 #2 SMP PREEMPT Thu Feb 12 11:17:40 PST 2015 armv6l GNU/Linux
root@PProDeb:~# cat /etc/network/interfaces 
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
root@PProDeb:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00e00000 00020000 "boot"
mtd1: 07200000 00020000 "data"

And, oh crap, I ran dmesg again to capture it, and this time is is full of
[  884.843952] __nand_correct_data: uncorrectable ECC error
[  884.849241] __nand_correct_data: uncorrectable ECC error
[  884.854602] __nand_correct_data: uncorrectable ECC error
[  884.859893] __nand_correct_data: uncorrectable ECC error
[  884.865269] __nand_correct_data: uncorrectable ECC error

The old dmesg was still in my scroll-back buffer, so it is attached.
Attachments:
open | download - dmesg.txt (12.6 KB)
Re: flash_erase errors with PP V3 Pro
October 27, 2015 08:07PM
Maybe those ECC errors aren't as tragic as they look. I guess the numbers at the front of the dmesg lines are time in seconds from boot, and they aren't increasing. That is, 917.xx is the highest number for ECC errors, but my plug has been up 30 minutes. I plugged in a random USB flash into the box, and those lines are staying at the bottom of dmesg, with 1830 timestamps.
Re: flash_erase errors with PP V3 Pro
October 28, 2015 12:29AM
flashless,

> root@PProDeb:~# grep -a --null-data U-Boot
> /dev/mtd0ro
> U-Boot 2013.10-tld-5 for ox820 bU-Boot console
> *** U-Boot Boot Menu ***Warning: U-Boot configured
> device %s at address %llx,

> And, oh crap, I ran dmesg again to capture it, and
> this time is is full of
> [ 884.843952] __nand_correct_data: uncorrectable
> ECC error

:) No worry. Every time you run this command "grep -a --null-data U-Boot /dev/mtd0ro" , you will get a bunch of NAND errors like that. This command is a hack to look at u-boot version. The clean way to know u-boot version is to set it as a u-boot env, or look at serial console/net console banner.

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: