Welcome! Log In Create A New Profile

Advanced

Howto: Install readonly emdebian on NAND

Posted by Jeff 
Hendrik
Re: Install readonly embdebian on NAND
September 01, 2010 01:04PM
Hi Again,

I mounted the stick to /tmp/tmp1 and then
Pogoplug:/$ /tmp/tmp1/usr/sbin/ubimkvol /dev/ubi0 -m -N rootfs
ubimkvol: error!: UBI is not present in the system
Pogoplug:/$ modprobe ubi
modprobe: cannot parse modules.dep

Any Ideas?

Regards,
Hendrik
Re: Install readonly embdebian on NAND
September 01, 2010 01:39PM
You're in the Pogoplug environment, you need to be in Debian. Start over from the beginning and follow the steps exactly.
Hendrik
Re: Install readonly embdebian on NAND
September 01, 2010 01:56PM
Hi,
thanks, I'm doing that now.
The only thing, that I might be doing wrong is the step "boot into debian". How do I do this? How do I select what to boot and how do I determine, what was actually booted?

Greetings,
Hendrik
Hendrik
Re: Install readonly embdebian on NAND
September 01, 2010 03:57PM
Hi again,

I now tried it with a different USB-Stick.
Now, after the first step, debian boots.
But still, I'm not successful with the next step:
flash_eraseall /dev/mtd3
ubiformat /dev/mtd3 -y
ubiattach /dev/ubi_ctrl -m 3
ubimkvol /dev/ubi0 -m -N rootfs
Result:
root@debian:~# flash_eraseall /dev/mtd3
flash_eraseall: /dev/mtd3: No such file or directory
root@debian:~# flash_eraseall /dev/mtd3
flash_eraseall: /dev/mtd3: No such file or directory

Do you see my mistake?

Regards,
Hendrik
ecc
Re: Install readonly embdebian on NAND
September 01, 2010 09:50PM
Hendrik Wrote:
-------------------------------------------------------
> Result:
> root@debian:~# flash_eraseall /dev/mtd3
> flash_eraseall: /dev/mtd3: No such file or
> directory
> root@debian:~# flash_eraseall /dev/mtd3
> flash_eraseall: /dev/mtd3: No such file or
> directory

Your kernel doesn't think there is an mtd3 partition, probably because the mtdparts kernel parameter wasn't passed correctly. (Check the output of "cat /proc/cmdline" and "cat /proc/mtd" to make sure.)

See Jeff's earlier reply in this thread.
Hendrik
Re: Install readonly embdebian on NAND
September 02, 2010 01:35AM
Hi,

this worked. Thanks!

Maybe you could add a hint how to do a backup of the install to the first article?

Regards,
Hendrik
Jeffrey
Re: Install readonly embdebian on NAND
September 06, 2010 01:45PM
Hello,

I would like to install some software, that is quite big. As it is not used very often, int would be no problem to install it on the attached Harddisk, that could spool up as soon as I use the software.

But how can I manage this? As mentioned by someone before, an overlay filesystem would be great. But I have no clue how to overlay it over the current system.

Can someone help?

Greetings,
Hendrik
Re: Install readonly embdebian on NAND
September 07, 2010 08:52PM
I'm in the same position as you Jeffery, except i want to put the core in nand for reboot integrity and shove the mediaserver/mysql on the usbHD along with the media. this approach i guess could incorporate a simple disk check/fix in the bootup script as well ... with young kids around i experience very regular boot ups ! and theres no way it will all fit in nand (never mind about all the read/write access needed)
Hendrik
Re: Install readonly embdebian on NAND
September 08, 2010 12:10PM
Hi,

so, what I got working was to join two directories to one with aufs:

modprobe aufs
mkdir /mnt/test1
touch /mnt/test1/oneFile
mkdir /mnt/test2
mkdir /mnt/unified
mount none /mnt/unified -t aufs -o br:/mnt/test2=rw:/mnt/test1=ro
cd /mnt/unified
ls
touch secondFile
ls /mnt/test1
ls /mnt/test2

/mnt/test1 is now read-only (thus could be the flash), whereas all modifications are written to /mnt/test2 (could be the stick).

Next step would be to make this possible for "/" and to make sure, that this is done early enough in the boot process.

Greetings,
Hendrik
Hendrik
Re: Install readonly embdebian on NAND
September 08, 2010 03:33PM
Hi,

with a
mount none /mnt/unified -t aufs -o br:/mnt/test2=rw:/1=ro
chroot /mnt/unified

It is possible to simulate what I want to acheive.
Now the question is, how to replace the chroot by something permanent/global/during boot.

Greetings,
Hendrik
RayK
Re: Install readonly embdebian on NAND
September 08, 2010 11:30PM
Thanks Jeff for the very informative forum. I'm now at the step right after:

root@DockStar:~# mount -t ubifs ubi0:rootfs /tmp/ubifs

I am fortunate in that I have a DockStar with a larger than standard NAND as issuing a df -h results in the following:

Filesystem Size Used Avail Use% Mounted on
rootfs 3.5G 148M 3.2G 5% /
none 60M 40K 60M 1% /dev
/dev/sda1 3.5G 148M 3.2G 5% /
tmpfs 62M 0 62M 0% /tmp
tmpfs 62M 12K 62M 1% /var/log
tmpfs 62M 16K 62M 1% /var/run
tmpfs 62M 0 62M 0% /var/lock
tmpfs 62M 8.0K 62M 1% /var/tmp
tmpfs 62M 4.0K 62M 1% /var/lib/urandom
tmpfs 62M 4.0K 62M 1% /var/lib/dhcp
tmpfs 62M 0 62M 0% /lib/init/rw
tmpfs 62M 0 62M 0% /dev/shm
ubi0:rootfs 432M 20K 427M 1% /tmp/ubifs

Note the 427M available on /tmp/ubifs. Should I install the additional programs I want to the USB drive and then transfer to the flash? Or do I just follow the all the steps and then install the additional programs after booting from the flash?
ItsMee
Re: Install readonly embdebian on NAND
September 10, 2010 07:45PM
Hi,

thanks for the excellent description, scripts & the repository - looks like quite a bit of effort!

With my second attempt I'm nearly there - but I seem to be missing ubifs support in the debian kernel I booted?

root@debian:/temp# mount -t ubifs ubi0:rootfs /tmp/ubifs
mount: unknown filesystem type 'ubifs'

What I did:
- follow instruction http://forum.doozan.com/read.php?2,72,72#msg-72
- 1st attempt failed:
Setting up linux-image-2.6.32-dockstar (1.1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 75.)
debconf: falling back to frontend: Readline

- 2nd (current) attempt (after recovery of pogoplug environment)
- added package "dialog" into dockstar.emdebian-squeeze-readonly.sh before starting
- Ran through, still some messages:
Connecting to jeff.doozan.com (69.163.187.226:80)
kernel.deb           100% |************************************************************************************************************************************************************************************| 16925k 00:00:00 ETA
Selecting previously deselected package linux-image-2.6.32-dockstar.
(Reading database ... 5997 files and directories currently installed.)
Unpacking linux-image-2.6.32-dockstar (from /tmp/kernel.deb) ...
Done.
Setting up linux-image-2.6.32-dockstar (1.1) ...

 Hmm. There is a symbolic link /lib/modules/2.6.32-dockstar/build
 However, I can not read it: No such file or directory
 Therefore, I am deleting /lib/modules/2.6.32-dockstar/build


 Hmm. The package shipped with a symbolic link /lib/modules/2.6.32-dockstar/source
 However, I can not read the target: No such file or directory
 Therefore, I am deleting /lib/modules/2.6.32-dockstar/source

Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-dockstar /boot/vmlinuz-2.6.32-dockstar
update-initramfs: Generating /boot/initrd.img-2.6.32-dockstar
df: Warning: cannot read table of mounted file systems: No such file or directory
warning: can't open /etc/mtab: No such file or directory
warning: can't open /etc/mtab: No such file or directory
Connecting to ftp.us.debian.org (204.152.191.39:80)

Now I'm stuck with the missing kernel support for ubifs.
I build an image based on this http://skorfulose.de/2010/07/22/how-to-install-debian-on-seagate-dockstar/ - but I assume with my current kernel that's not useful at all?

Help / Comments / Hints very welcome!

ItsMee
Re: Install readonly embdebian on NAND
September 11, 2010 01:39PM
So now that I have it set up, I wanted to include additional packages to give it more complete Dockstar functionality, preferably as part of a NAND-flashable system.

Specifically, I want to be able to read Macintosh, Linux and PC drives (hfs+, ext2/3, ntfs/fat/fat32) when I plug one into the Dockstar (otherwise, what good are those USB ports?). What packages do I need to have installed (It looks like I need hfsplus, ntfs-3g, samba, and ???)? And, what changes/tweaks do I need to make to various files?

Thanks for any help in this.
ItsMee
Re: Install readonly embdebian on NAND
September 12, 2010 03:24AM
Hi,

different kernel - same question - why's UBIFS a unknown filesystem?

root@DockStar:~# mount -t ubifs ubi0:rootfs /tmp/ubifs
mount: unknown filesystem type 'ubifs'
root@DockStar:~# uname -a
Linux DockStar 2.6.35.4-dockstar #3 PREEMPT Sun Aug 29 14:13:39 CEST 2010 armv5tel GNU/Linux

Used the kernel from overe here http://forum.doozan.com/read.php?2,582 this time (my custom build failed badly).

So, two questions:
- Why does it fail?
- What's missing? Is UBIFS in the kernel itself - or am I missing modules, maybe?

Pls. help poor little
ItsMee :-)
ItsMee
Re: Install readonly embdebian on NAND
September 12, 2010 03:33AM
Hi,

found there should be a kernel module, did I?

root@DockStar:/lib/modules/2.6.35.4-dockstar# cat modules.builtin |grep ubi
kernel/fs/ubifs/ubifs.ko
kernel/drivers/mtd/ubi/ubi.ko
kernel/net/ipv4/tcp_cubic.ko

But it seems to be missing in both my kernels - must be me doing something wrong during installation??!?
On the other hand installing a prebuild .deb doesn't look that tough?

root@DockStar:/lib/modules# ll  
total 20
drwxr-xr-x 4 root root 4096 Sep 12 08:16 .
drwxr-xr-x 9 root root 8192 Sep 10 23:58 ..
drwxr-xr-x 4 root root 4096 Sep 11 20:16 2.6.32-dockstar
drwxr-xr-x 3 root root 4096 Sep 12 08:29 2.6.35.4-dockstar
root@DockStar:/lib/modules# find ./ |wc -l
2305
root@DockStar:/lib/modules# find ./ |grep -i ubi
./2.6.32-dockstar/kernel/crypto/anubis.ko

ItsMee
ItsMee
Re: Install readonly embdebian on NAND
September 13, 2010 11:31AM
Hendrik,

hi,

(with the objective of a readonly nand booting debian and the large media applications i need read/write on the usb drive)

without knowing much about linux i was thinking would it be possible to

1. chroot to a usb directory and apt install the large apps (i suspect youre gonna tell me apt wouldnt work because theres nothing there on the chrooted usb drive os or dependancies wise) on the usb drive (complete with all the dependancies)

2. chroot back and just use some kind of read only symbolic links on the nand directories to the read/write files/directories apt has installed on the usb drive

if something like this could work it would be a lot of work to create the symbolic links for each usb installed app/dependancies but the links wouldnt be any material size to the nand install and that would take care of installing bulky applications in nand and the insertion of a post usb mount check/fix in the boot scripts for probs on the usb due to hard reset could be automated ... it would make debian on the dockstar far more resilient/useful



rgds

ian
Hendrik
Re: Install readonly embdebian on NAND
September 14, 2010 10:22AM
Hello,

as I'm running out of space in the NAND, I'd like to install Debian on a stick with your script.
Unfortunately, this requires booting the pogo-enviroment, but I don't know how to swich.

Can someone give me a hint?

Regards,
Hendrik
Re: Install readonly embdebian on NAND
September 14, 2010 03:50PM
Hendrik Wrote:
-------------------------------------------------------

> Can someone give me a hint?
>
> Regards,
> Hendrik

Not sure if this is what you are looking for, but instructions for Debian on a USB stick can be found here:

http://jeff.doozan.com/debian/

while instructions for Emdebian on a stick can be found in the first post of this thread (just reset the boot environment to check USB first for boot, and flash erase your NAND install on mtd3 (if you want to keep things clean)).
markus
Re: Install readonly embdebian on NAND
September 14, 2010 04:49PM
Hi Jeff,

just thanx for your work !

A little question : How i can install Debian on an other USB Stick after installation embdebian on NAND ?

Regards,
markus
Hendrik
Re: Install readonly embdebian on NAND
September 15, 2010 01:30AM
Hello,

thanks for your reply.

>just reset the boot environment to check USB first for boot
Yes, that's my problem: How do I toggle between USB, pogoplug and NAND-Install booting?

Regards,
Hendrik
Re: Install readonly embdebian on NAND
September 15, 2010 12:13PM
>>From Hendrik: Yes, that's my problem: How do I toggle between USB, pogoplug and NAND-Install booting?

If you have access to Debian or Pogoplug,
then to boot into usb
fw_setenv bootcmd 'run bootcmd_usb; run bootcmd_ubi; run bootcmd_pogo; reset'
alternatively to boot into pogoplug first, then
fw_setenv bootcmd 'run bootcmd_pogo; run bootcmd_ubi; run bootcmd_usb; reset'
Then reboot

If you have access to uboot serial console,
then to boot into usb, type
run bootcmd_usb
to boot into pogoplug, type
run bootcmd_pogo
Then reset
You can make bootcmd permanent by using the setenv followed by saveenv

I set my bootcmd to 'run bootcmd_usb; run bootcmd_ubi; run bootcmd_pogo; reset'
this way I can remove usb to boot into ubi and plug in an usb to boot into usb



Edited 1 time(s). Last edit at 09/15/2010 12:22PM by EWTUC.
Re: Install readonly embdebian on NAND
September 15, 2010 02:36PM
I followed Jeff's instruction to remove original pogoplug software to increase emdebian size, so

root@debian:/tmp# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 0ff00000 00020000 "data"

however, df only show 232M, is this correct?


root@SeaStar:/# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 232M 71M 156M 32% /
none 60M 24K 60M 1% /dev
ubi0:rootfs 232M 71M 156M 32% /
tmpfs 62M 16K 62M 1% /tmp
tmpfs 62M 16K 62M 1% /var/log
tmpfs 62M 16K 62M 1% /var/run
tmpfs 62M 0 62M 0% /var/lock
tmpfs 62M 8.0K 62M 1% /var/tmp
tmpfs 62M 4.0K 62M 1% /var/lib/urandom
tmpfs 62M 4.0K 62M 1% /var/lib/dhcp
tmpfs 62M 0 62M 0% /lib/init/rw
tmpfs 62M 0 62M 0% /dev/shm
ecc
Re: Install readonly embdebian on NAND
September 15, 2010 06:06PM
EWTUC Wrote:
-------------------------------------------------------
> I followed Jeff's instruction to remove original pogoplug software to increase emdebian size, so
>
> root@debian:/tmp# cat /proc/mtd
> dev: size erasesize name
> mtd0: 00100000 00020000 "u-boot"
> mtd1: 0ff00000 00020000 "data"
>
> however, df only show 232M, is this correct?

Yes, that's correct. I have the same:
$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
ubi0:root             232M   59M  173M  26% /
The ubifs file system has a fair amount of overhead. You can read the gory details here. And here is a comparison between ubifs and jffs2.
Re: Install readonly embdebian on NAND
September 15, 2010 08:34PM
ecc Wrote:
-------------------------------------------------------
> The ubifs file system has a fair amount of
> overhead. You can read the gory details here. And
> here is a comparison between ubifs and jffs2.

Thanks for the docs, just what I am looking for.
Re: Howto: Install readonly emdebian on NAND
September 15, 2010 10:09PM
Jeff Wrote:
> NOTE: If you change your UBIFS root to read-only
> (to edit files or install packages) and lose power
> or crash before you remount it a read-only, uBoot
> will think the partition has errors and will
> refuse to boot from it. In that case, it will try
> booting from USB. If there are no bootable USB
> devices, it will boot the original Pogoplug
> installation. From there, you can mount and
> unmount the UBIFS partition, just to reset the
> 'dirty' flags and uBoot will be okay again.
>
> -- Jeff


Anyone -

Care to educate me on how to reset the 'dirty' flags, both on the UBIFS partition and the USB (I have issues rebooting from both once installed).

Thanks.
lukasd
Re: Howto: Install readonly emdebian on NAND
September 20, 2010 05:59PM
hello,
i have installed openwrt on my dockstar and want to change to debian. is there any howto? or should i install the old firmware first? i made a backup of mtd0-3.
can i flash this files using this commands

flash_ereaseall /dev/mtdX
nandwrite -p /dev/mtdX /tmp/mtdX.img

i used this howto to install openwrt : http://www.cs.cmu.edu/~ecc/dockstar-howto.html

sha mtd0 879dd45188db5b2ee58472f1eacf799fe4702c8e
sha mtd1 eeb191aa1392ad7467c410ddc1d44a352838da18
sha mtd2 959a02645f6b7fdfc66ebdc9da3a16d18b067aff
sha mtd3 db7f45cb50f59e08c027e4ec854f5bcc6abf776c
Help Re Corrupted U-boot Environment?
September 26, 2010 04:59AM
So I ran Jeff's script on a USB attached to one of my Dockstars (i.e., the only one I have that looks like it has the 512MB NAND chip installed, instead of the 256MB chip, per the relevant plugapps.com forum post). Everything looked fine during install process. At reboot, I crossed my fingers, rebooted, and found that, though the USB flash drive was attached, the Dockstar would boot into the Pogoplug environment. So, thinking that all I needed to do was reset the Uboot environment, after SSH'ing in from my computer, and sending the following command (fw_setenv bootcmd 'run bootcmd_usb; run bootcmd_pogo; reset'), and then rebooting, I am now in a continuous boot loop, where the Dockstar flashes green for a few flashes, then goes dark, then flashes green for a few flashes, then goes dark, etc., ad infinitum.

It looks to me like the Dockstar is trying to boot into any attached drive/partition, but that my inputted command up above for Uboot messed things up (so as to create the continuous boot loop).

Thoughts on how to fix/reset a corrupted Uboot environment (I am pretty sure that both the Uboot app itself, and the Pogoplug partition, are fine, as the Dockstar booted into that partition just fine prior to my sending the Uboot environment command (i.e., fw_setenv bootcmd 'run bootcmd_usb; run bootcmd_pogo; reset') would be much appreciated. And, yes I am aware that I can likely JTAG it, but I really want to avoid that route if at all possible.

Thanks in advance.
Re: Help Re Corrupted U-boot Environment?
September 26, 2010 02:25PM
I set bootcmd as you did but was able to boot to pogo Linux without USB devices. Something else might be wrong.

You don't need Jtag, what you need is a serial cable to reset environment variables if you can't boot into Linux and you don't have net console access.
Re: Help Re Corrupted U-boot Environment?
September 26, 2010 06:24PM
DockstarPBX Wrote:
-------------------------------------------------------
> I set bootcmd as you did but was able to boot to
> pogo Linux without USB devices. Something else
> might be wrong.
>
> You don't need Jtag, what you need is a serial
> cable to reset environment variables if you can't
> boot into Linux and you don't have net console
> access.


Thanks for the info. Serial cable (Nokia CA-42) ordered from eBay.

As far as additional steps I need to undertake (and please correct/add to what I list below):
1. Install serial port on Dockstar (as described here: http://www.yourwarrantyisvoid.com/2010/07/21/seagate-dockstar-add-an-accessible-serial-port/). I will need to mod my serial cable as well (as described at above cited link).
2. Install drivers, software, etc., to permit my Macintosh to talk to my Dockstar (as described here: http://plugapps.com/forum/viewtopic.php?f=18&t=181&start=26#wrap).
3. Reset my environment variables by . . . .??? (here, I am estimating that I just need to type in some version of "fwd_setenv" once I get the command prompt on my TTY window; open to many thoughts/suggestions on here).

Thanks in advance for any further help.
ecc
Re: Help Re Corrupted U-boot Environment?
September 27, 2010 07:31AM
dinlaca Wrote:
-------------------------------------------------------
> As far as additional steps I need to undertake (and please correct/add to what I list below):
> 1. Install serial port on Dockstar (as described here:
> http://www.yourwarrantyisvoid.com/2010/07/21/seagate-dockstar-add-an-accessible-serial-port/).
> I will need to mod my serial cable as well (as described at above cited link).

The steps in that link are only needed if you want to be able to access the serial port while the DockStar's case is closed. If you're willing to open the case whenever you need serial access, it's much easier. This thread has pictures and discusses what connectors to use.
Author:

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: