<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>overlayfs &#8211; Wade Tregaskis</title>
	<atom:link href="https://wadetregaskis.com/tags/overlayfs/feed/" rel="self" type="application/rss+xml" />
	<link>https://wadetregaskis.com</link>
	<description></description>
	<lastBuildDate>Sat, 02 Dec 2023 21:21:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wadetregaskis.com/wp-content/uploads/2016/03/Stitch-512x512-1-256x256.png</url>
	<title>overlayfs &#8211; Wade Tregaskis</title>
	<link>https://wadetregaskis.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">226351702</site>	<item>
		<title>The dumpster fire that is the Raspberry Pi</title>
		<link>https://wadetregaskis.com/the-dumpster-fire-that-is-the-raspberry-pi/</link>
					<comments>https://wadetregaskis.com/the-dumpster-fire-that-is-the-raspberry-pi/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sun, 13 Oct 2019 23:19:09 +0000</pubDate>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[aufs-kdms]]></category>
		<category><![CDATA[balenaEtcher]]></category>
		<category><![CDATA[Broken by design]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[HDMI]]></category>
		<category><![CDATA[Homebridge]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac Mini]]></category>
		<category><![CDATA[overlayfs]]></category>
		<category><![CDATA[Raspberry Pi 4]]></category>
		<category><![CDATA[Raspbian]]></category>
		<category><![CDATA[raspi-config]]></category>
		<category><![CDATA[Snafu]]></category>
		<category><![CDATA[VNC]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=4431</guid>

					<description><![CDATA[For a couple of little home projects I need an always-on computer. In an ideal world, perhaps, this would be something like a Mac Mini. Powerful [enough], easy to install &#38; maintain, runs anything &#38; everything (including anything Linux through Docker or at worst a straight VM). Unfortunately, Mac Minis are surprisingly expensive &#8211; even&#8230; <a class="read-more-link" href="https://wadetregaskis.com/the-dumpster-fire-that-is-the-raspberry-pi/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="2560" height="1507" src="https://wadetregaskis.com/wp-content/uploads/2019/10/Raspberry-Pi-4-Model-B-Side.webp" alt="" class="wp-image-4438" srcset="https://wadetregaskis.com/wp-content/uploads/2019/10/Raspberry-Pi-4-Model-B-Side.webp 2560w, https://wadetregaskis.com/wp-content/uploads/2019/10/Raspberry-Pi-4-Model-B-Side-512x301@2x.webp 1024w, https://wadetregaskis.com/wp-content/uploads/2019/10/Raspberry-Pi-4-Model-B-Side-2048x1205.webp 2048w, https://wadetregaskis.com/wp-content/uploads/2019/10/Raspberry-Pi-4-Model-B-Side-256x151.webp 256w, https://wadetregaskis.com/wp-content/uploads/2019/10/Raspberry-Pi-4-Model-B-Side-512x301.webp 512w" sizes="(max-width: 2560px) 100vw, 2560px" /><figcaption class="wp-element-caption"><em>The Raspberry Pi 4 (image courtesy of Michael Henzler </em><a href="https://commons.wikimedia.org/wiki/File:Raspberry_Pi_4_Model_B_-_Side.jpg" data-wpel-link="external" target="_blank" rel="external noopener">via Wikimedia Commons</a><em>)</em></figcaption></figure>
</div>


<p>For a couple of little home projects I need an always-on computer.  In an ideal world, perhaps, this would be something like a Mac Mini.  Powerful [enough], easy to install &amp; maintain, runs anything &amp; everything (including anything Linux through Docker or at worst a straight VM).  Unfortunately, Mac Minis are surprisingly expensive &#8211; even <em><a href="https://www.amazon.com/Apple-Mini-MC270LL-Desktop-Renewed/dp/B077JH51B6/ref=sr_1_2?keywords=2010+mac+mini&amp;qid=1571007498&amp;sr=8-2" data-wpel-link="external" target="_blank" rel="external noopener">nine year old</a></em><a href="https://www.amazon.com/Apple-Mini-MC270LL-Desktop-Renewed/dp/B077JH51B6/ref=sr_1_2?keywords=2010+mac+mini&amp;qid=1571007498&amp;sr=8-2" data-wpel-link="external" target="_blank" rel="external noopener"> models are a couple of hundred dollars at a minimum</a>.</p>



<p>So, I decided to instead explore this Raspberry Pi thing.</p>



<p>I very quickly started wishing I hadn&#8217;t.</p>



<p>The whole process thus far has just been a series of absurd errors &amp; frustration.</p>



<h3 class="wp-block-heading">Acquiring a Raspberry Pi</h3>



<p>Step zero, of merely buying a Raspberry Pi, is stupidly difficult.  Virtually all <a href="https://web.archive.org/web/20191120041414/https://www.raspberrypi.org/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-4gb" data-wpel-link="external" target="_blank" rel="external noopener">the retailers officially listed on raspberrypi.org</a> did not actually have the Raspberry Pi 4 in stock.  Later I discovered that some of these same retailers, that list no stock on their own websites, are <a href="https://www.amazon.com/gp/product/B07TXKY4Z9/ref=as_li_ss_tl?ie=UTF8&amp;psc=1&amp;linkCode=ll1&amp;tag=wasbl08-20&amp;linkId=976676888ba6d03800f8f4eaabb47166&amp;language=en_US" data-wpel-link="external" target="_blank" rel="external noopener">actively selling the Pi on Amazon</a>.  So I bought one through there, which is fine, but why doesn&#8217;t raspberrypi.org just <em>say</em> to use Amazon, if that&#8217;s really the only way to get them?</p>



<p>Next up was all the peripherals &#8211; the Pi by default doesn&#8217;t even come with a power supply, so it&#8217;s useless out of the box.  A cursory internet search reveals a huge amount of FUD about power supplies for the Pi.  I have no idea if it&#8217;s accurate or not, but given some relevant, <a href="https://www.scorpia.co.uk/2019/06/28/pi4-not-working-with-some-chargers-or-why-you-need-two-cc-resistors/" data-wpel-link="external" target="_blank" rel="external noopener">egregious design flaws in the Raspberry Pi 4</a>, it seems plausible.</p>



<p>Plus you need at a minimum some stand-offs, if not a full case, to prevent the Pi damaging the surface it&#8217;s placed on, or damaging itself through shorts.</p>



<p>And addressing those bootstrapping problems ended up sending me down a rabbit hole trying to find a cooling solution too, since it turns out <a href="https://www.tomshardware.com/reviews/pimoroni-fan-shim-heatsink-raspberry-pi-4,6219.html" data-wpel-link="external" target="_blank" rel="external noopener">the Raspberry Pi 4 is infamous for overheating</a> and suffering severe performance &#8211; and presumably reliability &#8211; problems as a result.</p>



<p>In the end, I spent several hours just figuring out how &amp; what to buy, and what is <a href="https://www.raspberrypi.com/products/raspberry-pi-4-model-b/" data-wpel-link="external" target="_blank" rel="external noopener">nominally &#8220;the $35 computer&#8221;</a> cost over $100.  Still without a case, even.</p>



<p>Sidenote:  the <a href="https://www.amazon.com/gp/product/B07TTTCN8H/ref=as_li_ss_tl?ie=UTF8&amp;linkCode=ll1&amp;tag=wasbl08-20&amp;linkId=a441b91c12e9531c45cf8c8722c32c38&amp;language=en_US" data-wpel-link="external" target="_blank" rel="external noopener">Pimoroni Fan Shim for Raspberry Pi</a>, while a little fiddly to assemble, does seem to work very well, and is quite quiet.</p>



<h3 class="wp-block-heading">Booting a Raspberry Pi</h3>



<p>This is the one part of the process thus far that&#8217;s actually worked mostly as it should.  I downloaded <a href="https://web.archive.org/web/20191011200635/https://www.raspberrypi.org/downloads/raspbian/" data-wpel-link="external" target="_blank" rel="external noopener">the full Raspbian Buster image</a>, following <a href="https://web.archive.org/web/20191011200620/https://www.raspberrypi.org/documentation/installation/installing-images/README.md" data-wpel-link="external" target="_blank" rel="external noopener">the installation guide</a>, and using <a href="https://etcher.balena.io/" data-wpel-link="external" target="_blank" rel="external noopener">balenaEtcher</a> to plop the image onto an SD card.  It all worked, even with the Etcher app being a tad dodgy (e.g. it lets you select non-removable volumes, which you cannot possibly intend to flash Raspbian onto, which is unnecessarily dangerous).  The Raspberry Pi 4 booted first time.</p>



<p>I tried to discern whether booting it headless from its birth would work.  <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/2" data-wpel-link="external" target="_blank" rel="external noopener">Officially it does not</a>, but I found that baffling and dug further, reading countless online guides (<a href="https://howtoraspberrypi.com/how-to-raspberry-pi-headless-setup/" data-wpel-link="external" target="_blank" rel="external noopener">e.g.</a>), which seemed to suggest it is possible.</p>



<p>I learnt that there exists <a href="https://www.raspberrypi.com/documentation/computers/configuration.html" data-wpel-link="external" target="_blank" rel="external noopener">the raspi-config tool</a> for headless setup, but it was unclear if it would really work, fully.  Though I did the GUI set up process to be conservative, I&#8217;ve since used raspi-config quite a bit.  Turns out, it not only does work just fine, but it&#8217;s actually <em>necessary</em> because the GUI install doesn&#8217;t do some important things (like resize the root file system to fill the SD card).</p>



<p>One thing which nearly blew the whole enterprise was when it came to join a wifi network.  I have multiple wifi networks, all with [different] emoji for names.  The GUI set up tool can&#8217;t handle emoji, rendering them as octal escape sequences.  I don&#8217;t happen to have memorised the four-character byte codes of each emoji, so it was a tedious game of trial-and-error in which I tried every permutation of unreadable SSID &amp; password.</p>



<p>Worse, it took multiple attempts, too, before it finally worked &#8211; I have no idea why it failed to join the network the first time or two, despite using the right password.  To this day it still arbitrarily fails to join one of the networks, yet joins the other just fine &#8211; both are in the same frequency bands from the exact same router.</p>



<h4 class="wp-block-heading">Aside:  Raspberry Pi 4 as a desktop computer</h4>



<p>Since my intended use is as a headless, touchless server, I played only briefly with it in the GUI, using a makeshift setup involving my TV (the only HDMI viewing device I&#8217;ve ever owned &#8211; lucky I had that at least!).  It&#8217;s fine, but very sluggish &#8211; it was immediately apparent that nobody with any other options would ever try to actually use a Raspberry Pi 4 as a desktop machine.  Just [cold] launching the web browser, before you even navigate to a website, takes up to a minute.  And everything is uncomfortably small, with no apparent system configuration options available to adjust render scaling.  Clearly Raspbian is not really intended to be operated at UHD resolutions.</p>



<h3 class="wp-block-heading">Enabling Remote Access</h3>



<p>Though I ultimately intended to use only SSH to interact with the Pi, I did want to have VNC available as an option in case I ran into anything which required using the GUI (again, based on the heavy bias in all the official documentation, and the uncertainty created by that as to whether GUI interaction is <em>required</em> or merely an option).</p>



<p>Turns out, VNC doesn&#8217;t work out of the box on a Raspberry Pi, unless you buy <a href="https://www.realvnc.com/en/connect/" data-wpel-link="external" target="_blank" rel="external noopener">commercial, proprietary VNC software</a>.  A baffling collusion on the part of the Raspberry Pi / Raspbian people.  You have to <a href="https://raspberrypi.stackexchange.com/questions/59605/access-to-raspberry-pi-vnc-session-from-mac-os-x" data-wpel-link="external" target="_blank" rel="external noopener">do additional work</a> to make it actually work &#8211; work that&#8217;s completely undocumented in any official Raspberry Pi / Raspbian documentation.  (at best you&#8217;ll find the interwebs littered with accounts &amp; instructions on installing a non-proprietary VNC server in replacement, which presumably also works to solve this problem)</p>



<h3 class="wp-block-heading">Installing Homebridge</h3>



<p>It wasn&#8217;t actually my purpose in buying the Raspberry Pi, but I decided that &#8211; before I go down the meat grinder that is presumably getting Swift to work on the Pi, since the Pi sadly lacks support for Swift out of the box &#8211; I figured I&#8217;d just real quickly install <a href="https://github.com/homebridge/homebridge" data-wpel-link="external" target="_blank" rel="external noopener">Homebridge</a>, since I do have a couple of devices I&#8217;ve long wished would work with HomeKit.</p>



<p>Ugh.</p>



<p>What a fucking dumpster fire.</p>



<p>You can install Homebridge raw, but since it&#8217;s written in Node.js, I didn&#8217;t want it going into my real, bare system &#8211; infecting it with npn and JavaScript and all that horror.</p>



<p>This would be a perfect opportunity for Docker, and as one might expect there are many guides on how to install Homebridge via Docker.</p>



<h3 class="wp-block-heading">Installing <s>Homebridge</s> Docker</h3>



<p>Sadly &#8211; and frankly bizarrely &#8211; running Homebridge through Docker <a href="https://github.com/homebridge/homebridge/blob/latest/README.md" data-wpel-link="external" target="_blank" rel="external noopener">isn&#8217;t officially supported</a>.</p>



<p><a href="https://web.archive.org/web/20200804135351/https://stevenbreuls.com/2019/01/homebridge-on-raspberry-pi-using-docker/" data-wpel-link="external" target="_blank" rel="external noopener">This 3rd party guide</a> appeared to be the best, based on <a href="https://github.com/homebridge/docker-homebridge" data-wpel-link="external" target="_blank" rel="external noopener">this third party project to support Homebridge in Docker</a>.  Step zero, of course, is to install Docker itself.  Surely that&#8217;s trivial.  It&#8217;s <em>Docker</em>.  What <em>doesn&#8217;t</em> run Docker these days?  Hell, macOS runs Docker and <em>it doesn&#8217;t even support containers</em>.  I was baffled that Raspbian didn&#8217;t include Docker pre-installed.</p>



<p>Many, <em>many</em> hours later, it still wasn&#8217;t working.  One would think that <em>Docker</em>, of all things, would be a seamless thing to <em>sudo apt install</em>, but far from it.  For example, the <a href="https://download.docker.com/linux/raspbian/" data-wpel-link="external" target="_blank" rel="external noopener">official Docker apt repo for Raspbian</a> tries to install some &#8216;aufs-kdms&#8217; as a dependency, even though &#8211; turns out &#8211; it&#8217;s <em>not</em> a real dependency and doesn&#8217;t even compile on Raspbian.  WTF?!</p>



<p>So that wasted hours, in figuring that out &#8211; predominately consumed in trawling the interwebs for a solution.  After many hours and reading through dozens if not hundreds of StackOverflow, blog, and similar sources quoting similar issues and offering bogus remedies, I <em>finally</em> found <a href="https://github.com/raspberrypi/linux/issues/3021" data-wpel-link="external" target="_blank" rel="external noopener">a thread that&#8217;s actually helpful</a>.</p>



<p>The worst was yet to come.</p>



<p>At some point in this process something <em>also</em> screwed with my Pi&#8217;s boot settings to force the root directory to be mounted &#8211; at boot &#8211; as <a href="https://wiki.archlinux.org/title/Overlay_filesystem" data-wpel-link="external" target="_blank" rel="external noopener">an overlay</a> with writes going to tmpfs (i.e. nowhere).  That wasted yet more hours as I painstakingly root-caused why my Raspberry Pi suddenly had alzheimers (and lost a lot of progress otherwise on installing Homebridge, too).</p>



<p>The web utterly failed in this case, as I couldn&#8217;t even find how to disable overlayfs.  All I got, mockingly, was endless articles explaining how to <em>enable</em> it and voluntarily ruin your day.</p>



<p>Even just figuring out that it <em>was</em> overlayfs that was screwing me took quite some time, since the first failure symptom was a baffling error message when trying to start dockerd:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>failed to start daemon: rename /var/lib/docker/runtimes /var/lib/docker/runtimes-old: invalid cross-device link</p>
<cite>With love and fuck you, dockerd</cite></blockquote>



<p>Ultimately I found a fix, in part thanks to <a href="https://forums.raspberrypi.com/viewtopic.php?p=1044893" data-wpel-link="external" target="_blank" rel="external noopener">this forum post</a> which had enough transparency on enabling this bullshit situation that I could deduce how to <em>disable</em> it &#8211; long story short you need to mount the SD card on another, working computer and remove &#8216;<em>boot=overlay</em>&#8216; from /boot/cmdline.txt and &#8216;<em>initramfs initrd.img-4.19.75-v7l+-overlay</em>&#8216; from /boot/config.txt.</p>



<p>How that ever got enabled I have no idea.  Absolutely no commands I ran had <em>anything</em> to do with that at all.  Evidently something buried inside Docker installation and/or execution performs this system lobotomy.  Even then, I&#8217;ve since reviewed every single command I ran, and nothing seems even remotely like it could nor should have caused that.</p>



<p>Despite ultimately defeating all this failure, I was greeted by merely another fatal failure, just as inscrutable as the last:</p>



<pre class="wp-block-preformatted"><strong>$ docker-compose up -d</strong>
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
<strong>$ ps auxww | grep docker
</strong>root &nbsp; &nbsp; &nbsp; 427&nbsp; 0.6&nbsp; 1.4 966720 58856 ?&nbsp; &nbsp; &nbsp; &nbsp; Ssl&nbsp; 15:42 &nbsp; 0:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
pi&nbsp; &nbsp; &nbsp; &nbsp; 1942&nbsp; 0.0&nbsp; 0.0 &nbsp; 7348 &nbsp; 472 pts/0&nbsp; &nbsp; S+ &nbsp; 15:46 &nbsp; 0:00 grep --color=auto docker</pre>



<p>Turns out this was because my user (&#8216;pi&#8217;, the default) wasn&#8217;t a member of the &#8216;docker&#8217; group.  I&#8217;d added it previously, but it must have been under the tyrannical overlayfs regime, and all memory of that event purged.  Adding it again (then logging out &amp; back in) fixed it (<em>sudo usermod -aG docker pi</em> btw).</p>



<h3 class="wp-block-heading">This is why Linux can&#8217;t have nice things</h3>



<p>In summary, Linux in general, and certainly Raspbian specifically, continues to be the same giant clusterfuck it&#8217;s always been.  I&#8217;m no Linux novice &#8211; I&#8217;ve been writing software for Linux for over a decade as my day job.  I&#8217;ve just had the luxury of teams of dozens if not hundreds of other engineers to insulate me from the bare wiring that is installing, configuring, &amp; maintaining a Linux installation.</p>



<p>At this point I&#8217;m <em>two days in</em> and have only <em>just</em> gotten Docker working.  For all the time I&#8217;ve wasted I&#8217;ve completely blown the price savings between a Raspberry Pi and even a <a href="https://www.apple.com/shop/buy-mac/mac-mini" data-wpel-link="external" target="_blank" rel="external noopener">brand new, $800 Mac Mini</a>.</p>



<p>And I still haven&#8217;t even <em>started</em> installing Swift, let-alone actually running my Swift app on the Raspberry Pi, which &#8211; contrary to where all my time has gone on this project &#8211; is the <em>actual</em> purpose of this whole sad enterprise.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/the-dumpster-fire-that-is-the-raspberry-pi/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4431</post-id>	</item>
	</channel>
</rss>
