Welcome! Log In Create A New Profile

Advanced

I can't ssh into nand but I can boot to stick how do I edit nand files

Posted by rgtaa 
I can't ssh into nand but I can boot to stick how do I edit nand files
November 28, 2010 07:17PM
I have a tonidoplug that I just installed Jeff's installer to and I used option 3 , which is pogoplug v1, sheevaplug. But I can't ssh into NAND but I can boot into usb stick.

How do I edit some of the files on NAND so I can start up ssh again from NAND. What are the commands from usb stick that will show the files on NAND.

Since I have 2 tonidoplugs, I figure I will copy the correct settings from my NAND working one back into the one I can't get into.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 28, 2010 10:46PM
I'm not familiar with the tonidoplug, but if you can boot to your USB stick, you should be able to mount the NAND as a file system and modify it. But, what file system is on the tonidoplug? JFFS2 or UBIFS? Also, without knowing what is wrong, how do you intend to fix it?

To mount a jffs2 file system, you'll need to know the device associated with it. ("cat /proc/mtd") Then I think you simply:

# mount /dev/mtdblock2 /mnt -t jffs2 ## presuming the file system is on mtdblock2

To mount a UBIFS FS is more complicated.

But again, without knowing the reason why the boot fails, or the ssh doesn't work, I wouldn't want to be changing things blindly. Unfortunately, this is something better suited for serial console debugging, or maybe the netconsole if the problem is in the uBoot.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 29, 2010 01:26PM
The tonidoplug would be same as sheevaplug, same chipset.

I did the
# mount /dev/mtdblock2 /mnt -t jffs2 ## presuming the file system is on mtdblock2

command and it came back that it can do superblocks or something like that.

What would be the command for gaining NAND access for the dockstar, because maybe it's the same.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 29, 2010 04:43PM
1. You say you can't ssh into your Plug when booted from the NAND. What evidence do you have that it is even alive? Can you ping it?

2. What OS and what uBoot do you have on the NAND? Can you dump the uBoot's environment?

3. What is the output of "cat /proc/mtd" when running from your thumb drive?
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 29, 2010 09:33PM
Thanks restamp for helping me with this.

1) how would I ping it? Is that serial cable stuff, I haven't done anything with serial cable yet, although I did buy the ca 42 cable.
2) os is ubuntu 9.4 that comes with the tonidoplug (sheevaplug) and I put Jeff's bootloader on it. That was probably wrong to do, since I was able to boot into usb stick before I did jeff's bootloader, but my dockstars are all built with same images, and tonidoplug couldn't boot those images, now it can. For the bootloader I forced it , and used the pogo v1 setting, since tonidoplug /sheevaplug/pogo v1/ are all build the same way. I'm not sure about dumping uboot's environment, how would I do that, is there a guide to do that and then restore it back?

3)this is what I get as output.
cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "rootfs"
mtd3: 1db00000 00020000 "data"

The tonidoplug has 516 meg on nand.

I do have another tonidoplug that works, so maybe there is a way to clone it and place on the "bad" tonidoplug.
I could do backup of nand from good one , but I don't know how to load the good nand image on to the other one, yet.

I was hoping I could go into the NAND through the usb stick boot, what do you suggest?



Edited 1 time(s). Last edit at 11/29/2010 09:36PM by rgtaa.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 29, 2010 10:39PM
rgtaa, I googled tonidoplug, but didn't find the particulars. If it is truly like a SheevaPlug, it should have a mini-USB connector that you can attach a cable from to your PC and examine the uBoot and console there. If it has that, and an on-board JTAG, you might be able to use the Sheeva Installer to restore your Plug to sanity, but without knowing more about the tonidoplug, I'm only guessing.

I suspect when you blasted Jeff's new uBoot into your tonidoplug, it probably changed the mdtparts. If so, the NAND uImage may still be on your Plug, but you aren't looking for it in the right place anymore. Go to your working Plug and boot it from NAND, and then do a "cat /proc/mtd" there. Are they the same? If not, you'll need to either reload everything or modify Jeff's uBoot's mtdparts environment variable. But, you have to be careful not to change the partitions the uBoot itself uses, or you'll wind up with a completely bricked Plug.

Good luck.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 30, 2010 09:52AM
ok I can netcat into it and this is what I get, does this help?

U-Boot 2010.09 (Oct 23 2010 - 11:49:22)
Marvell-Dockstar/Pogoplug by Jeff Doozan
Hit any key to stop autoboot: 0
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 1 Storage Device(s) found
Loading file "/rescueme" from usb device 0:1 (usbda1)
** File not found /rescueme
reading /rescueme.txt

** Unable to read "/rescueme.txt" from usb 0:1 **
Creating 1 MTD partitions on "nand0":
0x000002500000-0x000020000000 : "mtd=3"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI error: ubi_read_volume_table: the layout volume was not found
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
UBI init error -22
Loading file "/boot/uImage" from usb device 0:1 (usbda1)
1 bytes read
Found bootable drive on usb 0:1
Loading file "/boot/uImage" from usb device 0:1 (usbda1)
2676840 bytes read
Loading file "/boot/uInitrd" from usb device 0:1 (usbda1)
** File not found /boot/uInitrd
## Booting kernel from Legacy Image at 00800000 ...
Image Name: Linux-2.6.35.7-dockstar
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2676776 Bytes = 2.6 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK




This is the good tonidoplug cat /proc/mtd that boots from nand works when I was using debian boot stick
root@debian:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "root"
mtd3: 1db00000 00020000 "data"





And this is the cat/proc/mtd from the NON-working tondioplug taken from debian usb boot drive
cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "rootfs"
mtd3: 1db00000 00020000 "data"



This is the good tonidoplug cat/proc/mtd taken from NAND (you can see the tonidoplug root:)
root@TonidoPlug:/tmp# cat /proc/mtd
dev: size erasesize name
mtd0: 00400000 00020000 "uImage"
mtd1: 1fb00000 00020000 "rootfs"



Here are the commands I used from working tonidoplug so I saved Nand partitions.

cd /tmp
mkdir usb
mount /dev/sda1 /tmp/usb
wget http://plugapps.com/os/pogoplug/uboot/nanddump
chmod +x nanddump
./nanddump -nf usb/mtd0 /dev/mtd0
./nanddump -nf usb/mtd1 /dev/mtd1
umount /dev/sda1

So is there a program to take the nanddump and load it back unto NAND?



Edited 8 time(s). Last edit at 11/30/2010 12:05PM by rgtaa.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 30, 2010 02:46PM
The net console output looks odd to me. It seems like you have a thumb drive attached, but the drive only contains uImage, and not uInitrd. Were you trying to boot to a thumb drive when you captured this output, or were you trying to boot to the NAND here? Were any USB devices plugged in at the time? I've never seen this before.

It's difficult to diagnose this remotely. If the netcat output is an attempt to boot from the bad Plug, it appears that the NAND kernel is being loaded and checksums correctly. I'm guessing -- and this is only a guess -- that Jeff's uBoot changed the layout of the Plug's NAND, but didn't alter either the uImage or rootfs. It looks like it is using the Dockstar mapping, which has two partitions, a "rootfs" and "data", whereas my SheevaPlug (and I suspect yours, too) maps all of the remaining NAND into the "rootfs" and has no data partition.

Here's what I would try: I believe your uboot's environment variable mtdparts is set to "mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)". I'd try setting it instead to "mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)" and then seeing if it will boot.

Your next question will be how to set this variable. If "fw_printenv" works from the booted USB drive on your bad plug, you might try (after verifying that mtdparts really is set as above):
Quote

fw_setenv mtdparts 'mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)'
Otherwise, you'll have to interrupt the uBoot from netcat and make the change there.

Bear in mind, this is only a suggestion. It may not be the underlying cause. I take no responsibility for any more harm you may do to your Plug if you try this. If anyone else has any suggestions, I'd heartily suggest they throw them out. Good luck with it.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 30, 2010 03:10PM
Gee , this is what I typed in from debian stick.

root@debian:~# mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)

-bash: syntax error near unexpected token `('


then I typed in this:
root@debian:~# "mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)"

-bash: mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs): command not found

then I typed in this:

root@debian:~# fw_setenv mtdparts 'mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)'

Read error on /dev/mtd0: Cannot allocate memory

Are the commands right? or do I need to install something beforehand, not sure. But thanks for the suggestions.

I just rebooted and here is :
root@debian:~# fw_printenv
ethact=egiga0
bootdelay=3
baudrate=115200
mainlineLinux=yes
console=ttyS0,115200
led_init=green blinking
led_exit=green off
led_error=orange blinking
mtdids=nand0=orion_nand
partition=nand0,2
stdin=serial
stdout=serial
stderr=serial
rescue_installed=0
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; na nd read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 / rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd ; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0 :rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && u bifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if t est $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_ scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; se tenv usb_root /dev/$dev; fi; done
usb_scan_list=1 2 3 4
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_init=run usb_scan
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_ rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext 2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; el se bootm 0x800000; fi
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
arcNumber=2097
serverip=192.168.1.146
ipaddr=192.168.1.114
if_netconsole=ping $serverip
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; se tenv stdout nc; setenv stderr nc; version;
preboot=run if_netconsole start_netconsole
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),-(rootfs)
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
November 30, 2010 10:23PM
Well, it looks as if you succeeded in installing the change. It would have been nice if you had done the fw_printenv before you did the fw_setenv, so that you knew what to set mtdparts back to if the change didn't fix things. But I really suspect the new value is the correct one for your Plug. Can you boot to the NAND now? If not, then it must be some other problem.
Re: I can't ssh into nand but I can boot to stick how do I edit nand files
December 01, 2010 07:33AM
No , I'm still not able to start from Nand.

I have 2 tonidoplugs, and I was able to do a Nanddump of the good one and it has 4 mtd sections when I do the nanddump from usb boot debian , but only 2 sections if I log in from NAND, so I'm hoping I can restore it to non working one , but there is no program that I can find that can do that.

It is strange we are told to make nand backup right away but are not given nand restore, because that would fix this problem.

The other way is to edit the files on nand that are creating the problem, but just restoring the nand via usb stick seems easiest.



Edited 1 time(s). Last edit at 12/01/2010 08:55AM by rgtaa.
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: