Topic: Chumby Classic Read-only file system and shell commands

Hi, 

sorry for posting this, but I couldn't find the answer in previous posts.

I've just got a new chumby classic. When accessing the console by ssh, I can't change anything to the file system, e.g., to add some cgi-scripts or whatever:

chumby:~# echo test > tmp.txt
-sh: cannot create tmp.txt: Read-only file system

Another problem is that I cannot execute much on the console except "ls", "ps", and few other commands. e.g., sudo doesn't work:

chumby:~# sudo
-sh: sudo: not found


Any hint would be appreciated! Thanks much!

Re: Chumby Classic Read-only file system and shell commands

All chumbys have a read-only file system.  In this case of the classic, it's even compressed, which means that it cannot be modified in place.  This is very typical of embedded systems.

"sudo" doesn't work because (a) the command isn't there, and (b) the device operates ias root all the time anyway.  Since the device is read-only, there's no particular reason *not* to be root, since nothng can ben modified anyway.  Again, this is typical of embedded systems.

However, if you're interested in adding CGI scripts to the built-in webserver, you can put them in the one partition that *is* read/write, which is /psp  - see this information for how to do this.

The chumby one treats al this slightly differently - it is possible to remount the normally read-only file systems as read/write and moke simple modifications.

Re: Chumby Classic Read-only file system and shell commands

@Duane, thanks for this hint.

The chumby one treats al this slightly differently - it is possible to remount the normally read-only file systems as read/write  and moke simple modifications.

Does this mean any restriction in terms of software that could be installed on the chumby classic?! e.g. installing Python and running Python script?! Installing a web browser, etc.?!

Re: Chumby Classic Read-only file system and shell commands

You can run whatever you want from a USB dongle - you just can't build it in without rebuilding the entire file system.

Re: Chumby Classic Read-only file system and shell commands

I have a related question.  We (our robotics club) have got a hold of a few chumby classics.  We want to use various devices such as Pololu Maestro, Mbed, TI Launchpad off the USB ports, but those devices use ttyACMx for serial communication over the USB bus. 

I have a copy of cdc-acm.0 that may work, but the problem is that /drivers is a read only directory and as we know from the preceding discussion, you can't just do "mount -o remount,rw /" on the chumby classic. 

Any suggestions (other than use chumby one, etc...)?

Re: Chumby Classic Read-only file system and shell commands

mwalimu wrote:

Any suggestions (other than use chumby one, etc...)?

Rebuild the rootfs.  It's not terribly difficult.  The easiest way (overly simplified) is:

* run linux with cramfs support (to check if you have cramfs support: grep cramfs /proc/filesystems)
* get the latest firmware downloaded from chumby
* extract the rootfs (update2/rfs1.bin.zip)
* mount that rootfs loopback (mkdir ~/rfs; mount -o loop rfs1.bin ~/rfs)
* rsync the filesystem to a writable location (rsync -av --delete ~/rfs ~/new_rfs)
* Make your changes to the filesystem
* cram it (mkfs.cramfs ~/new_rfs/ rfs1.bin)
* zip it (zip rfs1.bin.zip rfs1.bin)
* Put it on a USB stick in the "update2" directory and do the "firmware update" from the special options menu.

The procedure for the special options menu can be seen here: http://www.chumby.com/pages/release171

There's also a really good thread describing this process in more detail here: http://forum.chumby.com/viewtopic.php?id=1493

Linux Guy - Occasional Chumby Hacker

Re: Chumby Classic Read-only file system and shell commands

I followed your directions, however the best I can get is that the chumby quits loading and reports:

[    3.000000] VFS: Mounted root (cramfs filesystem) readonly.
[    3.020000] Freeing init memory: 100K
[    3.030000] Warning: unable to open an initial console.
[    3.040000] Failed to execute /linuxrc.  Attempting defaults...
[    3.050000] Kernel panic - not syncing: No init found.  Try passing init= option to kernel.
[    3.070000]  <7>Hub status changed

This happens whether I make my changes or not.

Re: Chumby Classic Read-only file system and shell commands

I figured it out.

"rsync -av --delete ~/rfs ~/new_rfs" apparently creates ~/new_rfs/rfs. 
"mkfs.cramfs ~/new_rfs/ rfs1.bin" creates a file that makes /new_rfs/rfs/...

change "mkfs.cramfs ~/new_rfs/ rfs1.bin" to "mkfs.cramfs ~/new_rfs/rfs rfs1.bin, and it works.

Re: Chumby Classic Read-only file system and shell commands

Great!  I left this tab open so I could give it a try again.  I know I've done it in the past, but wasn't sure what I did differently than the directions I gave you.

Linux Guy - Occasional Chumby Hacker

Re: Chumby Classic Read-only file system and shell commands

Like any good problem, solving this one has lead me to more questions.  What has me puzzled is this:

When I rebuilt the kernel with the proper configuration, I built my driver(cdc-acm.ko), however, the driver didn't show up when I zipped the new kernel and installed it on the Chumby.  I had to also put it on rfs.bin to get it working.  I guess I want to know what the relationship between the kernels and the root file partitions is.  How do you get from the kernel to root files, it seems very inefficient to add things one at a time.  Why are their two kernels and two rfs partitions?  How does one build rfs from the kernel?

Re: Chumby Classic Read-only file system and shell commands

Two kernels and two RFS partitions is a chumby thing, not a linux thing.  They do it for the "Special Options Mode" for recovery and updates.


As for the kernel and rootfs being separate, that's just the way it is.  I'm not sure exact definitions of everything, but most people think of "linux" as a distribution, which is usually a root filesystem, bootloader, and kernel.

When you're dealing with embedded devices and getting lower down a software stack like this, they're very separate things and you should understand them all.

Bootloader - This is the first (for our purposes) piece of code that is run.  It's job is to initialize hardware, load the kernel from flash and jump to execution of the kernel.  In most Chumby hackery discussed here, we're not wanting to change this because we're not worried about changing boot parameters or low-level hardware initialization.

Kernel - The main process of an OS.  It is a bridge between applications and the actual data processing done at the hardware level.  It is in charge of accessing hardware directly based on what applications tell it.  It has a task scheduler to time-slice work being done, memory managers, code for specific hardware (touchscreens, mice, keyboards, DMA engines, rotory encoders, audio chipsets, etc.), and quite a bit more.

Root filesystem - This is something that contains all the files to make the OS usable.  It contains the user applications, configuration files, loadable kernel modules for additional hardware support, etc.


They're each very distinct things, so building the kernel as you've done, doesn't mean you're done since you built a module, not a piece of the actual kernel.  You still need to change the root filesystem.  If you had selected support for the "cdc-acm" as built-in instead of a loadable module re-flashing the kernel would have been all you needed to do.


Because of this separation, there are many solutions to "tie everything together."  Things like OpenEmbedded, buildroot, etc. are all projects that wrap kernel and root filesystem together in a more concise and easier to manage fashion.  I believe I asked Chumby a while back about their system and they use some custom rolled build scripts to package everything together.

Linux Guy - Occasional Chumby Hacker

Re: Chumby Classic Read-only file system and shell commands

I tried making cdc-acm built in, but it didn't work.  I probably did something wrong.

I get the boot-loader and I figured that the purpose of two kernels and rfs was to restore the system to factory condition (although I'm curious why that didn't work when I tried it).  So let me see if I follow you.  The "root system" is the front end where the user interacts with the software.  That is, I would run python from the root system.  The "kernel" is the support files, that is all the stuff the chumby needs run the LCD or the operating system.

13 (edited by Materdaddy 2012-06-01 13:00:50)

Re: Chumby Classic Read-only file system and shell commands

Not quite.  Think of the kernel as one large application.  It is the MAIN application that controls (and eventually runs) other applications.  The root filesystem has all of these other applications.  It is simply a filesystem with specific requirements of a few things like "init".  These are all things you should google, or better yet, read this: http://www.tldp.org/HOWTO/From-PowerUp- … HOWTO.html

That should give you a bit of understanding as to how things interact.

The part you got right is about the root filesystem being the place that the user will typically interact with and run things like python from.

EDIT:
Another decent link:
http://www.ibm.com/developerworks/linux … linuxboot/

Linux Guy - Occasional Chumby Hacker