OpenAgricultureFoundation / openag_brain

ROS package for controlling an OpenAg food computer
GNU General Public License v3.0
221 stars 68 forks source link

[Exploration] Test Software on Ubuntu/Beaglebone #202

Open gordonbrander opened 7 years ago

gordonbrander commented 7 years ago

Test software on Ubuntu/Beaglebone to see if it works.

Summary:

What would be involved?

(Exported from Trello https://trello.com/c/wPGNFrJL/1010-develop-beaglebone-brain-proof-of-concept-and-roadmap)

ghost commented 7 years ago

@gordonbrander Do you have a citation or more details on "Beaglebone is also supposed to have a file system that prevents corruption in case of hard shutdown or bad write to memory"?

I did some googling just now, but I didn't find any reference to Beaglebone being somehow more resistant than Raspberry Pi to flash filesystem corruption. I did find mentions of people having SD card (or maybe eMMC?) corruption problems on Beaglebone though. It also looks like there are a bunch of different distros that will work on Beaglebone. Do you know which one your source was talking about?

As far as I can tell, there are two common techniques for making embedded linux robust against power failures:

  1. Use a power failure detection circuit with battery backup that lasts long enough for a graceful shutdown.
  2. Use a readonly filesystem on the flash disk which mounts a ramdisk for RW stuff needed by the runtime. The obvious disadvantage here is that you can't save anything to the disk. Splitting between RO and RW partitions wouldn't necessarily keep you out of trouble, because there's no guarantee that the card's wear-leveling will respect your partitions. For all you know, it might decide to move some of your RO stuff to a new flash block as part of updating your RW partition, and it might corrupt the block due to a badly timed power failure.

[edit: Possible work-around: make an SD card image that uses exclusively RO partitions, then use a nice big USB flash drive for an RW partition to hold your logs and images. An intermediate step would be to move chatty logs and CouchDB to a USB flash drive.]

gordonbrander commented 7 years ago

@gordonbrander Do you have a citation or more details on "Beaglebone is also supposed to have a file system that prevents corruption in case of hard shutdown or bad write to memory"? ...Do you know which one your source was talking about?

I wish I did! We heard this word-of-mouth from someone with a lot of technical expertise, but need to confirm it is true. The exploration here is mostly just to see if this is actually the case... No commitment or plan.

@rbaynes has been doing some stress-testing on the corruptibility of the Pi. The workarounds you mention are also something we've been looking into. Currently working on a battery solution.

ghost commented 7 years ago

I wish I did! We heard this word-of-mouth from someone with a lot of technical expertise, but need to confirm it is true.

Hmm... I suggest that before you do anything else with Beaglebone, it would be good to get specifics on which distro, which filesystem, and why it's better, including dates for when the information was accurate.

My Pi 3 with regular Raspbian Jessie Lite is using ext4 which is a good journaling filesystem--supposedly the journaling does well at recovering from power interruptions. I've seen people say other filesystems are marginally better for reducing wear on flash disks, but ext4 is definitely solid and battle tested (not like ext2 which corrupts easy due to the lack of a journal). The Raspberry Pi Foundation people have done a good job with Rasbian, and it's based on Debian to begin with. But, things have come a long way since the original Raspberry Pi hardware. There were plenty of problems with Raspberry Pi in the past--it's possible what you heard was based on a comparison from years ago.

[edit: If you search for using journaling on flash disks, you'll find FUD about how it's the worst thing ever, but that's based on problems with using old NAND flash chips as block devices back in the day. With the wear leveling controllers on good quality modern SD cards and SSDs, it's a different story.]