Welcome! Log In Create A New Profile

Advanced

Howto: Install readonly emdebian on NAND

Posted by Jeff 
Great work!

But... ;-)

"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"

Guess you mean read-write by that first occurence of "read-only"?

Oh, and one might add a line on how to figure out the actual size of the flash, as there seem to be a few 512 MB DockStars around as well with might benefit from a larger /dev/mtd3.

BTW, to make the approach even more accessible to the largest number of users, shouldn't there be a few options to do away with the need of partitioning&reformatting an external USB drive, e.g. by

1. identifying and uncommenting/renaming only what really mustn't run from the factory-installed system:
Logging in as root:stxadmin to ssh 169.254.second_last_byte_of_MAC_address.last_byte_of_MAC_address followed by
mount -o rw,remount /;sed -i 's/\(\/etc\/init\.d\/hbmgr\.sh\ start\)/#\1/' /etc/init.d/rcS;busybox reboot
seems to overreach quite a bit by disabling much of the file system support rather than just PogoPlug's unwanted online updater (not sure where the latter resides).
Even if PogoPlug doesn't have ubiformat / ubiattach / ubimkvol, they might still be compiled for and installed into it?

or

2. first reformatting /dev/mtd3 (what's on it in the first place actually?) to something PogoPlug (even with /etc/init.d/hbmgr disabled entirely) can handle and put a minimal system on it (that can run in RAM and hence unmount mtd3 once it's booted up), then install the actual emdebian on reboot from there?
Re: Help Re Corrupted U-boot Environment?
September 28, 2010 12:45AM
ecc Wrote:
-------------------------------------------------------
> 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/seaga
> te-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.

Thanks for the info, ECC. I have the parts ordered and, once they have arrived and I have taken things apart (and decided whether ease of taking top off makes closed box access moot), I will decide which approach to take.

As far as resetting the environmental variables, thoughts/comments as to how to do that once the serial connection is made would be much appreciated.

Thanks again.
trock
Re: Install readonly embdebian on NAND
October 03, 2010 06:05PM
Quote
mxspy
I got some problem on boot (add some dirs /tmp/xxx) because the filesystem was read-only - so the network does not come up.
I have used the serial-console to make the rest of the installation, after a remount.

I have the same issue, as long as in fstab the root mount is "ro", I couldn't connect through ssh after rebooting.
Because I don't have the serial-console, I wonder what you mean with "make the rest of the installation"...

It seems, that embdebian is not booting with network in read-only mode.
So what I have to do to get work read-only?
Re: Install readonly embdebian on NAND
October 08, 2010 01:24PM
trock Wrote:
-------------------------------------------------------
> > I got some problem on boot (add some dirs
> /tmp/xxx) because the filesystem was read-only -
> so the network does not come up.
> I have used the serial-console to make the rest of
> the installation, after a remount.
>
>
> I have the same issue, as long as in fstab the
> root mount is "ro", I couldn't connect through ssh
> after rebooting.
> Because I don't have the serial-console, I wonder
> what you mean with "make the rest of the
> installation"...
>
> It seems, that embdebian is not booting with
> network in read-only mode.
> So what I have to do to get work read-only?

I installed embdebian last night. It did boot to USB but I cannot ssh into it. I don't know if it is the same issue. Has any body had the same problem?



Edited 1 time(s). Last edit at 10/08/2010 05:16PM by twinclouds.
From the last couple of postings I gather I'm not alone in seeing this thread's Emdebian installer create unusable USB media, failing as follows (and then by booting only to an orange LED in the end without even trying to get an IP address) while http://www.jeff.doozan.com/debian/ works just fine on the very same hardware:
Quote

Selecting previously deselected package linux-image-2.6.32-dockstar.
(Reading database ... 4539 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)
mkimage.deb 100% |*******************************| 11396 --:--:-- ETA
Selecting previously deselected package uboot-mkimage.
(Reading database ... 6458 files and directories currently installed.)
Unpacking uboot-mkimage (from /tmp/mkimage.deb) ...
Setting up uboot-mkimage (0.4) ...
Connecting to ftp.us.debian.org (35.9.37.225:80)
envtools.deb 100% |*******************************| 15288 00:00:00 ETA
Selecting previously deselected package uboot-envtools.
(Reading database ... 6462 files and directories currently installed.)
Unpacking uboot-envtools (from /tmp/envtools.deb) ...
Setting up uboot-envtools (20081215-2) ...
Image Name: Linux-2.6.32-dockstar
Created: Mon Oct 11 20:37:32 2010
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1438812 Bytes = 1405.09 kB = 1.37 MB
Load Address: 0x00008000
Entry Point: 0x00008000
Image Name: initramfs-2.6.32-dockstar
Created: Mon Oct 11 20:37:34 2010
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 4882138 Bytes = 4767.71 kB = 4.66 MB
Load Address: 0x00000000
Entry Point: 0x00000000
Connecting to jeff.doozan.com (69.163.187.226:80)
blparam 100% |*******************************| 14168 --:--:-- ETA




Installation complete

You can now reboot your device into Debian.
If your device does not start Debian after rebooting,
you may need to restart the device by disconnecting the power.

Reboot now? [Y/n]
TEN wrote:
-------------------------------------------------------
> identifying and uncommenting/renaming only what really mustn't run from the factory-installed system:
> Logging in as root:stxadmin to ssh 169.254.second_last_byte_of_MAC_address.last_byte_of_MAC_address
> followed by
> mount -o rw,remount /;sed -i 's/\(\/etc\/init\.d\/hbmgr\.sh\ start\)/#\1/' /etc/init.d/rcS;busybox reboot
> seems to overreach quite a bit by disabling much of the file system support
> rather than just PogoPlug's unwanted online updater

mount -o rw,remount /;sed -i 's/\(nohup\ \$INSTDIR\/bin\/hbwd\)/#\1/' /etc/init.d/hbmgr.sh;busybox reboot
instead should do the trick so at least manual mounting of file systems other than ext2(-4) remains possible
(automount to /tmp/.cemnt is off without hbwd, which we don't want as its updater might lock us out),
Quote

# busybox lsmod
Module Size Used by Tainted: P
xce 18368 0
tun 9152 0
ufsd 573512 0
fuse 43156 0
hfsplus 81188 0
hfs 50980 0
vfat 10784 1
fat 48828 1 vfat
e.g. for backing up data to a (v)fat USB stick that is also readable to the Windows world:
Quote

# mkdir /tmp/mnt;mount /dev/sda1 /tmp/mnt;df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock2 32768 15408 17360 47% /
none 63032 4 63028 0% /tmp
/dev/sda1 1993504 0 1993504 0% /tmp/mnt
Re: Howto: Install readonly emdebian on NAND
October 23, 2010 02:19PM
Hi,

unitl now I haven't been able to boot into a debian install on the dockstar. uBoot is up to date and averything looks good, but after the message Starting kernel... I don't get any messages any more and even if I wait for quite a while I dont get any sign that the dock is in the net. LED is off, access to the usb is finished.

the USB Stick ist partitioned 3.5 GB /dev/sda1 ext2, 500M /dev/sda2 swap
Output from netconsole is as follows:

Any help, ideas, suggestions to get this thing going are appreciated

Johanes

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... 3 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-0x000010000000 : "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: attached mtd1 to ubi0
UBI: MTD device name: "mtd=3"
UBI: MTD device size: 219 MiB
UBI: number of good PEBs: 1749
UBI: number of bad PEBs: 3
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 1728
UBI: total number of reserved PEBs: 21
UBI: number of PEBs reserved for bad PEB handling: 17
UBI: max/mean erase counter: 1/1
UBIFS error (pid 0): ubifs_get_sb: cannot open "ubi:rootfs", error -19
Error reading superblock on volume 'ubi:rootfs'!
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)
1438876 bytes read
Loading file "/boot/uInitrd" from usb device 0:1 (usbda1)
4882498 bytes read
## Booting kernel from Legacy Image at 00800000 ...
Image Name: Linux-2.6.32-dockstar
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1438812 Bytes = 1.4 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
Image Name: initramfs-2.6.32-dockstar
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 4882434 Bytes = 4.7 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...
Re: Howto: Install readonly emdebian on NAND
October 23, 2010 03:02PM
Hi

just got it up and running making a few fixes on the new install:

/etc/fstab
# /dev/root  /                 ext2  noatime,ro   0 1
/dev/sda1  /                 ext2  noatime,rw   0 1
commenting out the first line and replacing it by the second line and leaving the rest of the file untouched

/etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 192.168.0.51
netmask 255.255.255.0
gateway 192.168.0.254

Here I just gave the network interface a fixed IP - don't know if it was necessary, but i wanted to be sure to find the dockstar. Changing these two files made it possible to boot into the debian on the USB stick.

Further progress will be reported :-)
Mark
r/w network error
October 25, 2010 08:20PM
I was having the same problem a few others were, where the debian install on USB wouldn't boot, but it would if I set / to mount read/write in fstab. I think I've found the right fix:

In Jeff's script near the end it runs a fw_setenv set_bootargs_usb ... that should actually be run on usb_set_bootargs. The result is that init=/sbin/init-ro is missing in the kernel parms, and the read-only filesystem is missing a few tmpfs mount points that are needed.

What I don't get is why isn't everyone having this problem?



Now my next problem. I partially bricked on of my dockstars while going from usb to mtd. I'm sure I can get to the uboot console once I get a serial level shifter, but I don't want to wait. I've been trying to use the /rescueme option but it doesn't seem to work. Anyone have any pointers? If I have to wait too long I suppose I could also use one dockstar as a 3.3v serial terminal to uboot the other one...
Re: r/w network error
October 26, 2010 12:29AM
Thanks for reporting that. Some of the environment variables changed with the newer uBoot and I forgot to updated this installer with the changes. It's fixed now.

To use the 'rescueme' option, make sure you only have one USB device connected, make sure that the first partition on that device is formatted as ext2, and then create an empty file in the root directory called 'rescueme'. Then boot with that device connected and it should force the rescue partition to boot.

-- Jeff
Re: Howto: Install readonly emdebian on NAND
October 26, 2010 05:49AM
what's needed to install emdebian to an usb stick instead to nand?
i like the idea of a very small system i guess it's optimized for read/write cycles aswell.

speaking of read/write...
does emdebian take care of /var etc?
lofthouses
Re: Howto: Install readonly emdebian on NAND
October 29, 2010 11:21AM
Hi, because i tryed to install an openwrt on my dockstar i didn't have an original pogo system anymore. instead there is only a not working openwrt installation ^^

so i tryed to install emdebian from the rescue system.
but the installation stuck at the debootstrapping...
    
    I: Checking component main on http://www.emdebian.org/grip...
    E: Couldn't find these debs: flash-kernel
    debootstrap failed.
    See /tmp/debian/debootstrap/debootstrap.log for more information.
and here the content of the debootstrap.log
    Connecting to www.emdebian.org (88.198.202.189:80)
    debootstrap.invalid_ 100% |*******************************| 28776  --:--:-- ETA
    Connecting to www.emdebian.org (88.198.202.189:80)
    debootstrap.invalid_ 100% |*******************************|   521k --:--:-- ETA
so, what i'm doing wrong?

regards lofthouses
Terry Hardie
Re: Howto: Install readonly emdebian on NAND
October 31, 2010 12:06PM
I have exactly the same problem trying this on a brand new dockstar...

Terry
lofthouses
Re: Howto: Install readonly emdebian on NAND
November 03, 2010 05:25PM
So, nobody has an idea?
Or alternativlly how can i install an full debian squeez to the flash?

regards, lofthouses
SebastianG
Re: Howto: Install readonly emdebian on NAND
November 06, 2010 11:01AM
I have the same problem:

 I: Checking component main on http://www.emdebian.org/grip...
    E: Couldn't find these debs: flash-kernel
    debootstrap failed.
    See /tmp/debian/debootstrap/debootstrap.log for more information.

That is very weird, it seems that the package flash-kernel has been (silently?) removed from grip repository.
Check out package log for squeeze grip repo:
http://www.emdebian.org/grip/logs.php?days=0&suite=squeeze
There is no package named flash-kernel and even no history of it...

Somebody have an idea what to do now?
I think we can use arm package from http://packages.debian.org/squeeze/flash-kernel but no tested it yet
SebastianG
Re: Howto: Install readonly emdebian on NAND
November 06, 2010 01:00PM
Quick Fix to the problem with missing flash-kernel package:

Open the original install script in editor, find the line where the EXTRA_PACKAGES line begins and just remove the flash-kernel package from list and run the script again.
After succesfull install answer N to the reboot question, and then install missing package by hand:

chroot /tmp/debian
echo "nameserver 8.8.8.8" > /var/tmp/resolv.conf
wget http://ftp.pl.debian.org/debian/pool/main/f/flash-kernel/flash-kernel_2.34_armel.deb
wget http://ftp.pl.debian.org/debian/pool/main/d/devio/devio_1.2-1+b1_armel.deb
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
dpkg -i devio_1.2-1+b1_armel.deb
dpkg -i flash-kernel_2.34_armel.deb

That should fix it ;)
eval-
Re: Howto: Install readonly emdebian on NAND
November 20, 2010 06:15AM
Jeff Wrote:
-------------------------------------------------------
> I've done some preliminary work getting debian
> installed to the NAND:

I followed these instructions exactly along with SebastianG's tip for flash-kernel + devio, and everything worked perfectly... except:

> # Configure new bootloader to run old uBoot
> fw_setenv bootcmd 'run bootcmd_ubi; run bootcmd_usb; run bootcmd_pogo; reset'

the above stuck as my bootcmd and was not useful for anything but NAND booting

After also installing your replacement rescue, I set it to:

fw_setenv bootcmd 'usb start; run force_rescue_bootcmd; run usb_bootcmd; usb stop; run bootcmd_ubi; run rescue_bootcmd; run pogo_bootcmd; reset'


to have a system I could alternate between USB & NAND, depending on whether a USB stick was plugged in.
mindsmith
Re: Howto: Install readonly emdebian on NAND
December 05, 2010 11:56AM
when i start your script, i get an error:
Couldn´t find these debs: dhcp-client

what can i do??
mindsmith
Re: Howto: Install readonly emdebian on NAND
December 06, 2010 01:15PM
i change the mirror and now i don´t have this error again.
But now after the download i get this error:
I: Unpacking zlib1g...
W: Failure while unpacking required packages. This will be attempted up to five
times.

What can i do?
Is it possible to unpack this file by hand and start the installation again?
Hendrik
Re: Howto: Install readonly emdebian on NAND
December 25, 2010 03:30AM
Hi,

I changed the script to use this mirror now:
http://ftp.uk.debian.org/emdebian/grip

It's currently running. If you don't hear from me again, it worked ;-)

Greetings,
Hendrik
Samson
Re: Howto: Install readonly emdebian on NAND
December 25, 2010 07:53PM
Before I follow this Howto I've 2 questions:

1) Do I need to replace the stock uBoot with the new version in this guide ?

2) How the "fdisk -l" looks like for the USB drive since the Howto only mentioned "partition it with fdisk" but did not mention how the partitions in the USB drive should be organized.

Many thanks

Regards,
Samson
buxa
Re: Howto: Install readonly emdebian on NAND
December 29, 2010 03:00PM
i have the same problem. somebody has the solution? thanks
buxa
Re: Howto: Install readonly emdebian on NAND
December 29, 2010 03:02PM
here is the error message:

Unpacking xz-utils (from .../xz-utils_4.999.9beta+20100810-1em1_armel.deb) ...
Selecting previously deselected package zlib1g.
Unpacking zlib1g (from .../zlib1g_1%3a1.2.3.4.dfsg-3em1_armel.deb) ...
Errors were encountered while processing:
 /var/cache/apt/archives/dash_0.5.5.1-6em1_armel.deb
dpkg: regarding .../base-files_5.9em1_armel.deb containing base-files, pre-dependency problem:
 base-files pre-depends on awk
  mawk provides awk but is unpacked but not configured.
dpkg: warning: ignoring pre-dependency problem!


thanks
Re: Howto: Install readonly emdebian on NAND
December 31, 2010 02:27PM
You will have to edit the script provided by Jeff to replace dhcp-client with dhcp3-client in the extra_packages line. It seems the package name has changed in emdebian.
rastckod
Re: Howto: Install readonly emdebian on NAND
January 07, 2011 04:54PM
How can I compile a new Kernel for the embedded Debian (installed on NAND) directy on my dockstar?
Colin
Re: Howto: Install readonly emdebian on NAND
January 09, 2011 07:32PM
Hey all,

Finally getting around to building out a console server on my dockstar and I'm having some issues with the NAND install. I've played around a bit and my initial error said the following:

I: Checking component main on http://www.emdebian.org/grip...
E: Couldn't find these debs: dhcp-client
debootstrap failed.

So I poked around on the emdebian site and in Jeff's script and I'm guessing that the issue has to do with a newer release and packages not lining up. I got as far as changing dhcp-client to dhcp3-client (and crossing my fingers that it didn't massively break anything else) but after the unpacking I got a "failure while unpacking" message. Before I go further (and possibly brick my dockstar) I just wanted to see if anyone else had come across this and solved the issue.
ossy
Re: Howto: Install readonly emdebian on NAND
January 18, 2011 04:18PM
Hi, I tried several embedded linux systems for my target device (seagate dockstar) and finally came back to Debian/Emdebian.

Since I like to install the system onto the internal NAND flash, my main requirement was to use a READ ONLY root file system - or at least one without write access besides configuration issues.

The obviously volatile result was made public here:
http://gitorious.org/dockstar/emdebian-multistrap

If anyone looks for an example for:
a) using multistrap
b) read only rootfs
c) create the rootfs apart from the target hardware
might have a look at this.

The solution is not perfect but works for me. Makefiles would be a better way than bash skripts, but at the beginning I wasn't aware of the recipe/make character.

The skript set produces a ubi-image, ext2 image and tar.gz of the generated rootfs. The way how this is created is ugly and
not very generic.

The final rootfs includes samba, transmission, autofs and mediatomb besides the common packages needed for a proper
debian system (ping and wget are served via busybox for example). The resulting size is about 100MiB and fits well in the
219MiB parition on the 256MiB NAND. After installation I have a 50% usage on the rootfs.

Gimmick: /var is overlayed via aufs: RO-base (squashfsimage) + RW in-memory -> solves most write ambitions of many packages.
Sven
Re: Howto: Install readonly emdebian on NAND
January 20, 2011 06:35AM
Quote
mindsmith
I: Unpacking zlib1g...
W: Failure while unpacking required packages.
This will be attempted up to five times.
To workaround this I further investigated the problem and edited the line URL_DEBOOTSTRAP=... to point to the current version /debootstrap_1.0.26_all.deb.
To force the use of this new version after a previous run of the script, you have to remove the older version before:
mount -o rw,remount /
rm /usr/sbin/debootstrap
rm -R /usr/share/debootstrap
mount -o ro,remount /
(before reading this part of the script, I always thought, it leaves the pogoplug root system untouched...)

But what to say?
It still reports errors, and I don't know why!

@Jeff: Would I have to compile a more recent 'pkgdetails' as well?

BTW: I wanted to replace 'dhcp-client' with 'udhcpc' - is there any advantage or disadvantage compared to 'dhcp3-client'?
Sven
Re: Howto: Install readonly emdebian on NAND
January 20, 2011 07:31AM
UPDATE:
I found, that Jeff already adopted the online version of his script to the recent debootstrap version...

Apart from this, I chose to change my script to not alter the pogoplug root device any more, but to point debootstrap to it's temporary location:
export DEBOOTSTRAP_DIR=/tmp/debootstrap/usr/share/debootstrap
and to run it directly from /tmp/debootstrap/usr/sbin/

But still this does not solve my problem, of course!
- Please help -
Sven
Re: Howto: Install readonly emdebian on NAND
January 20, 2011 08:40AM
- last reply for today -- promised! -

Hard to find, but easy to fix...

I read the debootstrap.log to find the package 'dash' not installing. Then I chroot'ed into debian and manually tried to install it - then I got the error of a non existent path!
Just add this line before the actual call of debootstrap (there is already another mkdir present):
mkdir -p $ROOT/usr/share/man/man1

Et voila!
Installation continues...
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: