OpenWRT problem/misunderstanding

Scott Sullivan scott-lxSQFCZeNF4 at public.gmane.org
Tue Jul 2 15:42:05 UTC 2013


Sat down with Giles and worked this out last night. See notes below 
relevant sections.

On 06/22/2013 05:39 PM, Giles Orr wrote:
> I have two WRT54G routers I'm working on.  One is a WRT54GS v2 (thanks
> Evan!), and the other is a WRT54G v2.  The latter is supposed to have
> 4MB of Flash and 16MB of RAM.  Today I flashed it from the original
> Linksys firmware to
> http://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/openwrt-wrt54g-squashfs.bin
> , which I believe is the correct OpenWRT firmware.  The flash was
> successful, and I logged into the device via telnet (it initially has
> no password and is telnet only, as soon as you set a password it
> switches to ssh).  I tried:
>
>     # free
>                   total         used         free       shared      buffers
>       Mem:        14316        12056         2260            0         1444
>      Swap:            0            0            0
>     Total:        14316        12056         2260
>
>     # df -h
>     Filesystem                Size      Used Available Use% Mounted on
>     /dev/root                 1.7M      1.7M         0 100% /rom
>     tmpfs                     7.0M    104.0K      6.9M   1% /tmp
>     root                      1.7M      1.7M         0 100% /tmp/root
>     mini_fo:/tmp/root         1.7M      1.7M         0 100% /tmp/root
>     /dev/mtdblock/4           1.5M    328.0K      1.2M  21% /overlay
>     mini_fo:/overlay          1.7M      1.7M         0 100% /
>
> Which of these is Flash, and which is ROM?  And why am I not seeing
> the kind of numbers (4/16) that I'm expecting in either?  Or am I
> totally confused?

OpenWRT is not partitioned like a traditional linux. The file system is 
separated into two major parts, a ~2MB  Read-Only system image that 
includes all the packages included at 'install' time. The rest of the 
usable space is 'overlay' Read-Write space where configuration files are 
stored and extra packages are install. [1]

This can be seen in the /rom and /overlay mount points. The / mount 
point is a union of the /dev/root (which is a symlink to the 
/dev/mtdblock/2 partition) and the /overlay partition.

The reason for this split is so that you can boot the system in a 
'failsafe'[2] mode that only uses read-only rom partition and there for 
brings up the system in a 'factory' state. From there you can mount the 
overlay and correct whatever settings are broken.

[1]: http://wiki.openwrt.org/doc/techref/flash.layout
[2]: http://wiki.openwrt.org/doc/howto/generic.failsafe

> I had a similar problem with the WRT54GS: I followed their more
> conservative installation routine, installing OpenWRT v8.09 then
> updating to 10.03.1 - after which I could still ssh in fine, but I
> discovered that I couldn't install anything with opkg because the
> device believed the memory was entirely full.  This seemed improbable,
> as it's supposed to have 8MB and 32MB, and I'd done nothing except the
> two step flash.

What we found was that settings from the 8.09 to 10.03.1 upgrade where 
preserved and causing the system to be confused. It was some how 
ignoring the /overlay free space and only reporting / was full.

After re-flashing from the web interface without the 'keep settings' 
check-box, things worked normally and as expected.

> I suspect I have some horrible misunderstanding, but I can't quite
> figure it out despite attempts to research it.  Help would be very
> much appreciated, thanks.

So a non-obvious partition and union makes it easy to think that / is 
100% full. But it is the /overlay free space that really determines your 
free space on an OpenWRT system. This coupled with the miss-leading 
error from the borked configuration creep from 8.09 to 10.03.1 was where 
it became confusing.

-- 
Scott Sullivan
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list