Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: Paulo on March 28, 2013, 12:54:10 PM
-
Hi
Does TC run 100% in RAM, even the files or folders one might have added and made persistent which are not shown to be mounted as RO in tc/loop?
The reason I ask is that my intentions are to use TC for "embedded" or stand-alone "appliance" applications.
In these kind of applications, the user simply switches power off to the unit instead of doing a proper shutdown
so I'm wondering what possible effect (if any) it may have on the FAT32 formatted USB stick that TC boots off.
Thanks.
-
Hi Paulo
While it's always nicer to do a proper shutdown, as long as you don't need to do writes to the stick, you should be OK.
-
Hi Rich
Thanks.
Yes, I don't intend on writing anything back to the USB stick.
The first project I have in mind is a remote spectrum analyzer where a custom made box which is a small factor ATX mobo+PSU+TC running off a USB stick
plus integrated into the box will be my circuit that digitizes the I.F. output from a RF front-end.
The whole thing is connected via Ethernet to a user using only a web browser.
This remote box wil have apache running and when the users web browser requests a new scan (done periodically via a refresh meta tag), it posts
the request to a perl script which in turn calls a binary which I have compiled that sets the frequency of the RF front-end, waits for the PLL to stabilize
then samples the I.F. output (via an ADC connected to the LPT) and sends the value back to my executable which "prints" out a svg back to the perl script
via apache and onto the users web browser.
The whole process is repeated for the number of frequencies required for a scan which takes about 2.5 seconds.
So no saving is required on the boxes USB stick as everything is done on-the-fly.
TC is perfect for this kind of thing as it's completely "modular" in the sense that one only adds what is needed.
-
Hi Paulo
If you are writing anything to /home/tc, don't use a persistent home. If you are using persistent storage for your
web pages, like /mnt/sda1/www or something, make sure apache doesn't need to write to those directories.
-
Hi Rich
Thanks for the tip.
The way I designed it is that Apache, the Perl script and my executable don't write anything back to any directory or file, instead it only
"prints" svg lines to a html page which is sent directly to the users web browser.
Each of these lines represent the amplitude of each frequency in the scan.
However it does bring up another question, Apache logs every access to a log file.
Can I assume that this log file exists in RAM and that it's not writing to the actual USB stick?
-
Hi Paulo
Most likely it's in RAM in some standard location, like /var or /tmp. You can probably control how logging is handled
by a config file, possibly under usr/local/apache2/conf/
-
If you intend for it to lose power, make sure your drive is mounted read-only. Even without writes a RW mount may cause corruption on power loss.
Even better is not mounted at all, see the copy2fs options for loading extensions to RAM.
-
Hi curaga
I am a bit confused now.
I thought that extensions are by default mounted as RO in separate tcloop(s).
Can I issue a command like this for the boot drive:
mount -r -o remount
But that surely would fail as there are processes running.
As regards copy2fs, this according to the website, involves using Copy Mode, how does one check if TC is running in this mode?
It also mentions the Appsaudit program, where does one find this?
-
boot drive as such never gets mounted.
If a drive gets mounted for some reason as e.g. persistence or swap space and happens to be on boot drive, then that is purely coincidental.
http://tinycorelinux.net/concepts.html
-
@tinypoodle
boot drive as such never gets mounted.
If a drive gets mounted for some reason as e.g. persistence or swap space and happens to be on boot drive, then that is purely coincidental.
My boot drive does get mounted as /mnt/sdb1 type vfat (rw,relatime, ........) so surely according to curaga this could mean possible data corruption on power interruption.
Now according to the wiki, the TC kernel also supports boot options like 'ro' (see page 13 of http://files.kroah.com/lkn/lkn_pdf/ch09.pdf (http://files.kroah.com/lkn/lkn_pdf/ch09.pdf)
Would this help?
-
I am a bit confused now.
I thought that extensions are by default mounted as RO in separate tcloop(s).
The extensions are mounted RO. The drive they are on is mounted RW.
You are correct that remounting doesn't work when a process is running there (loop mounts count as that).
As regards copy2fs, this according to the website, involves using Copy Mode, how does one check if TC is running in this mode?
It also mentions the Appsaudit program, where does one find this?
When fully in copy mode, no loops are visible in "mount". All extensions are loaded to RAM.
Appsaudit was unified into Apps. See the "toggle copy2fs mode" option in Apps' menu.
-
OK I tried adding 'ro' as a boot option and TC complained (several times) about a revalidation error (error num -5 and -16) then continued to boot
and my boot drive is still 'rw'.
Basically what I'm after is setting up TC on a USB stick with all the required extensions, apps and scripts I need for a specific purpose then I need to set
it as 'ro' as no saving/writing/backup/persistence to the boot drive will be required during normal use, but it must be able to survive power interruptions with no
possibilities of data corruption.
If I need to change/add something then ideally I should be able to do so (even if it means on another development machine) then once the changes have been made
then being able to set the whole drive back to 'ro'.
@curaga
There is no "toggle copy2fs mode" option in Apps menu, only "Toggle Default Install to File System Flag".
-
Hi Paulo
You can just create an empty file called copy2fs.flg in your tce directory. That will load all your extensions into RAM
when you boot. Once booted, you should be able to unmount the drive.
-
Hi Rich
You can just create an empty file called copy2fs.flg in your tce directory. That will load all your extensions into RAM
when you boot. Once booted, you should be able to unmount the drive.
Didn't work.
It boots, says it's loading extensions then once it loads the desktop is there but wbar only has 1 entry which is the one I made for
my Ethernet Monitor script.
All the others are not there and the only things that work on the right click menu is to exit or drop down to cli which I did.
Once on the cli, there are a whole bunch of errors like so:
ls: /usr/local/share/applications/tinycore-scmapps.desktop: No such file or directory
Plus a whole lot more of similar ones for tinycore-screenshot.desktop, services.desktop and so on.
Doing a 'mount' command shows that the boot drive is still mounted as 'rw'.
However it seems that the extensions (at least some of them) are working although not accessable via X.
The extensions I tested were gtkdialog, bash, xdotool and elinks.
Obviously not being in X, xdotool and gtkdialog complained but that didn't matter as the mere fact that they did complain means
they were loaded and working.
-
Do NOT use the ro boot option.
That option is used by normal Linux systems to mount the root read only so that fsck can be run on it, and have it then be remounted rw.
Core uses a RAM based root file system.
-
http://forum.tinycorelinux.net/index.php/topic,15014.msg85869.html#msg85869
-
Hi gerald_clark
Do NOT use the ro boot option.
I did try it and TC was not very happy with it so I took it out again.
Core uses a RAM based root file system.
But the boot drive is still mounted as 'rw' and although I do no writes back to the boot drive, according
to curaga, one can still have data corruption to a 'rw' mounted drive if subject to power interruptions.
-
The boot drive is never mounted.
Your tce or opt or home drive is mounted.
-
Hi gerald_clark
The boot drive is never mounted.
Your tce or opt or home drive is mounted.
What am I missing as issuing a 'mount' command shows that /dev/sdb1 (my boot drive) is mounted as 'rw'
and running MountTool confirms this with sdb1 shown in green.
-
Hi tinypoodle
http://forum.tinycorelinux.net/index.php/topic,15014.msg85869.html#msg85869
(http://forum.tinycorelinux.net/index.php/topic,15014.msg85869.html#msg85869)
Wow, that is seriously over my head :(
At the risk of sounding facetious, which is not my intent, surely there must be a simpler way?
-
Hi Paulo
once it loads the desktop is there but wbar only has 1 entry which is the one I made for my Ethernet Monitor script.
Hit Ctrl-Alt-F1 and then enter
free
Does it show you are low on free RAM?
Try removing any modifications you made that alter wbar and menu (Ethernet Monitor script, etc.) and see if the
desktop is then correct.
-
Hi Rich
OK I think you mean CNTRL+ALT+F1
Results for 'free' as follows:
Without copy2fs.flg in /tce:
Total: 502852 Used: 202932 Free: 299920 Shared: 0 Buffers: 16768
With copy2fs.flg in /tce
Total: 502852 Used: 301800 Free: 201052 Shared: 0 Buffers: 196
As regards taking out any mods to wbar, same thing.
EDIT:
Remounting does work though:
sudo mount -no remount,ro /dev/sdb1
Confirmed with a 'mount' command:
/dev/sdb1 on /mnt/sdb1 type vfat (ro,relatime, .......)
-
Giving this wbar problem more thought and it's not really a problem as all the "appliances" or stand alone units I intend making
will not make use of the wbar anyway.
It will either be a server in which case X is not even required or then if I do use X for some "eye candy", there will still be no need for wbar
as it will run only one app for dedicated use which will be automatically loaded by putting a script in .X.d
In either case, there won't be any keyboard or mouse for user input.
If user input is required, it will be via dedicated buttons which will be connected to the serial port, lpt port or even using a usb joystick.
The idea being that the user should have no access to the system but only to functions relating to the sole app running, if applicable.
-
Hi Paulo
OK I think you mean CNTRL+ALT+F1
You think correctly, post fixed.
It seems kind of odd that adding the copy2fs.flg file would cause the desktop to get messed up.
-
Problem with wbar solved.
I am writing this with my dunce cap on. :-[
I had forgotten that I had added the directories /usr/local/share/applications and usr/local/share/pixmaps
to .filetool.lst to make them persistent as I put my EthernetMonitor script and associated icon in them.
I should have instead added only the actual .desktop and icon files to .filetool.lst.
Sorry about that.
On the plus side, since I don't need wbar for my appliances, I'll put back the mistake as it seems to be a simple way
to deactivate wbar.
-
Remounting the drive to 'ro' now also works perfectly.
Thank you to all those that helped out.