Skip to content

Node OS Setup Guide Raspbian

Matt Magoffin edited this page May 11, 2018 · 10 revisions

SolarNode OS Setup Guide - Raspbian

This guide describes the steps I took to create a "minimal" Raspbian based system on a Raspberry Pi computer. The steps are very similar to what is described in the SolarNode OS Setup Guide for Debian 8. This guide just documents the Raspberry Pi specific differences from that guide.

Raspbian comes pre-configured as an OS disk image already, so our tasks mainly consist of removing packages not meeting our requirements and tweaking some settings a bit.

Note: Binary images for the SolarNode Raspbian OS are also available here: http://sourceforge.net/projects/solarnetwork/files/solarnode/pi These are great if you are after a quick OS setup (but they do not always contain the latest updates), if you want the latest and greatest you should continue reading below.

Download Raspbian and copy to SD card

Download the Raspbian image from http://www.raspberrypi.org/downloads. That page also has links and instructions for copying the image onto a SD card, for example http://elinux.org/RPi_Easy_SD_Card_Setup.

Boot the Raspbian Pi

Insert your freshly minted SD card into the Pi, and power the device on. You'll land on an initial setup screen. I tweaked the GPU memory to 16MB (the minimum) since a SolarNode doesn't use the graphics hardware.

OS setup tasks

  1. Configure the local time zone

    Run the dpkg-reconfigure tzdata command to set the time zone appropriately.

  2. Label the root partition

     e2label /dev/mmcblk0p2 SOLARNODE
    
  3. Edit /etc/fstab to change the options for root filesystem to noatime,nodiratime,errors=remount-ro, it should look like this:

     LABEL=SOLARNODE / ext4 noatime,nodiratime,errors=remount-ro 0 1
    
  4. Add a solar user, add them to dialout group, to allow use of serial ports.

     useradd -m -U -G dialout solar
    
  5. Edit /etc/default/tmpfs and set RAMTMP=yes to enable /tmp as a RAM filesystem.

Software setup

Now I manually removed and added the software I deemed appropriate for the node, as described in the SolarNode OS Setup Guide for Debian 8 Software setup section.

Raspbian comes loaded with development tools (gcc, g++, python, etc) and X11 stuff (x11, lxde, etc) that are of no use to a SolarNode. They can all be removed. Further savings can be found by installing the deborphan and debfoster packages. Use those to identify non-essential packages and remove them.

Hardware watchdog

The Raspberry Pi has a hardware "watchdog" timer that can be used to automatically restart after a fault. First update /boot/config.txt to add the following:

	dtparam=watchdog=on

Next, create /etc/modprobe.d/bcm2835-wdt.conf With the following:

	options bcm2835_wdt heartbeat=14 nowayout=0

Finally, edit /etc/systemd/system.conf and change these lines (note CrashReboot is not related to the watchdog timer, but allows systemd to reboot the device if the system has a software crash):

	CrashReboot=yes
	RuntimeWatchdogSec=14
Clone this wiki locally