View previous topic :: View next topic |
Author |
Message |
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Thu Nov 17, 2005 11:08 pm Post subject: How do I make an "appliance"? - SOLVED |
|
|
I have a Gentoo setup that works as a digital picture frame. I want to be able to make one for my parents, but they will never be able to operate a computer. What I need is an appliance, that is they need to be able to turn the computer on and off without messing up the file system.
I figure the way to do this is to mount the file systems read only. Of course the OS still wants to write log files and such. The easy way around this seems be to mount /var/log on a ram disk. Does this sound reasonable? Is there anything else I need to be aware of?
Last edited by maguro on Tue Dec 06, 2005 8:53 pm; edited 1 time in total |
|
Back to top |
|
|
dasilva Tux's lil' helper
Joined: 20 Oct 2004 Posts: 83
|
Posted: Fri Nov 18, 2005 3:58 am Post subject: |
|
|
so you want to make it safe for them to turn off the computer just by pressing the off button? i dont really understand.... |
|
Back to top |
|
|
Archangel1 Veteran
Joined: 21 Apr 2004 Posts: 1212 Location: Work
|
Posted: Fri Nov 18, 2005 6:31 am Post subject: |
|
|
Might be worth looking at making a press of the power button put the machine into suspend? That way it'll come on & turn off nearly instantly and won't mutilate filesystems in the process (mounting them ro as well is probably a good idea too).
This would of course require a cooperative machine - suspend doesn't work on all machines unfortunately. _________________ What are you, stupid? |
|
Back to top |
|
|
lets.alfamoon.com n00b
Joined: 18 Nov 2005 Posts: 1
|
|
Back to top |
|
|
Jake Veteran
Joined: 31 Jul 2003 Posts: 1132
|
Posted: Fri Nov 18, 2005 7:19 am Post subject: |
|
|
Depending on what you run, more of /var will need to be writable. Probably at least /var/run to store PID files. You'll also want a tmpfs (EDIT: the difference between tmpfs and ramfs is that ramfs can't be swapped) for /tmp, which should be set to mode 1777. It should be safe to symlink /tmp to also serve as /var/tmp. Your user might need to write to $HOME, so that's something to consider too.
When I made a special purpose Linux system, I used busybox and a few other basics built from Gentoo with Code: | ROOT=/path/to/custom_system emerge --nodeps busybox glibc... | and handled dependencies manually. Watch your use flags too; busybox needs make-symlinks to be used this way. When you boot, busybox init will run /etc/init.d/rcS which can contain some scripting magic.
If you don't want to get that involved, a normal Gentoo installation should be easy to adapt. /etc/conf.d/local.start and, depending on what you're doing, /etc/inittab are your friends. You should be able to display your pictures on the frame buffer and not need X (media-gfx/fbv possibly?), but I've never tried anything like that. |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Fri Nov 18, 2005 4:58 pm Post subject: |
|
|
Jake, you provided some very good ideas especially the tmpfs suggestion. Some I'm already doing, the others I'll definitely try out. Thanks.
Here is a little background on what I'm doing. I disassemble old laptops and completely embed the guts in a picture frame. I installed wireless on mine, and SSH into it to manage the device. For my family, I need a device that needs no management.
I built a couple pictureframes using Knoppix. Knoppix is loaded on one HD partition and the photos on another. These machines work OK, but you have to be computer literate to add or change photos. You also have to open the device and connect a USB drive containing the new photos. This is necessary because the old laptops typically support one CD and one floppydrive. The laptop thinks the HD is a CD (Knoppix is loaded using ISOLINUX), so if I connect a real CD the OS thinks it is a floppy. So much for Knoppix. Now I'm back to Gentoo.
I use local.start to start fbi, the frame buffer imager. Because I use local.start the photos display prior to the logon prompt. All the user needs to do is to power on the device and wait. In a couple of minutes family photos fill the screen.
The Gentoo system needed to do this is very basic. It's only purpose is to play photos in the frame buffer. It takes relatively little space on a 10Gig drive leaving room for many thousands of photos. The appliance version reads the photos from a CD not the HD. When booted the CD is mounted and all photos on it are played. To change photos appliance users only need to change CDs, and power cycle the device. Using a CD limits the number of photos to about 1500 per CD, but thats not too bad. At 30 seconds per picture it takes 12.5 hours to display the contents of 1 CD.
The only issue with all this is the fact that rw file systems get corrupted when data is left in buffers and the device powered off, accidentially unplugged, etc. This is why my interest in putting all directories that need to be written to on a temporary drive.
I have been documenting the construction process with lots of photos. If anyone is interested in what these things look like in operation, or how they are assembled let me know. |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Fri Nov 18, 2005 11:42 pm Post subject: |
|
|
It seems to be working. I power cycled the PC a half dozen times and didn't get one complaint the the file system was not properly closed.
I created tmpfs for: /var/run, /var/log/, /var/tmp, /var/lock, and /var/lib/init.d. I tried mounting / read only, but that resulted in problems with /etc/mtab and the randomizer not being initialized. With / in RW mode some files are written, but it looks like all the buffers are cleared by the time local.start is loaded. |
|
Back to top |
|
|
Jake Veteran
Joined: 31 Jul 2003 Posts: 1132
|
Posted: Fri Nov 18, 2005 11:55 pm Post subject: |
|
|
maguro wrote: | It seems to be working. I power cycled the PC a half dozen times and didn't get one complaint the the file system was not properly closed.
I created tmpfs for: /var/run, /var/log/, /var/tmp, /var/lock, and /var/lib/init.d. I tried mounting / read only, but that resulted in problems with /etc/mtab and the randomizer not being initialized. With / in RW mode some files are written, but it looks like all the buffers are cleared by the time local.start is loaded. |
You might be able to solve your mtab problems by changing "mount -at noproc,noshm,no${NET_FS_LIST// /,no} >/dev/null" in /etc/init.d/localmout to "mount -ant noproc,noshm,no${NET_FS_LIST// /,no} >/dev/null". The "n" tells mount to not write to /etc/mtab.
EDIT: or you could remount with "mount -no remount /"
Last edited by Jake on Fri Nov 18, 2005 11:57 pm; edited 1 time in total |
|
Back to top |
|
|
numerodix l33t
Joined: 18 Jul 2002 Posts: 743 Location: nl.eu
|
Posted: Fri Nov 18, 2005 11:56 pm Post subject: |
|
|
Isn't this what a journalled filesystem is for? Say your run ext3, what's the chance of getting file corruption if you just arbitrarily power off the system a few dozen times (yes I realize I could do it myself but I do not very much want to )? _________________ undvd - ripping dvds should be as simple as unzip |
|
Back to top |
|
|
Jake Veteran
Joined: 31 Jul 2003 Posts: 1132
|
Posted: Sat Nov 19, 2005 12:07 am Post subject: |
|
|
I have an idea so you don't have to power cycle for each new CD. Now that UDEV is the default, it should be easy to add hal and ivman. According to ivman's sourceforge page, it can be configured to run arbitrary commands on CD insertion. Your command could be "some_command_to_show_pictures ; umount /mnt/cdrom && eject /dev/cdrom". When the tray opens, pop in another CD, close it, and it's back in action. |
|
Back to top |
|
|
curtis119 Bodhisattva
Joined: 10 Mar 2003 Posts: 2160 Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.
|
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Tue Nov 22, 2005 10:30 pm Post subject: |
|
|
Jake,
I opted to remount the root filesystem ro as part of the local.start script. It makes life easier.
I liked your idea to be able to load new CDs, but the problem is that the CDs are supposed to play continuously. There is no stopping point.
The only inputs the user has are the power button and the CD drive button. If the user wanted to change CDs while a CD was already playing, Linux would not allow the drive to be opened, or would hal or ivman allow this?
The only way I know of to change CDs under the current setup is for the user to power off the unit, power on and hit the CD open button and install a new CD, then power the unit off and back on again. Tis ugly for sure. I'm open to a better way if one exists. |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Tue Nov 22, 2005 10:50 pm Post subject: |
|
|
I tried GNAP. It did look like the best solution, but I ran into problems compiling the JPEG program which is a requirement for FBI. I could get no help from the GNAP forum, or the mailing list, so I put GNAP aside.
Correct me if I'm wrong, but I thought that GNAP used ISOLINUX to load the OS. If that is the case, then I would have the same problems loading a CD as I did with Knoppix.
I tried vanilla Gentoo, then discovered GNAP. Couldn't get GNAP to work, so I tried Knoppix. CD problems with Knoppix, brought me back to the Gentoo version I worked with earlier. I now have a working solution. Yep it's an ugly solution, but with the help I've been getting here it is improving every day. I've tested the working setup on four different laptops (2 each from Dell and IBM), and have had no problems at all. So I think I'll stick with the ugly solution for now. If GNAP is workable, and I can get JPEG and FBI to compile, then I just might go back and try to make a more "elegant" solution to the problem. |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Fri Dec 02, 2005 2:50 am Post subject: |
|
|
Jake,
I think your idea of using hal and ivman will work. All I need to do is to copy the pictures from the CDROM to the hard drive. It will be a lot quieter, and I can then eject the CD and restart the slide show. I'm emerging hal and ivman now. I'll let you know how it works out. |
|
Back to top |
|
|
Jake Veteran
Joined: 31 Jul 2003 Posts: 1132
|
Posted: Fri Dec 02, 2005 4:58 am Post subject: |
|
|
maguro wrote: | Jake,
I think your idea of using hal and ivman will work. All I need to do is to copy the pictures from the CDROM to the hard drive. It will be a lot quieter, and I can then eject the CD and restart the slide show. I'm emerging hal and ivman now. I'll let you know how it works out. |
It'll take a little more scripting, but copying to the hard drive will definitely work. On a CD insert event, you can verify that the CD has pictures, copy the new pictures, delete the old pictures, restart the program with the new picture list, and eject the CD.
EDIT: if you want to avoid working with hal and ivman, you could check for a new CD with a cron job that runs every few minutes |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Fri Dec 02, 2005 8:27 am Post subject: |
|
|
maguro wrote: | It seems to be working. I power cycled the PC a half dozen times and didn't get one complaint the the file system was not properly closed.
I created tmpfs for: /var/run, /var/log/, /var/tmp, /var/lock, and /var/lib/init.d. I tried mounting / read only, but that resulted in problems with /etc/mtab and the randomizer not being initialized. With / in RW mode some files are written, but it looks like all the buffers are cleared by the time local.start is loaded. |
ln -s /proc/mounts /etc/mtab and you're done |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Sat Dec 03, 2005 2:42 am Post subject: |
|
|
I am getting closer. Ivman is automounting the cd, but I can't get it to execute anything, and there are no error messages.
Here is my ImConfigActions.xml file
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<ivm:ActionsConfig version="0.2" xmlns:ivm="http://www.eikke.com/ivm">
<!-- unlock all removable devices - harmless for devices without tray locking -->
<ivm:Match name="storage.removable" value="true">
<ivm:Option name="unlock" value="true" />
</ivm:Match>
<!-- try to mount any mountable volume at all -->
<ivm:Match name="ivm.mountable" value="true">
<ivm:Option name="mount" value="true" />
</ivm:Match>
<!-- mount some non-Linux filesystems read/write for everyone in
group with gid=100 -->
<ivm:Match name="hal.volume.fstype" value="vfat">
<ivm:Option name="mountoption" value="umask=0007" />
<ivm:Option name="mountoption" value="gid=100" />
</ivm:Match>
<!-- autoplay CDs -->
<ivm:Match name="hal.volume.disc.type" value="cd_rom">
<ivm:Option name="exec" value="/usr/bin/rm /home/photos/*" />
<ivm:Option name="exec" value="/usr/bin/cp /mnt/cdrom/* /home/photos" />
<ivm:Option name="exec" value="/bin/umount /mnt/cdrom" />
<ivm:Option name="exec" value="/usr/bin/fbi -a -t5 -u /home/photos/*" />
</ivm:Match>
</ivm:ActionsConfig>
|
Can anyone see what I'm doing wrong? |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Mon Dec 05, 2005 6:56 pm Post subject: |
|
|
I changed tactics a bit. First I turned on debug and changed the bunch of exec statements in IvmConfigActions.xml to a single exec running a shell script. I never saw any indication of the script running in /var/log/messages, so I commented out the instructions in IvmConfigActions.xml and put the script in IvmConfigBase.xml. Now the script runs, the photo directory is cleared, new photos copied, and the cdrom unmounted. The only thing that doesn't work is the display of the photos by fbi. I checked and fbi isn't running in the background. It just seems to die. If I run the script manually it works great.
Does anyone have an idea how to solve this prolem? |
|
Back to top |
|
|
maguro n00b
Joined: 26 Feb 2005 Posts: 41 Location: Delaware, USA
|
Posted: Tue Dec 06, 2005 8:53 pm Post subject: |
|
|
I solved the problem with brute force. Since FBI runs properly on boot, I just copy the new photos, unmount and eject the disk, and then reboot.
The new scheme works great.
Thanks to all who helped with this especially Jake. |
|
Back to top |
|
|
ryker Guru
Joined: 28 May 2003 Posts: 412 Location: Portage, IN
|
Posted: Wed Dec 07, 2005 4:31 am Post subject: |
|
|
So what do these things look like that you are makeing? They sound cool. _________________ Athlon 64 3200+, 80G WD sata hd + 200G IDE, 1G Geil DDR400, MSI K8T Neo
IntelCore2Duo 2.0Ghz MSI laptop,100G SATA hd, 2G RAM |
|
Back to top |
|
|
|