"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2020-06-29 Mon 22:27 -->
+<!-- 2020-06-30 Tue 19:45 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ninfacyzga-01 Manual</title>
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
-<li><a href="#orgb231d05">1. Location Logging</a>
+<li><a href="#org4ab28d5">1. Location Logging</a>
<ul>
-<li><a href="#orga7b5d26">1.1. Narrative</a></li>
-<li><a href="#orgc6050dc">1.2. Description</a>
+<li><a href="#org3a44301">1.1. Narrative</a></li>
+<li><a href="#orgeb3a61f">1.2. Description</a>
<ul>
-<li><a href="#org832c363">1.2.1. Hardware</a></li>
-<li><a href="#orgbe37034">1.2.2. Software</a></li>
-<li><a href="#org578c835">1.2.3. Output</a></li>
+<li><a href="#org68434d8">1.2.1. Hardware</a></li>
+<li><a href="#org6bf1f28">1.2.2. Software</a></li>
+<li><a href="#orga640ec2">1.2.3. Output</a></li>
</ul>
</li>
-<li><a href="#org7bb3aad">1.3. Operating Procedures</a>
+<li><a href="#org78712e3">1.3. Operating Procedures</a>
<ul>
-<li><a href="#orge393fe1">1.3.1. Initial Startup</a></li>
-<li><a href="#orgcaf0980">1.3.2. Normal Startup</a></li>
-<li><a href="#org73571fc">1.3.3. Normal Operation</a></li>
-<li><a href="#orga82b5fb">1.3.4. Normal Shutdown</a></li>
-<li><a href="#org5305842">1.3.5. Unscheduled Shutdown</a></li>
-<li><a href="#org4a5c4af">1.3.6. End of Life Disposal</a></li>
+<li><a href="#orgcc76a4c">1.3.1. Initial Startup</a></li>
+<li><a href="#org8fbf566">1.3.2. Normal Startup</a></li>
+<li><a href="#orgbc8af37">1.3.3. Normal Operation</a></li>
+<li><a href="#org46c0af5">1.3.4. Normal Shutdown</a></li>
+<li><a href="#org662e1e8">1.3.5. Unscheduled Shutdown</a></li>
+<li><a href="#org70e088c">1.3.6. End of Life Disposal</a></li>
</ul>
</li>
</ul>
</ul>
</div>
</div>
-<div id="outline-container-orgb231d05" class="outline-2">
-<h2 id="orgb231d05"><span class="section-number-2">1</span> Location Logging</h2>
+<div id="outline-container-org4ab28d5" class="outline-2">
+<h2 id="org4ab28d5"><span class="section-number-2">1</span> Location Logging</h2>
<div class="outline-text-2" id="text-1">
<p>
This document was created by Steven Baltakatei Sandoval on
-<span class="timestamp-wrapper"><span class="timestamp"><2020-06-29 Mon 12:14> </span></span> under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA 4.0 license</a>. It
-was updated by Steven Baltakatei Sandoval on <span class="timestamp-wrapper"><span class="timestamp"><2020-06-29 Mon 22:06></span></span>.
+<code>2020-06-29T12:14Z</code> under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA 4.0 license</a>. It
+was updated by Steven Baltakatei Sandoval on <code>2020-06-30T19:44Z</code>
</p>
</div>
-<div id="outline-container-orga7b5d26" class="outline-3">
-<h3 id="orga7b5d26"><span class="section-number-3">1.1</span> Narrative</h3>
+<div id="outline-container-org3a44301" class="outline-3">
+<h3 id="org3a44301"><span class="section-number-3">1.1</span> Narrative</h3>
<div class="outline-text-3" id="text-1-1">
<p>
Ninfacyzga-01 records (logs) its position in time and space using a
</p>
</div>
</div>
-<div id="outline-container-orgc6050dc" class="outline-3">
-<h3 id="orgc6050dc"><span class="section-number-3">1.2</span> Description</h3>
+<div id="outline-container-orgeb3a61f" class="outline-3">
+<h3 id="orgeb3a61f"><span class="section-number-3">1.2</span> Description</h3>
<div class="outline-text-3" id="text-1-2">
</div>
-<div id="outline-container-org832c363" class="outline-4">
-<h4 id="org832c363"><span class="section-number-4">1.2.1</span> Hardware</h4>
+<div id="outline-container-org68434d8" class="outline-4">
+<h4 id="org68434d8"><span class="section-number-4">1.2.1</span> Hardware</h4>
<div class="outline-text-4" id="text-1-2-1">
</div>
<ol class="org-ol">
-<li><a id="orgb0e8ddc"></a>Raspberry Pi Zero W<br />
+<li><a id="org3fcab7d"></a>Raspberry Pi Zero W<br />
<div class="outline-text-5" id="text-1-2-1-1">
<p>
See the <a href="https://www.raspberrypi.org/pi-zero-w/">OEM</a> webpage for this product.
</p>
</div>
</li>
-<li><a id="org7b37dcc"></a>PiZ UpTime 2.0<br />
+<li><a id="org4a38c06"></a>PiZ UpTime 2.0<br />
<div class="outline-text-5" id="text-1-2-1-2">
<p>
See the <a href="https://alchemy-power.com/piz-uptime-2-0/">OEM</a> webpage for this product.
</li>
</ol>
</div>
-<div id="outline-container-orgbe37034" class="outline-4">
-<h4 id="orgbe37034"><span class="section-number-4">1.2.2</span> Software</h4>
+<div id="outline-container-org6bf1f28" class="outline-4">
+<h4 id="org6bf1f28"><span class="section-number-4">1.2.2</span> Software</h4>
<div class="outline-text-4" id="text-1-2-2">
<p>
<code>bkgpslog</code> : The bash script that performs the location data
</div>
<ol class="org-ol">
-<li><a id="org0c488b2"></a>Narrative<br />
+<li><a id="org33a99e7"></a>Narrative<br />
<div class="outline-text-5" id="text-1-2-2-1">
<p>
<code>bkgpslog</code> populates a 60-second buffer with NMEA data from <code>gpsd</code> via
</ol>
</div>
-<div id="outline-container-org578c835" class="outline-4">
-<h4 id="org578c835"><span class="section-number-4">1.2.3</span> Output</h4>
+<div id="outline-container-orga640ec2" class="outline-4">
+<h4 id="orga640ec2"><span class="section-number-4">1.2.3</span> Output</h4>
<div class="outline-text-4" id="text-1-2-3">
</div>
<ol class="org-ol">
-<li><a id="org72b99a5"></a>File Formats<br />
+<li><a id="orgbe90ee3"></a>File Formats<br />
<ol class="org-ol">
-<li><a id="orgdb7241e"></a>NMEA<br />
+<li><a id="orga69e180"></a>NMEA<br />
<div class="outline-text-6" id="text-1-2-3-1-1">
<p>
See the <a href="https://en.wikipedia.org/wiki/NMEA_0183">Wikipedia page</a> for this.
</p>
</div>
</li>
-<li><a id="orgeea00c8"></a>GPX<br />
+<li><a id="org03fca13"></a>GPX<br />
<div class="outline-text-6" id="text-1-2-3-1-2">
<p>
See the <a href="https://en.wikipedia.org/wiki/GPS_Exchange_Format">Wikipedia page</a> for this. <a href="http://wiki.gis.com/wiki/index.php/WGS84">WGS84</a> is the datum used.
</p>
</div>
</li>
-<li><a id="orgc8b05e7"></a>KML<br />
+<li><a id="org9469dda"></a>KML<br />
<div class="outline-text-6" id="text-1-2-3-1-3">
<p>
See the <a href="https://en.wikipedia.org/wiki/Keyhole_Markup_Language">Wikipedia page</a> for this. <a href="http://wiki.gis.com/wiki/index.php/WGS84">WGS84</a> is the datum used.
</li>
</ol>
</li>
-<li><a id="org5c2a1ad"></a>Encryption Method<br />
+<li><a id="org4923cfc"></a>Encryption Method<br />
<div class="outline-text-5" id="text-1-2-3-2">
<p>
Files produced by the bkgpslog script are encrypted against a set of
</p>
</div>
<ol class="org-ol">
-<li><a id="org460d569"></a>Encryption Commands<br />
+<li><a id="org5f006f6"></a>Encryption Commands<br />
<div class="outline-text-6" id="text-1-2-3-2-1">
<p>
Files may be encrypted to several recipients using a command similar to:
</li>
-<li><a id="org1a5268c"></a>Decryption Commands<br />
+<li><a id="orgd0d1b14"></a>Decryption Commands<br />
<div class="outline-text-6" id="text-1-2-3-2-2">
<p>
Files may be decrypted using a command similar to:
</ol>
</div>
</div>
-<div id="outline-container-org7bb3aad" class="outline-3">
-<h3 id="org7bb3aad"><span class="section-number-3">1.3</span> Operating Procedures</h3>
+<div id="outline-container-org78712e3" class="outline-3">
+<h3 id="org78712e3"><span class="section-number-3">1.3</span> Operating Procedures</h3>
<div class="outline-text-3" id="text-1-3">
</div>
-<div id="outline-container-orge393fe1" class="outline-4">
-<h4 id="orge393fe1"><span class="section-number-4">1.3.1</span> Initial Startup</h4>
+<div id="outline-container-orgcc76a4c" class="outline-4">
+<h4 id="orgcc76a4c"><span class="section-number-4">1.3.1</span> Initial Startup</h4>
<div class="outline-text-4" id="text-1-3-1">
<p>
See OEM (Ozzmaker) <a href="https://ozzmaker.com/berrygps-berrygps-imu-quick-start-guide/">quickstart guide for the BerryGPS-IMU</a>.
</div>
<ol class="org-ol">
-<li><a id="org5d6581b"></a>Physical Setup<br />
+<li><a id="orgae43b4b"></a>Physical Setup<br />
<div class="outline-text-5" id="text-1-3-1-1">
<p>
BerryGPS-IMU must be electrically connected to the correct pins on the
</div>
</li>
-<li><a id="orgdf04559"></a>Software Setup<br />
+<li><a id="orgb3c2fc2"></a>Software Setup<br />
<ol class="org-ol">
-<li><a id="org4804e32"></a>Install Executables<br />
+<li><a id="org651214a"></a>Install Executables<br />
<div class="outline-text-6" id="text-1-3-1-2-1">
<p>
Install Raspbian 10 Buster onto an SD card image. See the Raspberry Pi
</div>
</li>
-<li><a id="orgcf659dd"></a>Automatic Start Configuration<br />
+<li><a id="org1cc0c53"></a>Disable Swap File<br />
<div class="outline-text-6" id="text-1-3-1-2-2">
<p>
+Since standard Raspbian 10 (Buster) install involves copying
+unencrypted file system image to SD card which is mounted by the
+Raspberry Pi, system memory may be written to disk in the form of a
+Swap file as described <a href="https://ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/">here</a>. In order to reduce the chance that
+location log data is ever written to disk, swap file functionality
+must be disabled<sup><a id="fnr.1" class="footref" href="#fn.1">1</a></sup>.
+</p>
+
+<p>
+Raspbian 10 uses dphys-swapfile to manage a swap file. It may be
+disabled persistently<sup><a id="fnr.2" class="footref" href="#fn.2">2</a></sup> by running
+the following command:
+</p>
+
+<pre class="example">
+sudo systemctl disable dphys-swapfile.service
+
+</pre>
+
+<p>
+To view the status of the swap file in Raspbian 10, run <code>free -m</code>:
+</p>
+
+<pre class="example">
+pi@ninfacyzga-01:~$ free -m
+ total used free shared buff/cache available
+Mem: 432 86 36 21 309 268
+Swap: 99 0 99
+</pre>
+
+<p>
+After disabling the swap file and rebooting:
+</p>
+
+<pre class="example">
+pi@ninfacyzga-01:~$ free -m
+ total used free shared buff/cache available
+Mem: 432 89 214 3 128 289
+Swap: 0 0 0
+</pre>
+</div>
+</li>
+
+<li><a id="orgfdbf7d1"></a>Automatic Start Configuration<br />
+<div class="outline-text-6" id="text-1-3-1-2-3">
+<p>
Edit the user cron job list with <code>$ crontab -e</code> to add the following
lines:
</p>
<p>
The <code>age1z2...qkv6p</code> is an <code>age</code> public key string. Please see the
-<a href="#orgc8fd75d">Key Generation</a> section for an explanation.
+<a href="#org4647532">Key Generation</a> section for an explanation.
</p>
<p>
</div>
</li>
-<li><a id="org5275559"></a>Log Transfer Configuration<br />
-<div class="outline-text-6" id="text-1-3-1-2-3">
+<li><a id="org2de2dd5"></a>Log Transfer Configuration<br />
+<div class="outline-text-6" id="text-1-3-1-2-4">
<p>
Log files may be shared to other machines via <code>syncthing</code>. See <a href="https://docs.syncthing.net/">this</a>
manual for how to set up a shared folder and add Ninfacyzga-01 as a
</div>
</li>
-<li><a id="orgc8fd75d"></a>Key Generation<br />
-<div class="outline-text-6" id="text-1-3-1-2-4">
+<li><a id="org4647532"></a>Key Generation<br />
+<div class="outline-text-6" id="text-1-3-1-2-5">
<p>
An <code>age</code> encryption key may be generated like so:
</p>
<pre class="example">
$ umask # Gets current umask
0022 # Note: This is the default umask for Raspbian 10
-$ umask 066 # Sets umask so key.txt will have no permissions except for owner (you)
+$ umask 066 # So key.txt will have no perms except for owner (you)
$ umask # Confirm umask set to 066
0066
$ age-keygen > key.txt
</ol>
</div>
-<div id="outline-container-orgcaf0980" class="outline-4">
-<h4 id="orgcaf0980"><span class="section-number-4">1.3.2</span> Normal Startup</h4>
+<div id="outline-container-org8fbf566" class="outline-4">
+<h4 id="org8fbf566"><span class="section-number-4">1.3.2</span> Normal Startup</h4>
<div class="outline-text-4" id="text-1-3-2">
<p>
Turn on Ninfacyzga-01 by supplying 5VDC power to the Raspberry Pi. No
</p>
</div>
</div>
-<div id="outline-container-org73571fc" class="outline-4">
-<h4 id="org73571fc"><span class="section-number-4">1.3.3</span> Normal Operation</h4>
+<div id="outline-container-orgbc8af37" class="outline-4">
+<h4 id="orgbc8af37"><span class="section-number-4">1.3.3</span> Normal Operation</h4>
<div class="outline-text-4" id="text-1-3-3">
<p>
No interaction beyond continually supplying approximately 100mA of
</p>
</div>
<ol class="org-ol">
-<li><a id="org55738e2"></a>Log Transfer<br />
+<li><a id="orgeaa5887"></a>Log Transfer<br />
<div class="outline-text-5" id="text-1-3-3-1">
<p>
Log files may be transferred by use of <code>syncthing</code> shared folders.
</p>
</div>
</li>
-<li><a id="org16c5bdc"></a>Automatic Updates<br />
+<li><a id="org51a37e4"></a>Automatic Updates<br />
<div class="outline-text-5" id="text-1-3-3-2">
<p>
The <code>automatic-upgrades</code> package, if installed, should automatically
</li>
</ol>
</div>
-<div id="outline-container-orga82b5fb" class="outline-4">
-<h4 id="orga82b5fb"><span class="section-number-4">1.3.4</span> Normal Shutdown</h4>
+<div id="outline-container-org46c0af5" class="outline-4">
+<h4 id="org46c0af5"><span class="section-number-4">1.3.4</span> Normal Shutdown</h4>
<div class="outline-text-4" id="text-1-3-4">
<p>
The system may be shutdown via SSH by running:
</div>
</div>
-<div id="outline-container-org5305842" class="outline-4">
-<h4 id="org5305842"><span class="section-number-4">1.3.5</span> Unscheduled Shutdown</h4>
+<div id="outline-container-org662e1e8" class="outline-4">
+<h4 id="org662e1e8"><span class="section-number-4">1.3.5</span> Unscheduled Shutdown</h4>
<div class="outline-text-4" id="text-1-3-5">
<p>
Ninfacyzga-01 as described and setup should tolerate unscheduled power
</p>
</div>
</div>
-<div id="outline-container-org4a5c4af" class="outline-4">
-<h4 id="org4a5c4af"><span class="section-number-4">1.3.6</span> End of Life Disposal</h4>
+<div id="outline-container-org70e088c" class="outline-4">
+<h4 id="org70e088c"><span class="section-number-4">1.3.6</span> End of Life Disposal</h4>
<div class="outline-text-4" id="text-1-3-6">
<p>
LiPo batteries used by the PiZ Uptime 2.0 module should be disposed of
</div>
</div>
</div>
+<div id="footnotes">
+<h2 class="footnotes">Footnotes: </h2>
+<div id="text-footnotes">
+
+<div class="footdef"><sup><a id="fn.1" class="footnum" href="#fnr.1">1</a></sup> <div class="footpara"><p class="footpara">
+Explanation:
+<a href="https://ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/">https://ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/</a>
+</p></div></div>
+
+<div class="footdef"><sup><a id="fn.2" class="footnum" href="#fnr.2">2</a></sup> <div class="footpara"><p class="footpara">
+Persistant disabling of swap in
+Raspbian 10 Buster:
+<a href="https://www.raspberrypi.org/forums/viewtopic.php?p=1490692&sid=5c596a124b7805d6b10dab8d3d7caf16#p1490692">https://www.raspberrypi.org/forums/viewtopic.php?p=1490692&sid=5c596a124b7805d6b10dab8d3d7caf16#p1490692</a>
+</p></div></div>
+
+
</div>
+</div></div>
<div id="postamble" class="status">
-<p class="date">Date: 2020-06-29T22:16Z</p>
<p class="author">Author: Steven Baltakatei Sandoval</p>
-<p class="date">Created: 2020-06-29 Mon 22:27</p>
+<p class="date">Created: 2020-06-30 Tue 19:45</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>