Welcome! Log In Create A New Profile

Advanced

Switch from Archlinux to debian

Posted by rsantag 
Switch from Archlinux to debian
October 15, 2020 09:03PM
Hello. I'm new to this forum, and fairly new with the Pogoplug, but experienced with Unix/Linux.

I bought a Pogoplug V4-A3-01 that was configured by the previous owner to boot Arch Linux from USB drive. I'm booting debian from SD on my other Pogoplugs, which is what I'd like to do on this one.

I'm not able to see it on my network when I boot to the original Cloud Engines OS, so I booted to Arch Linux, and ran uboot.sh (pulled from http://ssl.pepas.com/pogo/uboot.sh). It says MD5 sums of /bin/busybox and /proc/version don't match, which of course they wouldn't since I'm not running the original OS.

But, I'm thinking it should be safe to do the override of that MD5 check ("export BRICK_MY_POGO=1") and let it do the U-boot update since it IS the correct hardware, but not sure if there are going to be any gotchas since I'm running it under Arch Linux rather than the orig. OS. I did comment out the /sbin/poweroff at the bottom of uboot.sh so I can try to recover while it's still up in case there are any errors running the script.

Do you agree that this should work? This is what I see for current U-Boot version.

[root@alarm ~]# grep -a --null-data U-Boot /dev/mtd0ro
U-Boot 1.1.4 (Oct 1 2011 - 12:06:06) Cloud Engines 1.1.2 (3.4.27) PHYADDR=0If U-Boot Endiannes is going to change (LE->BE or BE->LE), Then Env parameters should be overriden..
U-Boot
** Invalid partition type "%.32s" (expect "U-Boot")
U-Boot code: %08lX -> %08lX BSS: -> %08lX
Addresses %dM - 0M are saved for the U-Boot usage.
U-Boot BUG at %s:%d!
U-Boot 1.1.4 (Jan 13 2012 - 22:33:21) Arch Linux ARM (PPV4 r1) PHYADDR=0If U-Boot Endiannes is going to change (LE->BE or BE->LE), Then Env parameters should be overriden..
U-Boot
** Invalid partition type "%.32s" (expect "U-Boot")
U-Boot code: %08lX -> %08lX BSS: -> %08lX
Addresses %dM - 0M are saved for the U-Boot usage.
U-Boot BUG at %s:%d!

Is this telling me there are two on /dev/mtd0? Will uboot.sh replace them both with just U-Boot 2014.07-tld-1?

Any/all help and suggestions appreciated!

rsantag
Re: Switch from Archlinux to debian
October 15, 2020 10:40PM
rsantag,

There is only one u-boot on mtd0. The Pogo V4 mtd0 is 2MB (unlike other Kirkwood boxes which has 1 MB mtd0).

I'm not trying to discourage you from using pepas script. However, if you are an experienced Linux user then it is easy to follow the instruction in my u-boot release thread and install it from inside Arch Linux. The commands are pure Linux (not Arch specific).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 16, 2020 09:38AM
Thanks for the quick reply. I've give it a go later today and post my results.

rsantag
Re: Switch from Archlinux to debian
October 16, 2020 02:32PM
OK, downloaded the U-Boot and tools from dropbox. Extracted tools and moved to /usr/local/bin, and moved fw_env.config to /etc.
When I run fw_printenv I get Bad CRC error and only a handful of env variables are listed

[root@alarm etc]# fw_printenv
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200
[root@alarm etc]#

But I did copy /usr/local/cloudengines/bin/* from another pogo-v4-a3-01 to this box, and it does show all the other env vars, incl. ethaddr

[root@alarm etc]# /usr/local/cloudengines/bin/blparam | grep ethaddr
ethaddr=00:25:31:05:18:a3
[root@alarm etc]# /usr/local/cloudengines/bin/blparam | wc -l
50
[root@alarm etc]#

Should I just use /usr/local/cloudengines/bin/blparam to set env vars when I get to that point? Or is there something I need to do to fix fw_printenv and fw_setenv?

rsantag
Re: Switch from Archlinux to debian
October 16, 2020 04:11PM
rsantag,

Should I just use /usr/local/cloudengines/bin/blparam to set env vars when I get to that point? Or is there something I need to do to fix fw_printenv and fw_setenv?

No. Initially you have to use blparam to see the u-boot envs. But once you flash u-boot and u-boot envs image (Step 7 and Step 8), the envs are newly created on flash, and its location was adjusted in /etc/fw_env.config.

So at Step 8.e and later steps, you can use fw_setenv and fw_printenv.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 16, 2020 07:32PM
OK, thanks again. That helped.

Hopefully the last question: Step e.2 says to restore mtdparts, but this wasn't set in the original env variables.

[root@alarm alarm]# grep mtdparts current_envs.txt
[root@alarm alarm]# wc -l current_envs.txt
50 current_envs.txt
[root@alarm alarm]#

However, I have another Pogo same model that it IS set:

root@pogoplug:~# fw_printenv mtdparts
mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)

Should I set to that?
Note that mtd0 on the new box has 1 more partition (no idea what the mtd5 partition is for)

root@pogoplug:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00300000 00020000 "uImage"
mtd2: 00300000 00020000 "uImage2"
mtd3: 00800000 00020000 "failsafe"
mtd4: 07000000 00020000 "root"
root@pogoplug:~#


[root@alarm alarm]# cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00300000 00020000 "uImage"
mtd2: 00300000 00020000 "uImage2"
mtd3: 00800000 00020000 "failsafe"
mtd4: 07000000 00020000 "root"
mtd5: 00010000 00008000 "spi0.0"
[root@alarm alarm]#


And one final question: does it still boot the original OS (from Cloud Engines) if it doesn't find kernel files on any of the drives?

rsantag



Edited 1 time(s). Last edit at 10/16/2020 08:30PM by rsantag.
Re: Switch from Archlinux to debian
October 16, 2020 10:07PM
rsantag,

> root@pogoplug:~# fw_printenv mtdparts
> mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
>
> Should I set to that?

Yes, that's the correct mtdparts for Pogo V4.

> Note that mtd0 on the new box has 1 more partition
> (no idea what the mtd5 partition is for)
> mtd5: 00010000 00008000 "spi0.0"

You can ignore this.


> And one final question: does it still boot the
> original OS (from Cloud Engines) if it doesn't
> find kernel files on any of the drives?

It will not boot the CE stock OS. It is possible but extra steps needed (a little bit more involved with flash mtd).

Not a lot of people want to boot stock so I didn't provide instruction.

However, to make it possible, then right after you have backed up mtd0 in Step 3.


Quote

3. Be sure to save your current uBoot image in mtd0, or have a backup image saved somewhere as precaution. And save your current u-boot envs with fw_printenv, or just copy/paste the listing into a text file. Note the nanddump command below allows future restoration to the same box you're backing up, and also can be used to restore a differrent box's mtd0 if needed.

Dumping NAND mtd0:
nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0

Do this in stock OS right after the nanddump above

cp -a mtd0 /uboot.mtd0.pogo_v4.original.kwb

And later I will show you how to boot back to stock if that's what you want to do so you can run stock FW as a rescue system.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 16, 2020 11:37PM
Thanks. Yeah, that was my thought - as a rescue OS. My other Pogos are running the 2014 Uboot, which does boot to the stock OS if no SD or USB boot device.

I know the older U-Boot that I'm running on my other Pogos tries to boot off MMC, then USB, then Sata, then internal flash.

root@pogoplug:~# fw_printenv bootcmd
bootcmd=run bootcmd_mmc; run bootcmd_usb; run bootcmd_sata; run bootcmd_pogo; reset


But the newer boot loader seems to do things quite a bit differently, so I'm assuming I would need to somehow incorporate the equivalent of the bootcmd_pogo in the boot sequence

root@pogoplug:~# fw_printenv bootcmd_pogo
bootcmd_pogo=if ubi part root 2048 && ubifsmount ubi:rootfs && ubifsload 0x800000 uboot.mtd0.dockstar.original.kwb ; then go 0x800200; fi


But is uboot.mtd0.dockstar.original.kwb even still there, or was it on /dev/mtd0 and gets overlaid by the new U-boot? It's not super critical that I can boot the orig OS, but figured it would be a nice option if it can be done fairly easily. And I do like to understand how all the piece fit together. Haven't really ever done anything with a ubifs on a flash device, so this old dog trying to learn some new tricks.

rsantag

=============
mode edit: please use formatted code to post log or envs listing.



Edited 3 time(s). Last edit at 10/19/2020 03:40PM by bodhi.
Re: Switch from Archlinux to debian
October 19, 2020 01:48PM
OK, so digging into this a little more, my other Pogos have /uboot.mtd0.dockstar.original.kwb on the mtd4 root partition, which seems to be what bootcmd_pogo loads with ubifsload. I'm guessing this is the original, unmodified /dev/mtd0 uboot partition? So, the uboot.2014.07 uboot loads and runs this as a last resort, which in turn boots the original OS.

So, problem is that I'm not positive the /dev/mtd0 I dumped above with nanddump is an unmodified original uboot. The previous owner of the device had updated it to run Arch linux, so I'm guessing it's not. However, I do have /uboot.mtd0.dockstar.original.kwb. The other problem is, even if /dev/mtd0 on this device WAS the original, I was booted into Arch Linux, not original CE OS, so my copy just got saved to root on the Arch Linux USB drive. I wasn't able to boot to the original OS when I received it.

Is there a way to mount /dev/mtd4 to be able to write /uboot.mtd0.dockstar.original.kwb there? Or if not, maybe just use dd to save /dev/mtd4 from another Pogo-v4-A3-01, and write it to /dev/mtd4 on this device? Then, just need to tweak fw env variables, i.e. add the bootcmd_pogo as above and
change bootcmd_exec to

Quote

"if run load_uimage; then if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; else run boot_pogo; fi"?

Would that work?

Ralph

============
moderator edit: please use formatted code or quote to list envs



Edited 3 time(s). Last edit at 10/19/2020 03:41PM by bodhi.
Re: Switch from Archlinux to debian
October 19, 2020 04:05PM
Note to readers: This is what we call "chainload u-boot" method. This method works only with very old u-boots, such as ones on these Kirkwodd boxes. If stock u-boot is newer than 2012 (2013 and newer), then most likely it cannot be chainloaded. Mainline u-boot circa 2011/2012 also could not be chainloaded.


Ralph,

You have a pretty good grasp on what the envs do in setting up booting stock u-boot.

Quote

So, problem is that I'm not positive the /dev/mtd0 I dumped above with nanddump is an unmodified original uboot. The previous owner of the device had updated it to run Arch linux, so I'm guessing it's not. However, I do have /uboot.mtd0.dockstar.original.kwb. The other problem is, even if /dev/mtd0 on this device WAS the original, I was booted into Arch Linux, not original CE OS, so my copy just got saved to root on the Arch Linux USB drive. I wasn't able to boot to the original OS when I received it.

The original Arch Linux version of this u-boot is basically the same as stock. With some additional envs changes to boot Arch. So it can be used for chainload puposes. But it is no longer a clean boot (need to retrofit the stock envs on the fly).

You're correct that mounting stock rootfs to copy the orginal mtd0 on it would be best. Otherwise you would have to flash mtd0 back to stock, and redo the flashing for new u-boot.

The dockstar u-boot will enable the booting to stock OS on NAND. But it might cause some lack of capability such as SATA. OTOH, it is OK to run the Pogo V4 stock rootfs with Dockstar u-boot, since we dont care much about full capability, we just want to go into rescue mode.


OK. The summary: Boot into Debian on this Pogo V4 with new u-boot and Debian rootfs on USB/MMC/SATA. Attach the ubi device and mount it. And then copy the Dockstar original u-boot to the root folder of this volume.

Once you done the booting, please post the entire serial boot log (or at the minimum, dmesg output) here. So I can see everything before I post the commands to mount UBIFS.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 19, 2020 09:43PM
OK, I'm definitely unfamiliar with mtd, ubi and ubifs, so please take pity on me, but this is what I tried:

root@debian:~# grep ubi /proc/filesystems
nodev ubifs
root@debian:~# modprobe ubi mtd=4
root@debian:~# mkdir /mnt/ubi4
root@debian:~# mount -t ubifs ubi4 /mnt/ubi4
mount: unknown filesystem type 'ubifs'
root@debian:~#

The only ubi I see in /dev is /dev/ubi_ctrl. Should there be /dev/ubi0, ubi1, etc?

root@debian:~# ls -l /dev/ubi*
crw------- 1 root root 10, 61 Dec 31 1969 /dev/ubi_ctrl
root@debian:~#

BTW, I am running 5.8.3 kernel..
root@debian:~# uname -a
Linux debian 5.8.3-kirkwood-tld-1 #1.0 PREEMPT Sat Aug 22 16:10:01 PDT 2020 armv5tel GNU/Linux

Ralph
Re: Switch from Archlinux to debian
October 19, 2020 11:26PM
Ralph,

Quote
bodhi
Once you done the booting, please post the entire serial boot log (or at the minimum, dmesg output) here. So I can see everything before I post the commands to mount UBIFS.

Please post the log.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 20, 2020 10:27AM
Here is my dmesg

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.8.3-kirkwood-tld-1 (root@tldDebian) (gcc (Debian 8.3.0-6) 8.3.0, GNU ld (GNU Binutils for Debian) 2.31.1) #1.0 PREEMPT Sat Aug 22 16:10:01 PDT 2020
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Pogoplug v4
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 256 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:on, heap free:off
[    0.000000] Memory: 104432K/131072K available (10240K kernel code, 1085K rwdata, 4108K rodata, 1024K init, 298K bss, 26640K reserved, 0K cma-reserved)
[    0.000000] random: get_random_u32 called from ____cache_alloc+0x46c/0x808 with crng_init=0
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] 	Trampoline variant of Tasks RCU enabled.
[    0.000000] 	Rude variant of Tasks RCU enabled.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11467562657 ns
[    0.000015] sched_clock: 32 bits at 166MHz, resolution 6ns, wraps every 12884901885ns
[    0.000084] Switching to timer-based delay loop, resolution 6ns
[    0.001306] Console: colour dummy device 80x30
[    0.001392] Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=1666666)
[    0.001436] pid_max: default: 32768 minimum: 301
[    0.002083] LSM: Security Framework initializing
[    0.002319] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.002365] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.004464] CPU: Testing write buffer coherency: ok
[    0.007382] Setting up static identity map for 0x100000 - 0x100058
[    0.007832] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.008321] rcu: Hierarchical SRCU implementation.
[    0.012747] devtmpfs: initialized
[    0.021586] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.021647] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.022109] xor: measuring software checksum speed
[    0.120190]    arm4regs  :   698.400 MB/sec
[    0.220134]    8regs     :   435.200 MB/sec
[    0.320133]    32regs    :   632.800 MB/sec
[    0.320163] xor: using function: arm4regs (698.400 MB/sec)
[    0.320198] prandom: seed boundary self test passed
[    0.326466] prandom: 100 self tests passed
[    0.326484] pinctrl core: initialized pinctrl subsystem
[    0.327957] thermal_sys: Registered thermal governor 'step_wise'
[    0.329015] NET: Registered protocol family 16
[    0.330348] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.331809] audit: initializing netlink subsys (disabled)
[    0.334234] audit: type=2000 audit(0.330:1): state=initialized audit_enabled=0 res=1
[    0.334442] cpuidle: using governor ladder
[    0.334572] cpuidle: using governor menu
[    0.335327] Feroceon L2: Enabling L2
[    0.335399] Feroceon L2: Cache support initialised.
[    0.350042] No ATAGs?
[    2.560096] random: fast init done
[    7.890522] raid6: int32x8  gen()    74 MB/s
[    8.060313] raid6: int32x8  xor()    46 MB/s
[    8.230184] raid6: int32x4  gen()    76 MB/s
[    8.400125] raid6: int32x4  xor()    49 MB/s
[    8.570279] raid6: int32x2  gen()    99 MB/s
[    8.740199] raid6: int32x2  xor()    60 MB/s
[    8.910142] raid6: int32x1  gen()    74 MB/s
[    9.080139] raid6: int32x1  xor()    43 MB/s
[    9.080156] raid6: using algorithm int32x2 gen() 99 MB/s
[    9.080170] raid6: .... xor() 60 MB/s, rmw enabled
[    9.080182] raid6: using intx1 recovery algorithm
[    9.080568] vgaarb: loaded
[    9.081439] SCSI subsystem initialized
[    9.081811] libata version 3.00 loaded.
[    9.082210] usbcore: registered new interface driver usbfs
[    9.082306] usbcore: registered new interface driver hub
[    9.082432] usbcore: registered new device driver usb
[    9.082748] pps_core: LinuxPPS API ver. 1 registered
[    9.082766] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    9.082807] PTP clock support registered
[    9.085149] clocksource: Switched to clocksource orion_clocksource
[   11.311132] VFS: Disk quotas dquot_6.6.0
[   11.311289] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[   11.326861] NET: Registered protocol family 2
[   11.328203] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[   11.328259] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[   11.328300] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[   11.328332] TCP: Hash tables configured (established 1024 bind 1024)
[   11.329051] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[   11.329106] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[   11.329446] NET: Registered protocol family 1
[   11.330485] RPC: Registered named UNIX socket transport module.
[   11.330505] RPC: Registered udp transport module.
[   11.330519] RPC: Registered tcp transport module.
[   11.330532] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   11.330554] PCI: CLS 0 bytes, default 32
[   11.331067] Trying to unpack rootfs image as initramfs...
[   12.409684] Freeing initrd memory: 7632K
[   12.409948] NetWinder Floating Point Emulator V0.97 (double precision)
[   12.425407] Initialise system trusted keyrings
[   12.425508] Key type blacklist registered
[   12.425847] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[   12.426020] zbud: loaded
[   12.428179] NFS: Registering the id_resolver key type
[   12.428225] Key type id_resolver registered
[   12.428240] Key type id_legacy registered
[   12.428273] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[   12.428300] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[   12.428731] jffs2: version 2.2. (NAND) (SUMMARY)  \xffffffc2\xffffffa9 2001-2006 Red Hat, Inc.
[   12.429544] fuse: init (API version 7.31)
[   12.430133] orangefs_debugfs_init: called with debug mask: :none: :0:
[   12.430470] orangefs_init: module version upstream loaded
[   12.430490] SGI XFS with ACLs, security attributes, realtime, scrub, quota, no debug enabled
[   12.581003] async_tx: api initialized (async)
[   12.581040] Key type asymmetric registered
[   12.581056] Asymmetric key parser 'x509' registered
[   12.581144] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[   12.581454] io scheduler bfq registered
[   12.878847] kirkwood-pinctrl f1010000.pin-controller: unknown pinctrl group 47
[   12.878876] kirkwood-pinctrl f1010000.pin-controller: unknown pinctrl group 49
[   12.879443] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[   12.882546] mvebu-pcie mbus@f1000000:pcie@82000000: PCI host bridge to bus 0000:00
[   12.882583] pci_bus 0000:00: root bus resource [bus 00-ff]
[   12.882607] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[   12.882629] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[   12.882651] pci_bus 0000:00: scanning bus
[   12.882797] pci 0000:00:01.0: [11ab:6281] type 01 class 0x060400
[   12.882859] pci 0000:00:01.0: reg 0x38: [mem 0x00000000-0x000007ff pref]
[   12.884561] pci_bus 0000:00: fixups for bus
[   12.884582] PCI: bus0: Fast back to back transfers disabled
[   12.884610] pci 0000:00:01.0: scanning [bus 00-00] behind bridge, pass 0
[   12.884624] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[   12.884655] pci 0000:00:01.0: scanning [bus 00-00] behind bridge, pass 1
[   12.884853] pci_bus 0000:01: scanning bus
[   12.884905] pci 0000:01:00.0: [1b73:1009] type 00 class 0x0c0330
[   12.884965] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x0000ffff 64bit]
[   12.885001] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00000fff 64bit]
[   12.885035] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit]
[   12.885241] pci 0000:01:00.0: supports D1
[   12.885265] pci 0000:01:00.0: PME# supported from D0 D1 D3hot
[   12.885290] pci 0000:01:00.0: PME# disabled
[   12.885357] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:01.0 (capable of 4.000 Gb/s with 5.0 GT/s PCIe x1 link)
[   12.916495] pci_bus 0000:01: fixups for bus
[   12.916514] PCI: bus1: Fast back to back transfers disabled
[   12.916535] pci_bus 0000:01: bus scan returning with max=01
[   12.916554] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[   12.916580] pci_bus 0000:00: bus scan returning with max=01
[   12.916859] pci 0000:00:01.0: BAR 14: assigned [mem 0xe0000000-0xe00fffff]
[   12.916887] pci 0000:00:01.0: BAR 6: assigned [mem 0xe0100000-0xe01007ff pref]
[   12.916920] pci 0000:01:00.0: BAR 0: assigned [mem 0xe0000000-0xe000ffff 64bit]
[   12.916958] pci 0000:01:00.0: BAR 2: assigned [mem 0xe0010000-0xe0010fff 64bit]
[   12.916992] pci 0000:01:00.0: BAR 4: assigned [mem 0xe0011000-0xe0011fff 64bit]
[   12.917023] pci 0000:00:01.0: PCI bridge to [bus 01]
[   12.917053] pci 0000:00:01.0:   bridge window [mem 0xe0000000-0xe00fffff]
[   12.917196] pcieport 0000:00:01.0: assign IRQ: got 0
[   12.917223] pcieport 0000:00:01.0: enabling device (0140 -> 0142)
[   12.917264] pcieport 0000:00:01.0: enabling bus mastering
[   12.917328] pci 0000:00:01.0: enabling bus mastering
[   12.917348] pci 0000:01:00.0: enabling device (0140 -> 0142)
[   12.918197] mv_xor f1060800.xor: Marvell shared XOR driver
[   12.976683] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[   12.980658] mv_xor f1060900.xor: Marvell shared XOR driver
[   13.046699] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[   13.051133] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[   13.053185] printk: console [ttyS0] disabled
[   13.053320] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 25, base_baud = 10416666) is a 16550A
[   14.061118] printk: console [ttyS0] enabled
[   14.078679] loop: module loaded
[   14.083001] sata_mv f1080000.sata: version 1.28
[   14.083416] sata_mv f1080000.sata: slots 32 ports 2
[   14.094687] scsi host0: sata_mv
[   14.099468] scsi host1: sata_mv
[   14.103688] ata1: SATA max UDMA/133 irq 32
[   14.108595] ata2: SATA max UDMA/133 irq 32
[   14.115076] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xf1
[   14.122238] nand: Hynix H27U1G8F2BTR-BC
[   14.126841] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[   14.135104] Scanning device for bad blocks
[   14.224553] 5 cmdlinepart partitions found on MTD device orion_nand
[   14.231524] Creating 5 MTD partitions on "orion_nand":
[   14.237370] 0x000000000000-0x000000200000 : "u-boot"
[   14.245329] 0x000000200000-0x000000500000 : "uImage"
[   14.253015] 0x000000500000-0x000000800000 : "uImage2"
[   14.260852] 0x000000800000-0x000001000000 : "failsafe"
[   14.268805] 0x000001000000-0x000008000000 : "root"
[   14.277717] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information.
[   14.286280] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[   14.298744] libphy: Fixed MDIO Bus: probed
[   14.305384] libphy: orion_mdio_bus: probed
[   14.320662] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[   14.439983] ata1: SATA link down (SStatus 0 SControl F300)
[   14.786956] ata2: SATA link down (SStatus 0 SControl F300)
[   14.996238] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:25:31:05:18:a3
[   15.005875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   15.013142] ehci-pci: EHCI PCI platform driver
[   15.018390] ehci-orion: EHCI orion driver
[   15.023403] orion-ehci f1050000.ehci: EHCI Host Controller
[   15.029649] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[   15.038283] orion-ehci f1050000.ehci: irq 29, io mem 0xf1050000
[   15.065208] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[   15.072290] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.08
[   15.081260] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.089178] usb usb1: Product: EHCI Host Controller
[   15.094738] usb usb1: Manufacturer: Linux 5.8.3-kirkwood-tld-1 ehci_hcd
[   15.102050] usb usb1: SerialNumber: f1050000.ehci
[   15.108425] hub 1-0:1.0: USB hub found
[   15.112918] hub 1-0:1.0: 1 port detected
[   15.118704] xhci_hcd 0000:01:00.0: assign IRQ: got 37
[   15.118823] xhci_hcd 0000:01:00.0: enabling bus mastering
[   15.118843] xhci_hcd 0000:01:00.0: xHCI Host Controller
[   15.124803] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
[   15.134716] xhci_hcd 0000:01:00.0: hcc params 0x200073a1 hci version 0x100 quirks 0x0000000000080010
[   15.144644] xhci_hcd 0000:01:00.0: enabling Mem-Wr-Inval
[   15.145497] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.08
[   15.154426] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.162392] usb usb2: Product: xHCI Host Controller
[   15.167986] usb usb2: Manufacturer: Linux 5.8.3-kirkwood-tld-1 xhci-hcd
[   15.175299] usb usb2: SerialNumber: 0000:01:00.0
[   15.181510] hub 2-0:1.0: USB hub found
[   15.186094] hub 2-0:1.0: 2 ports detected
[   15.191736] xhci_hcd 0000:01:00.0: xHCI Host Controller
[   15.197753] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 3
[   15.205896] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed
[   15.212958] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[   15.222006] usb usb3: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.08
[   15.231175] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.239107] usb usb3: Product: xHCI Host Controller
[   15.244667] usb usb3: Manufacturer: Linux 5.8.3-kirkwood-tld-1 xhci-hcd
[   15.251979] usb usb3: SerialNumber: 0000:01:00.0
[   15.258215] hub 3-0:1.0: USB hub found
[   15.262714] hub 3-0:1.0: 2 ports detected
[   15.268592] usbcore: registered new interface driver usb-storage
[   15.275939] mousedev: PS/2 mouse device common for all mice
[   16.325361] rtc-mv f1010300.rtc: internal RTC not ticking
[   16.331689] i2c /dev entries driver
[   16.336908] device-mapper: uevent: version 1.0.3
[   16.342655] device-mapper: ioctl: 4.42.0-ioctl (2020-02-27) initialised: dm-devel@redhat.com
[   16.352548] device-mapper: multipath round-robin: version 1.2.0 loaded
[   16.359852] device-mapper: multipath queue-length: version 0.2.0 loaded
[   16.367202] device-mapper: multipath service-time: version 0.3.0 loaded
[   16.374579] device-mapper: dm-log-userspace: version 1.3.0 loaded
[   16.381382] device-mapper: raid: Loading target version 1.15.1
[   16.389856] hid: raw HID events driver (C) Jiri Kosina
[   16.396313] drop_monitor: Initializing network drop monitor service
[   16.403944] NET: Registered protocol family 10
[   16.411054] Segment Routing with IPv6
[   16.415503] RPL Segment Routing with IPv6
[   16.420322] NET: Registered protocol family 17
[   16.425819] Key type dns_resolver registered
[   16.431464] registered taskstats version 1
[   16.436341] Loading compiled-in X.509 certificates
[   16.441977] zswap: loaded using pool lzo/zbud
[   16.447662] Key type ._fscrypt registered
[   16.452354] Key type .fscrypt registered
[   16.457070] Key type fscrypt-provisioning registered
[   16.466306] Key type big_key registered
[   16.489443] Key type encrypted registered
[   16.503458] Freeing unused kernel memory: 1024K
[   16.526478] Checked W+X mappings: passed, no W+X pages found
[   16.532838] Run /init as init process
[   16.537267]   with arguments:
[   16.537276]     /init
[   16.537283]   with environment:
[   16.537289]     HOME=/
[   16.537295]     TERM=linux
[   16.704497] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[   16.726668] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[   16.740455] random: udevadm: uninitialized urandom read (16 bytes read)
[   17.424441] mvsdio f1090000.mvsdio: Got CD GPIO
[   17.510372] mmc0: host does not support reading read-only switch, assuming write-enable
[   17.526918] mmc0: new high speed SDHC card at address 0001
[   17.857791] mmcblk0: mmc0:0001 00000 29.3 GiB 
[   17.867002]  mmcblk0: p1
[   29.152566] process '/bin/fstype' started with executable stack
[   29.394255] EXT4-fs (mmcblk0p1): mounting ext3 file system using the ext4 subsystem
[   29.438273] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[   32.609988] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[   33.255514] orion_wdt: Initial timeout 25 sec
[   33.673958] marvell-cesa f1030000.crypto: CESA device successfully registered
[   36.378105] EXT4-fs (mmcblk0p1): re-mounted. Opts: errors=remount-ro
[   43.422131] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 100 Mb/s, full duplex, flow control disabled
[   43.432636] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   97.766834] random: crng init done
[   97.770933] random: 7 urandom warning(s) missed due to ratelimiting

========

Moderator edit: please use code tags (the button "Formatted Code" above the edit box when you create post) to post logs and envs.



Edited 1 time(s). Last edit at 10/20/2020 03:38PM by bodhi.
Re: Switch from Archlinux to debian
October 20, 2020 03:56PM
Hi Ralph,

First you would attach the ubi_ctrl device to mtd 4. This will give you ubi0.

ubiattach /dev/ubi_ctrl -m 4

And then, mount its volume (root) to a folder

mkdir -p /tmp/pogo_root
mount -t ubifs ubi0:root /tmp/pogo_root

Explanation:

You did not see ubi0 in the syslog, because it was never attached. This happens automatically during boot if the kernel knows that you have a ubi control device. And that should be in the bootargs (but our bootargs env does not specify anything about UBI, since UBI is box-specific).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/20/2020 07:30PM by bodhi.
Re: Switch from Archlinux to debian
October 20, 2020 07:44PM
No ubiattach command, so had to install mtd-utils.
Then tried the ubiattach, but get an error 22

root@debian:~# ubiattach /dev/ubi_ctrl -m 4
ubiattach: error!: cannot attach mtd4
error 22 (Invalid argument)

Tried doing the modprobe first, but same error

root@debian:~# modprobe ubi mtd=4
root@debian:~# ubiattach /dev/ubi_ctrl -m 4
ubiattach: error!: cannot attach mtd4
error 22 (Invalid argument)

ubiattach -h shows this help info:

Quote

root@debian:~# ubiattach -h
ubiattach version 2.0.0 - a tool to attach MTD device to UBI.

Usage: ubiattach [<UBI control device node file name>]
[-m <MTD device number>] [-d <UBI device number>] [-p <path to device>]
[--mtdn=<MTD device number>] [--devn=<UBI device number>]
[--dev-path=<path to device>]
[--max-beb-per1024=<maximum bad block number per 1024 blocks>]
UBI control device defaults to /dev/ubi_ctrl if not supplied.
Example 1: ubiattach -p /dev/mtd0 - attach /dev/mtd0 to UBI
Example 2: ubiattach -m 0 - attach MTD device 0 (mtd0) to UBI
Example 3: ubiattach -m 0 -d 3 - attach MTD device 0 (mtd0) to UBI
and create UBI device number 3 (ubi3)
Example 4: ubiattach -m 1 -b 25 - attach /dev/mtd1 to UBI and reserve
25*C/1024 eraseblocks for bad block handling, where C is the flash
is total flash chip eraseblocks count, that is flash chip size in
eraseblocks (including bad eraseblocks). E.g., if the flash chip
has 4096 PEBs, 100 will be reserved.

-d, --devn=<number> the number to assign to the newly created UBI device
(assigned automatically if this is not specified)
-p, --dev-path=<path> path to MTD device node to attach
-m, --mtdn=<number> MTD device number to attach (alternative method, e.g
if the character device node does not exist)
-O, --vid-hdr-offset VID header offset (do not specify this unless you really
know what you are doing, the default should be optimal)
-b, --max-beb-per1024 maximum expected bad block number per 1024 eraseblock.
The default value is correct for most NAND devices.
Allowed range is 0-768, 0 means the default kernel value.
-h, --help print help message
-V, --version print program version

So tried -p option with same result

root@debian:~# ubiattach -p /dev/mtd4
ubiattach: error!: cannot attach "/dev/mtd4"
error 22 (Invalid argument)

and even tried with both ubi control device and -p option

root@debian:~# ubiattach /dev/ubi_ctrl -p /dev/mtd4
ubiattach: error!: cannot attach "/dev/mtd4"
error 22 (Invalid argument)

Sure looks like one of these would be valid. Any thoughts?

Here is dmesg from my various attempts

Quote

[29134.246537] ubi0: attaching mtd4
[29134.251061] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[29134.259997] ubi0 error: validate_ec_hdr: bad EC header
[29134.266427] Erase counter header dump:
[29134.271079] magic 0x55424923
[29134.275642] version 1
[29134.279494] ec 1
[29134.283306] vid_hdr_offset 2048
[29134.287376] data_offset 4096
[29134.291452] image_seq 0
[29134.295235] hdr_crc 0x7f585319
[29134.299815] erase counter header hexdump:
[29134.304644] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 UBI#............................
[29134.304657] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 58 53 19 .............................XS.
[29134.304672] CPU: 0 PID: 3702 Comm: ubiattach Not tainted 5.8.3-kirkwood-tld-1 #1.0
[29134.313063] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[29134.320193] [<8010e824>] (unwind_backtrace) from [<8010ab50>] (show_stack+0x10/0x14)
[29134.328783] [<8010ab50>] (show_stack) from [<807a3378>] (validate_ec_hdr+0xdc/0x140)
[29134.337337] [<807a3378>] (validate_ec_hdr) from [<807a4134>] (ubi_io_read_ec_hdr+0x2a8/0x314)
[29134.346702] [<807a4134>] (ubi_io_read_ec_hdr) from [<807aa244>] (ubi_attach+0x338/0x1334)
[29134.355874] [<807aa244>] (ubi_attach) from [<8079d7d4>] (ubi_attach_mtd_dev+0x848/0xd6c)
[29134.365060] [<8079d7d4>] (ubi_attach_mtd_dev) from [<8079e5f4>] (ctrl_cdev_ioctl+0xe0/0x210)
[29134.374365] [<8079e5f4>] (ctrl_cdev_ioctl) from [<80282648>] (vfs_ioctl+0x20/0x38)
[29134.382778] [<80282648>] (vfs_ioctl) from [<80282fb4>] (ksys_ioctl+0xcc/0x784)
[29134.390844] [<80282fb4>] (ksys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x50)
[29134.399320] Exception stack(0x87b53fa8 to 0x87b53ff0)
[29134.405181] 3fa0: 00000003 7e81bb4c 00000003 40186f40 7e81bb4c 00000000
[29134.414187] 3fc0: 00000003 7e81bb4c 7e81beac 00000036 7e81beac 004ce0dc 004ce0dc 004ce0dc
[29134.423184] 3fe0: 76f069a0 7e81bb34 004b9918 76f069ac
[29134.429073] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[29134.436502] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[29257.142486] ubi0: attaching mtd4
[29257.146877] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[29257.155749] ubi0 error: validate_ec_hdr: bad EC header
[29257.161950] Erase counter header dump:
[29257.166379] magic 0x55424923
[29257.171254] version 1
[29257.175056] ec 1
[29257.179167] vid_hdr_offset 2048
[29257.183079] data_offset 4096
[29257.186984] image_seq 0
[29257.191166] hdr_crc 0x7f585319
[29257.195597] erase counter header hexdump:
[29257.200702] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 UBI#............................
[29257.200715] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 58 53 19 .............................XS.
[29257.200730] CPU: 0 PID: 3711 Comm: ubiattach Not tainted 5.8.3-kirkwood-tld-1 #1.0
[29257.209504] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[29257.216476] [<8010e824>] (unwind_backtrace) from [<8010ab50>] (show_stack+0x10/0x14)
[29257.225333] [<8010ab50>] (show_stack) from [<807a3378>] (validate_ec_hdr+0xdc/0x140)
[29257.234060] [<807a3378>] (validate_ec_hdr) from [<807a4134>] (ubi_io_read_ec_hdr+0x2a8/0x314)
[29257.243559] [<807a4134>] (ubi_io_read_ec_hdr) from [<807aa244>] (ubi_attach+0x338/0x1334)
[29257.252717] [<807aa244>] (ubi_attach) from [<8079d7d4>] (ubi_attach_mtd_dev+0x848/0xd6c)
[29257.261788] [<8079d7d4>] (ubi_attach_mtd_dev) from [<8079e5f4>] (ctrl_cdev_ioctl+0xe0/0x210)
[29257.271208] [<8079e5f4>] (ctrl_cdev_ioctl) from [<80282648>] (vfs_ioctl+0x20/0x38)
[29257.279755] [<80282648>] (vfs_ioctl) from [<80282fb4>] (ksys_ioctl+0xcc/0x784)
[29257.287950] [<80282fb4>] (ksys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x50)
[29257.296276] Exception stack(0x87bedfa8 to 0x87bedff0)
[29257.302421] dfa0: 00000003 7e825b4c 00000003 40186f40 7e825b4c 00000000
[29257.311566] dfc0: 00000003 7e825b4c 7e825eac 00000036 7e825eac 004780dc 004780dc 004780dc
[29257.320702] dfe0: 76e8d9a0 7e825b34 00463918 76e8d9ac
[29257.326437] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[29257.334148] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[29301.048157] UBIFS error (pid: 3712): cannot open "ubi0:root", error -19
[32604.549722] ubi0: attaching mtd4
[32604.562162] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[32604.571244] ubi0 error: validate_ec_hdr: bad EC header
[32604.577062] Erase counter header dump:
[32604.581990] magic 0x55424923
[32604.586417] version 1
[32604.590486] ec 1
[32604.594142] vid_hdr_offset 2048
[32604.598046] data_offset 4096
[32604.602663] image_seq 0
[32604.606316] hdr_crc 0x7f585319
[32604.611163] erase counter header hexdump:
[32604.615865] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 UBI#............................
[32604.615878] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 58 53 19 .............................XS.
[32604.615893] CPU: 0 PID: 3838 Comm: ubiattach Not tainted 5.8.3-kirkwood-tld-1 #1.0
[32604.624796] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[32604.632383] [<8010e824>] (unwind_backtrace) from [<8010ab50>] (show_stack+0x10/0x14)
[32604.641206] [<8010ab50>] (show_stack) from [<807a3378>] (validate_ec_hdr+0xdc/0x140)
[32604.649630] [<807a3378>] (validate_ec_hdr) from [<807a4134>] (ubi_io_read_ec_hdr+0x2a8/0x314)
[32604.659307] [<807a4134>] (ubi_io_read_ec_hdr) from [<807aa244>] (ubi_attach+0x338/0x1334)
[32604.668501] [<807aa244>] (ubi_attach) from [<8079d7d4>] (ubi_attach_mtd_dev+0x848/0xd6c)
[32604.677575] [<8079d7d4>] (ubi_attach_mtd_dev) from [<8079e5f4>] (ctrl_cdev_ioctl+0xe0/0x210)
[32604.686992] [<8079e5f4>] (ctrl_cdev_ioctl) from [<80282648>] (vfs_ioctl+0x20/0x38)
[32604.695537] [<80282648>] (vfs_ioctl) from [<80282fb4>] (ksys_ioctl+0xcc/0x784)
[32604.703734] [<80282fb4>] (ksys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x50)
[32604.712348] Exception stack(0x87b65fa8 to 0x87b65ff0)
[32604.718084] 5fa0: 00000003 7ec92b4c 00000003 40186f40 7ec92b4c 00000000
[32604.727335] 5fc0: 00000003 7ec92b4c 0048001c 00000036 0048001c 004910dc 004910dc 004910dc
[32604.736473] 5fe0: 76e6b9a0 7ec92b34 0047c918 76e6b9ac
[32604.742497] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[32604.749792] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[32934.338078] ubi0: attaching mtd4
[32934.342466] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[32934.351330] ubi0 error: validate_ec_hdr: bad EC header
[32934.357660] Erase counter header dump:
[32934.362096] magic 0x55424923
[32934.367074] version 1
[32934.370725] ec 1
[32934.374371] vid_hdr_offset 2048
[32934.379007] data_offset 4096
[32934.382915] image_seq 0
[32934.386992] hdr_crc 0x7f585319
[32934.391417] erase counter header hexdump:
[32934.396525] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 UBI#............................
[32934.396539] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 58 53 19 .............................XS.
[32934.396554] CPU: 0 PID: 3862 Comm: ubiattach Not tainted 5.8.3-kirkwood-tld-1 #1.0
[32934.404784] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[32934.412420] [<8010e824>] (unwind_backtrace) from [<8010ab50>] (show_stack+0x10/0x14)
[32934.421161] [<8010ab50>] (show_stack) from [<807a3378>] (validate_ec_hdr+0xdc/0x140)
[32934.429888] [<807a3378>] (validate_ec_hdr) from [<807a4134>] (ubi_io_read_ec_hdr+0x2a8/0x314)
[32934.439387] [<807a4134>] (ubi_io_read_ec_hdr) from [<807aa244>] (ubi_attach+0x338/0x1334)
[32934.448540] [<807aa244>] (ubi_attach) from [<8079d7d4>] (ubi_attach_mtd_dev+0x848/0xd6c)
[32934.457609] [<8079d7d4>] (ubi_attach_mtd_dev) from [<8079e5f4>] (ctrl_cdev_ioctl+0xe0/0x210)
[32934.467027] [<8079e5f4>] (ctrl_cdev_ioctl) from [<80282648>] (vfs_ioctl+0x20/0x38)
[32934.475276] [<80282648>] (vfs_ioctl) from [<80282fb4>] (ksys_ioctl+0xcc/0x784)
[32934.483594] [<80282fb4>] (ksys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x50)
[32934.492207] Exception stack(0x85109fa8 to 0x85109ff0)
[32934.498227] 9fa0: 00000003 7edbdb3c 00000003 40186f40 7edbdb3c 00000000
[32934.507367] 9fc0: 00000003 7edbdb3c 7edbdea4 00000036 7edbdea4 004930dc 004930dc 004930dc
[32934.516503] 9fe0: 76e759a0 7edbdb24 0047e918 76e759ac
[32934.522239] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[32934.529948] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[34645.525955] ubi0: attaching mtd4
[34645.530903] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[34645.539065] ubi0 error: validate_ec_hdr: bad EC header
[34645.545417] Erase counter header dump:
[34645.549847] magic 0x55424923
[34645.554729] version 1
[34645.558382] ec 1
[34645.562651] vid_hdr_offset 2048
[34645.566564] data_offset 4096
[34645.570908] image_seq 0
[34645.574557] hdr_crc 0x7f585319
[34645.578978] erase counter header hexdump:
[34645.584201] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 UBI#............................
[34645.584214] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 58 53 19 .............................XS.
[34645.584229] CPU: 0 PID: 3920 Comm: ubiattach Not tainted 5.8.3-kirkwood-tld-1 #1.0
[34645.593011] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[34645.599988] [<8010e824>] (unwind_backtrace) from [<8010ab50>] (show_stack+0x10/0x14)
[34645.608848] [<8010ab50>] (show_stack) from [<807a3378>] (validate_ec_hdr+0xdc/0x140)
[34645.617582] [<807a3378>] (validate_ec_hdr) from [<807a4134>] (ubi_io_read_ec_hdr+0x2a8/0x314)
[34645.627079] [<807a4134>] (ubi_io_read_ec_hdr) from [<807aa244>] (ubi_attach+0x338/0x1334)
[34645.636235] [<807aa244>] (ubi_attach) from [<8079d7d4>] (ubi_attach_mtd_dev+0x848/0xd6c)
[34645.645299] [<8079d7d4>] (ubi_attach_mtd_dev) from [<8079e5f4>] (ctrl_cdev_ioctl+0xe0/0x210)
[34645.654721] [<8079e5f4>] (ctrl_cdev_ioctl) from [<80282648>] (vfs_ioctl+0x20/0x38)
[34645.663266] [<80282648>] (vfs_ioctl) from [<80282fb4>] (ksys_ioctl+0xcc/0x784)
[34645.671560] [<80282fb4>] (ksys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x50)
[34645.679930] Exception stack(0x85153fa8 to 0x85153ff0)
[34645.686081] 3fa0: 00000003 7ea37b4c 00000003 40186f40 7ea37b4c 00000000
[34645.695226] 3fc0: 00000003 7ea37b4c 0043d01c 00000036 0043d01c 0044e0dc 0044e0dc 0044e0dc
[34645.704360] 3fe0: 76f009a0 7ea37b34 00439918 76f009ac
[34645.710097] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[34645.717807] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22


Ralph



Edited 1 time(s). Last edit at 10/20/2020 08:15PM by rsantag.
Re: Switch from Archlinux to debian
October 20, 2020 11:10PM
Ralph,

mtd4 is probably corrupted.

Try to see if you can attach mtd3:

ubiattach /dev/ubi_ctrl -m 3
ubinfo -a

And you don't need to modprobe it because UBI/UBIFS was configured into the kernel.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/20/2020 11:22PM by bodhi.
Re: Switch from Archlinux to debian
October 21, 2020 08:26AM
I was able to do ubiattach for mtd3

Quote

root@debian:~# ubiattach /dev/ubi_ctrl -m 3
UBI device number 0, total 64 LEBs (8257536 bytes, 7.9 MiB), available 40 LEBs (5160960 bytes, 4.9 MiB), LEB size 129024 bytes (126.0 KiB)

But I still get the "unknown filesystem type 'ubifs' error. (I just reused /mnt/ubi4 directory I'd created before)

Quote

root@debian:~# mount -t ubifs ubi0:failsafe /mnt/ubi4
mount: unknown filesystem type 'ubifs'

Now here is the interesting thing. I CAN boot my other Pogo to original OS (it is running the 2014 U-boot), so I know its root filesystem is OK, but I can't ubiattach it either

Quote

root@pogoplug:~# ubiattach /dev/ubi_ctrl -m 4
ubiattach: error!: cannot attach mtd4
error 22 (Invalid argument)
root@pogoplug:~#

Here is its corresponding dmesg

Quote

[2675637.141944] ubi0: attaching mtd4
[2675637.146671] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[2675637.155664] ubi0 error: validate_ec_hdr: bad EC header
[2675637.162031] Erase counter header dump:
[2675637.166636] magic 0x55424923
[2675637.171684] version 1
[2675637.175655] ec 5
[2675637.179935] vid_hdr_offset 2048
[2675637.184017] data_offset 4096
[2675637.188095] image_seq 0
[2675637.192449] hdr_crc 0x9c93f8ea
[2675637.197046] erase counter header hexdump:
[2675637.202416] 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 05 00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 UBI#............................
[2675637.202429] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9c 93 f8 ea ................................
[2675637.202444] CPU: 0 PID: 14911 Comm: ubiattach Not tainted 5.8.3-kirkwood-tld-1 #1.0
[2675637.211489] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[2675637.218933] [<8010e824>] (unwind_backtrace) from [<8010ab50>] (show_stack+0x10/0x14)
[2675637.227535] [<8010ab50>] (show_stack) from [<807a3378>] (validate_ec_hdr+0xdc/0x140)
[2675637.236564] [<807a3378>] (validate_ec_hdr) from [<807a4134>] (ubi_io_read_ec_hdr+0x2a8/0x314)
[2675637.246232] [<807a4134>] (ubi_io_read_ec_hdr) from [<807aa244>] (ubi_attach+0x338/0x1334)
[2675637.255743] [<807aa244>] (ubi_attach) from [<8079d7d4>] (ubi_attach_mtd_dev+0x848/0xd6c)
[2675637.265000] [<8079d7d4>] (ubi_attach_mtd_dev) from [<8079e5f4>] (ctrl_cdev_ioctl+0xe0/0x210)
[2675637.274601] [<8079e5f4>] (ctrl_cdev_ioctl) from [<80282648>] (vfs_ioctl+0x20/0x38)
[2675637.283322] [<80282648>] (vfs_ioctl) from [<80282fb4>] (ksys_ioctl+0xcc/0x784)
[2675637.291693] [<80282fb4>] (ksys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x50)
[2675637.300480] Exception stack(0x862bdfa8 to 0x862bdff0)
[2675637.306500] dfa0: 00000003 7ef28b4c 00000003 40186f40 7ef28b4c 00000000
[2675637.315949] dfc0: 00000003 7ef28b4c 7ef28eac 00000036 7ef28eac 004ed0dc 004ed0dc 004ed0dc
[2675637.325257] dfe0: 76e5f9a0 7ef28b34 004d8918 76e5f9ac
[2675637.331459] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[2675637.339231] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -2

Can I just dump /dev/mtd4 on this pogo (which does have uboot.mtd0.dockstar.original.kwb in its root) with dd and write it to the other one?

Ralph



Edited 1 time(s). Last edit at 10/21/2020 08:47AM by rsantag.
Re: Switch from Archlinux to debian
October 21, 2020 03:53PM
Ralph,

> But I still get the "unknown filesystem type
> 'ubifs' error. (I just reused /mnt/ubi4 directory
> I'd created before)

Interesting indeed! perhaps it is incompatibiltity issue, not corruption. I have not looked into this because there are many other solution for rescue systems. See the Wiki,

Quote
https://forum.doozan.com/read.php?2,23630
Rescue Systems

Rescue System V2 (Original)
MacPlug & SMBPLug
Rescue System Pogo V3
Rescue System V4, using a custom LEDE firmware (BETA)
Rescue System for Pogo E02 using LEDE/OpenWrt (Install with Serial Console)
Rescue System for Pogo V4/Mobile using OpenWrt (Install with NetConsole)


> Can I just dump /dev/mtd4 on this pogo (which does
> have uboot.mtd0.dockstar.original.kwb in its root)
> with dd and write it to the other one?

Definitely. But you want to use nanddump, not dd. Again in the Wiki,

Quote
https://forum.doozan.com/read.php?2,23630
Booting Debian on Pogoplug

How to set up U-Boot for booting in multiple drives configuration
Backup and Restore NAND mtds
UART Booting HowTo for Selected Kirkwood Devices
Migrating from Arch to Debian?
How to boot new Debian rootfs using stock u-boot tftp - Pogo E02
How to boot new Debian rootfs on USB using stock u-boot - NSA325
How to boot Debian rootfs on a GPT HDD with stock u-boot (kernel files stored in HDD raw sector), 2nd HowTo post
How to boot Pogo V3 from SATA (to unbrick), 2nd How to Post
How to install U-Boot for Pogoplug V3 (OXNAS OX820) from OpenWRT

On 2nd box where you can boot stock OS,
nanddump --noecc --omitoob -f mtd4.pogo_v4 /dev/mtd4

and restore it with nandwrite on the box that you cannot boot to stock OS,
flash_erase /dev/mtd4
nandwrite -n /dev/mtd4 mtd4.pogo_v4

Note: make sure the -n option for nandwrite is same as --noecc, and the default is --omitoob (nandwrite versions might have different default options and syntax).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 21, 2020 04:25PM
Yep, -n is same as --noecc, and it appears that --omitoob is default.
The only oob options it gives are -oob and -onlyoob

Quote

root@debian:~# nandwrite -h
Usage: nandwrite [OPTION] MTD_DEVICE [INPUTFILE|-]
Writes to the specified MTD device.

-a, --autoplace Use auto OOB layout
-k, --skip-all-ffs Skip pages that contain only 0xff bytes
-m, --markbad Mark blocks bad if write fails
-n, --noecc Write without ecc
-N, --noskipbad Write without bad block skipping
-o, --oob Input contains oob data
-O, --onlyoob Input contains oob data and only write the oob part
-s addr, --start=addr Set output start address (default is 0)
-p, --pad Pad writes to page size
-b, --blockalign=1|2|4 Set multiple of eraseblocks to align to
--input-skip=length Skip |length| bytes of the input file
--input-size=length Only read |length| bytes of the input file
-q, --quiet Don't display progress messages
-h, --help Display this help and exit
-V, --version Output version information and exit

The bootcmd_exec I posted previously looks correct, right?

Quote

bootcmd_exec=if run load_uimage; then if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; else run bootcmd_pogo; fi

I put it in /boot/uEnv.txt on my debian root partition and rebooted to insure debian still boots OK (it did). But of course I have to set it with fw_setenv for it to actually boot the old imbedded OS, and want to make sure I don't brick it such that it won't boot either one.

Also, if I'm understanding it correctly, /proc/mtd shows erasesize of 00020000, or 128K. So, since this is a 112Mb partition, do I use block count of 896, i.e.

flash_erase /dev/mtd4 0 896


Ralph



Edited 3 time(s). Last edit at 10/21/2020 04:55PM by rsantag.
Re: Switch from Archlinux to debian
October 21, 2020 05:08PM
Ralph,

> The bootcmd_exec I posted previously looks
> correct, right?
>
>
Quote

bootcmd_exec=if run load_uimage; then if
> run load_initrd; then if run load_dtb; then bootm
> $load_uimage_addr $load_initrd_addr
> $load_dtb_addr; else bootm $load_uimage_addr
> $load_initrd_addr; fi; else if run load_dtb; then
> bootm $load_uimage_addr - $load_dtb_addr; else
> bootm $load_uimage_addr; fi; fi; else run
> bootcmd_pogo; fi


The bootcmd_exec change above looks OK. But don't use uEnv.txt. Because the idea with rescue boot is that when the rootfs drive is corrupted, or not present, it will boot into stock OS on mtd4.

So test it with serial console only by setting bootcmd_exec and then boot.

setenv bootcmd_exec 'if run load_uimage; then if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; else run bootcmd_pogo; fi'

boot

And then after a few successful tests, you would boot into Debian and set it permanently:

fw_setenv bootcmd_exec 'if run load_uimage; then if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; else run bootcmd_pogo; fi'

> Also, if I'm understanding it correctly, /proc/mtd
> shows erasesize of 00020000, or 128K. So, since
> this is a 112Mb partition, do I use block count of
> 14336, i.e.
>
> flash_erase /dev/mtd4 0 14336

Use the parameter 0 to tell flash_erase you want to erase the whole partition (flash_eraseall was deprecated):
flash_erase /dev/mtd4 0

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 21, 2020 07:17PM
OK, "flash_erase /dev/mtd4 0 0" worked, thanks.

I don't currently have a serial console on this device. But here's what I was thinking re: /boot/uEnv.txt:

The first thing bootcmd runs is bootcmd_uenv, so after that completes, bootcmd_exec should be set to what is in uEnv.txt. If so, then if the pogo successfully boots (it does), then at a minimum that bootcmd_exec will successfully boot debian. Then set bootcmd_exec with fw_setenv and remove /boot/uEnv.txt. Power down, remove SD card, and see if it will boot to the old CE OS. If not, power off, put SD back in, and it should at least still boot to debian, and I can try to figure out why old OS didn't boot.

Assuming I set with fw_setenv to EXACTLY what was in uEnv.txt, it shouldn't brick it, Do you see any errors in that logic?

[10/22/20 update]
OK, I decided to try something that I can easily undo. I put this in /boot/uEnv.txt to see if it would boot the old Pogo OS.

bootcmd_exec=run bootcmd_pogo.

and bootcmd_pogo is set to this:

root@debian:~# fw_printenv bootcmd_pogo
bootcmd_pogo=if ubi part root 2048 && ubifsmount ubi:rootfs && ubifsload 0x800000 uboot.mtd0.dockstar.original.kwb ; then go 0x800200; fi

When I rebooted, it never made it past blinking-green, and my router didn't show it being up on the network. Changed back to previous proposed value for bootcmd_exec and debian booted fine.

Hmmm.... Theoretically that should have worked, yes?

Ralph



Edited 1 time(s). Last edit at 10/22/2020 07:21AM by rsantag.
Re: Switch from Archlinux to debian
October 23, 2020 10:47PM
I enabled netconsole and tried booting with "bootcmd_exec=run bootcmd_pogo" in /boot/uEnv.txt again. This is what I see in the console log (I stripped out 900+ of the "ubi0: fixable bit-flip detected at PEB ###" errors to keep this post a little smaller

Quote

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:34:01 -0700)
Pogoplug V4
gcc (Debian 6.3.0-18) 6.3.0 20170516
GNU ld (GNU Binutils for Debian) 2.28
Hit any key to stop autoboot: 0
Initializing devices...
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found

Reset IDE: ide_preinit failed

MMC rescan: current device # 0 initialized OK
Loading envs from usb 0...
** Bad device usb 0 **
Loading envs from usb 1...
** Bad device usb 1 **
Loading envs from usb 2...
** Bad device usb 2 **
Loading envs from usb 3...
** Bad device usb 3 **
Loading envs from ide 0...
** Bad device ide 0 **
Loading envs from ide 1...
** Bad device ide 1 **
Loading envs from ide 2...
** Bad device ide 2 **
Loading envs from ide 3...
** Bad device ide 3 **
Loading envs from mmc 0...
30 bytes read in 16 ms (1000 Bytes/s)
... envs loaded
importing envs ...
running scan_disk ...
Scan device usb
device usb 0:1
** Bad device usb 0 **
device usb 1:1
** Bad device usb 1 **
device usb 2:1
** Bad device usb 2 **
device usb 3:1
** Bad device usb 3 **
Scan device ide

Reset IDE: ide_preinit failed
device ide 0:1
** Bad device ide 0 **
device ide 1:1
** Bad device ide 1 **
device ide 2:1
** Bad device ide 2 **
device ide 3:1
** Bad device ide 3 **
Scan device mmc

MMC rescan: current device # 0 initialized OK
device mmc 0:1
1 bytes read in 8 ms (0 Bytes/s)
Found bootable drive on mmc 0
ubi0: attaching mtd1
ubi0: fixable bit-flip detected at PEB 0
ubi0: fixable bit-flip detected at PEB 1
ubi0: fixable bit-flip detected at PEB 1
ubi0: fixable bit-flip detected at PEB 2
ubi0: fixable bit-flip detected at PEB 3
ubi0: fixable bit-flip detected at PEB 4
ubi0: fixable bit-flip detected at PEB 5
ubi0: fixable bit-flip detected at PEB 6
ubi0: fixable bit-flip detected at PEB 7
ubi0: fixable bit-flip detected at PEB 8
ubi0: fixable bit-flip detected at PEB 9
ubi0: fixable bit-flip detected at PEB 10
ubi0: fixable bit-flip detected at PEB 10
ubi0: fixable bit-flip detected at PEB 11
ubi0: fixable bit-flip detected at PEB 12
ubi0: fixable bit-flip detected at PEB 13
ubi0: fixable bit-flip detected at PEB 14
ubi0: fixable bit-flip detected at PEB 14
...
ubi0: fixable bit-flip detected at PEB 875
ubi0: fixable bit-flip detected at PEB 876
ubi0: fixable bit-flip detected at PEB 877
ubi0: fixable bit-flip detected at PEB 878
ubi0: fixable bit-flip detected at PEB 879
ubi0: fixable bit-flip detected at PEB 880
ubi0: fixable bit-flip detected at PEB 881
ubi0: fixable bit-flip detected at PEB 882
ubi0: fixable bit-flip detected at PEB 883
ubi0: fixable bit-flip detected at PEB 884
ubi0: fixable bit-flip detected at PEB 885
ubi0: fixable bit-flip detected at PEB 886
ubi0: fixable bit-flip detected at PEB 887
ubi0: fixable bit-flip detected at PEB 888
ubi0: fixable bit-flip detected at PEB 889
ubi0: fixable bit-flip detected at PEB 890
ubi0: fixable bit-flip detected at PEB 891
ubi0: fixable bit-flip detected at PEB 892
ubi0: fixable bit-flip detected at PEB 893
ubi0: fixable bit-flip detected at PEB 894
ubi0: fixable bit-flip detected at PEB 894
ubi0: scanning is finished
UBI init error 22
Pogov4>

Last thing it does before the errors is attach mtd1, but 894 is the number of blocks I wrote to /dev/mtd4 with nandwrite, so is mtd4 where the problem is? I pulled up my command history and this is what I ran:

nandwrite -n /dev/mtd4 mtd4.pogo_v4

Ralph



Edited 1 time(s). Last edit at 10/23/2020 10:48PM by rsantag.
Re: Switch from Archlinux to debian
October 24, 2020 12:09AM
Ralph,

> I enabled netconsole and tried booting with
> "bootcmd_exec=run bootcmd_pogo" in /boot/uEnv.txt
> again.

Cool, netconsole is all you need.

> Last thing it does before the errors is attach
> mtd1, but 894 is the number of blocks I wrote to
> /dev/mtd4 with nandwrite, so is mtd4 where the
> problem is?

That mtd1 being attached is not accurate. It really tried to attach mtd4.

At netconsole prompt, execute

setenv partition nand0,4
and then

mtdparts
You should see which mtd is active.

And then switch between partitions to see if they are OK.

ubi part failsafe
mtdparts

ubi part root
mtdparts

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 24, 2020 09:36AM
First mtdparts, root parition shows active

Quote

Pogov4> setenv partition nand0,4
setenv partition nand0,4
Pogov4> mtdparts
mtdparts

device nand0 <orion_nand>, # parts = 5
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: uImage 0x00300000 0x00200000 0
2: uImage2 0x00300000 0x00500000 0
3: failsafe 0x00800000 0x00800000 0
4: root 0x07000000 0x01000000 0

active partition: nand0,4 - (root) 0x07000000 @ 0x01000000

defaults:
mtdids : none
mtdparts: none
Pogov4>

ubi part failsafe fails with error 22, and root is still active

Quote

Pogov4> ubi part failsafe
ubi part failsafe
ubi0: attaching mtd1
UBI init error 22
Pogov4> mtdparts
mtdparts

device nand0 <orion_nand>, # parts = 5
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: uImage 0x00300000 0x00200000 0
2: uImage2 0x00300000 0x00500000 0
3: failsafe 0x00800000 0x00800000 0
4: root 0x07000000 0x01000000 0

active partition: nand0,4 - (root) 0x07000000 @ 0x01000000

defaults:
mtdids : none
mtdparts: none
Pogov4>

ubi part root gives all the fixable bit-flip errors again, and root still active

Quote

.....
ubi0: fixable bit-flip detected at PEB 892
ubi0: fixable bit-flip detected at PEB 893
ubi0: fixable bit-flip detected at PEB 894
ubi0: fixable bit-flip detected at PEB 894
ubi0: scanning is finished
UBI init error 22
Pogov4> mtdparts
mtdparts

device nand0 <orion_nand>, # parts = 5
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: uImage 0x00300000 0x00200000 0
2: uImage2 0x00300000 0x00500000 0
3: failsafe 0x00800000 0x00800000 0
4: root 0x07000000 0x01000000 0

active partition: nand0,4 - (root) 0x07000000 @ 0x01000000

defaults:
mtdids : none
mtdparts: none
Pogov4>

uImage and uImage2 get the same error 22

Quote

Pogov4> ubi part uImage
ubi part uImage
ubi0: attaching mtd1
ubi0: scanning is finished
UBI init error 22
Pogov4> ubi part uImage2
ubi part uImage2
ubi0: attaching mtd1
ubi0: scanning is finished
UBI init error 22
Pogov4> mtdparts
mtdparts

device nand0 <orion_nand>, # parts = 5
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: uImage 0x00300000 0x00200000 0
2: uImage2 0x00300000 0x00500000 0
3: failsafe 0x00800000 0x00800000 0
4: root 0x07000000 0x01000000 0

active partition: nand0,4 - (root) 0x07000000 @ 0x01000000

defaults:
mtdids : none
mtdparts: none
Pogov4>



Edited 1 time(s). Last edit at 10/24/2020 09:50AM by rsantag.
Re: Switch from Archlinux to debian
October 24, 2020 03:30PM
Ralph,

uImage and uImage2 are raw binary, like u-boot in mtd0, not UBIFS.

Perhaps it is faster that you install rescue system and not bother with stock FW.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 24, 2020 05:09PM
Which partition does openwrt get installed on?

Is this what's documented in part 3 of https://forum.doozan.com/read.php?4,100764,101409#msg-101409

Ralph
Re: Switch from Archlinux to debian
October 24, 2020 09:46PM
OK, reading through that openwrt thread, it looks like everything after the u-boot partition gets combined into a single partition for the new openwrt install. So, since I've already got uboot set up, I think this is what I would do:

From debian:
Quote

fw_setenv mtdparts 'mtdparts=orion_nand:0x200000@0x0(u-boot),-@0x200000(ubi)'
fw_setenv partition 'nand0,0'
fw_setenv set_bootargs_owrt 'setenv bootargs console=ttyS0,115200 $mtdparts'
fw_setenv bootcmd_owrt 'run set_bootargs_owrt; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000'
fw_setenv bootcmd 'run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_owrt'
fw_setenv mtdids nand0=orion_nand

I already have netconsole setup, so reboot and then hit enter on netconsole to stop autoboot.
Then, in console, do this (checking printenv output)
Quote

setenv bootargs console=ttyS0,115200 $mtdparts
printenv
nand erase.part ubi
usb reset
fatload usb 0 0x800000 uImage
bootm 0x800000

Where uImage is on a USB drive formated FAT32.

This shouild boot into openwrt, but only running in RAM, not written to UBI yet.
After it comes up, do this (again, doing sanity check on fw_printenv and cat /proc/mtd)
Quote

echo '/dev/mtd0 0xc0000 0x20000 0x20000' > /etc/fw_env.config
fw_printenv
cat /proc/mtd
[get file below using wget, or whatever]
sysupgrade openwrt-19.07.4-kirkwood-cloudengines_pogoplugv4-squashfs-sysupgrade.bin

And at this point it should actually install to UBI and reboot? Guessing at this point it will boot back into debian since my SD card is still in, but if I poweroff, remove SD card, then power it up, it should boot into openwrt.

Have I got this all correct?

Ralph
Re: Switch from Archlinux to debian
October 24, 2020 11:24PM
Ralph,

Quote

Have I got this all correct?

Yes, looks good.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Switch from Archlinux to debian
October 25, 2020 11:11AM
Well, that was really easy.
And OpenWrt is very cool!

Thanks very much for your help, Bodhi!

Ralph
Re: Switch from Archlinux to debian
October 25, 2020 01:52PM
And to wrap things up...

I decided to install the 2017.07 uboot on my other Pogoplug, which was running 2014.07 uboot.
It has /uboot.mtd0.dockstar.original.kwb on /dev/mtd4 (root), so was still able to boot to the original
OS using boot chaining.

After that was successfully install, I added bootcmd_pogo and modified bootcmd_exec as follows:

Quote

fw_setenv bootcmd_exec 'if run load_uimage; then if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; else run bootcmd_pogo; fi'
fw_setenv bootcmd_pogo 'if ubi part root 2048 && ubifsmount ubi:rootfs && ubifsload 0x800000 uboot.mtd0.dockstar.original.kwb ; then go 0x800200; fi'

Powered down, pulled out SD card, powered up, and was able to boot to the original OS

Here is console output

Quote

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:34:01 -0700)
Pogoplug V4
gcc (Debian 6.3.0-18) 6.3.0 20170516
GNU ld (GNU Binutils for Debian) 2.28
Hit any key to stop autoboot: 0
Initializing devices...
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found

Reset IDE: ide_preinit failed
Card did not respond to voltage select!
mmc_init: -95, time 12
Loading envs from usb 0...
** Bad device usb 0 **
Loading envs from usb 1...
** Bad device usb 1 **
Loading envs from usb 2...
** Bad device usb 2 **
Loading envs from usb 3...
** Bad device usb 3 **
Loading envs from ide 0...
** Bad device ide 0 **
Loading envs from ide 1...
** Bad device ide 1 **
Loading envs from ide 2...
** Bad device ide 2 **
Loading envs from ide 3...
** Bad device ide 3 **
Loading envs from mmc 0...
Card did not respond to voltage select!
mmc_init: -95, time 10
Card did not respond to voltage select!
mmc_init: -95, time 10
** Bad device mmc 0 **
Loading envs from mmc 1...
MMC Device 1 not found
MMC Device 1 not found
** Bad device mmc 1 **
Loading envs from mmc 2...
MMC Device 2 not found
MMC Device 2 not found
** Bad device mmc 2 **
Loading envs from mmc 3...
MMC Device 3 not found
MMC Device 3 not found
** Bad device mmc 3 **
running scan_disk ...
Scan device usb
device usb 0:1
** Bad device usb 0 **
device usb 1:1
** Bad device usb 1 **
device usb 2:1
** Bad device usb 2 **
device usb 3:1
** Bad device usb 3 **
Scan device ide

Reset IDE: ide_preinit failed
device ide 0:1
** Bad device ide 0 **
device ide 1:1
** Bad device ide 1 **
device ide 2:1
** Bad device ide 2 **
device ide 3:1
** Bad device ide 3 **
Scan device mmc
Card did not respond to voltage select!
mmc_init: -95, time 11
device mmc 0:1
Card did not respond to voltage select!
mmc_init: -95, time 11
Card did not respond to voltage select!
mmc_init: -95, time 11
** Bad device mmc 0 **
device mmc 1:1
MMC Device 1 not found
MMC Device 1 not found
** Bad device mmc 1 **
device mmc 2:1
MMC Device 2 not found
MMC Device 2 not found
** Bad device mmc 2 **
device mmc 3:1
MMC Device 3 not found
MMC Device 3 not found
** Bad device mmc 3 **
loading uImage ...
** Bad device usb 0 **
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=4", size 112 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 895, bad PEBs: 1, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 5/4, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 0, total reserved PEBs: 895, PEBs reserved for bad PEB handling: 8
Loading file 'uboot.mtd0.dockstar.original.kwb' to addr 0x00800000...
ubi0: fixable bit-flip detected at PEB 767
ubi0: schedule PEB 767 for scrubbing
ubi0: fixable bit-flip detected at PEB 767
ubi0: scrubbed PEB 767 (LEB 0:185), data moved to PEB 779
Done
## Starting application at 0x00800200 ...

So, an alternative recovery environment to openwrt, as long as uboot.mtd0.dockstar.original.kwb
is downloaded to root while doing uboot install and still logged into original OS.

Ralph



Edited 1 time(s). Last edit at 10/25/2020 02:02PM by rsantag.
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: