{"id":179,"date":"2014-03-26T23:00:40","date_gmt":"2014-03-26T12:30:40","guid":{"rendered":"http:\/\/davidmonro.net\/blog\/?p=179"},"modified":"2014-03-26T23:00:40","modified_gmt":"2014-03-26T12:30:40","slug":"building-root-filesystems-for-the-raspberry-pi","status":"publish","type":"post","link":"https:\/\/blog.davidmonro.net\/index.php\/2014\/03\/26\/building-root-filesystems-for-the-raspberry-pi\/","title":{"rendered":"Building root filesystems for the Raspberry Pi"},"content":{"rendered":"<p><a href=\"http:\/\/www.raspbian.org\">Rasbian<\/a> on the <a href=\"http:\/\/www.raspberrypi.org\/\">Raspberry Pi<\/a> is great, but the official image is large and includes all sorts of stuff I don&#8217;t need (my Pis don&#8217;t generally have screens as I use them for playing music, or being GPS NTP time servers, or collecting data on my power usage &#8211; not things which need, for example, a screen and a gui!). I did manage to cobble together a base install using the Debian installer on a Pi, but it took a loooong time, and cloning this image every time I want to do a new one is a bit of a pain; for one thing the image is quite old now so apt-get has to update a lot of packages to bring it up to current, and for another the machines all get the same ssh keys, and the filesystems all have the same &#8216;unique&#8217; IDs (which tends to confuse things if you simultaneously plug 2 of the resulting SD cards into the same PC!).<\/p>\n<p>So I&#8217;ve been mucking around with a better way to generate basic Rasbian installs for the Pi. I&#8217;ve discovered that the combination of <a href=\"https:\/\/wiki.debian.org\/Multistrap\">multistrap<\/a> and <a href=\"https:\/\/wiki.debian.org\/QemuUserEmulation\">qemu-static<\/a> allows the building of a complete up-to-date installation tree on my x86-64 Ubuntu desktop in a tiny fraction of the time it would take to do the same thing on a Pi. For my base install (which is indeed <em>very<\/em> basic) my machine takes about 5 minutes (with the packages files already in my apt-cacher-ng cache). Sometimes the longest step is copying all the data to the SD card!<\/p>\n<p>One of the nice things about using multistrap to do this is the ability to make cascaded configurations &#8211; so I can define a base configuration which works for me, and then have other configurations which build on top of it for specific applications. If I make improvements to the base, then regenerating one of the cascaded configurations will incorporate the improvements automatically. It also means I don&#8217;t have to remember or document what I did to the base image to get the application-specific image, because it is all there in the configuration file and associated scripts.<\/p>\n<p>The resulting trees are still proper Rasbian installs and can be updated and managed with apt-get etc just like a normal install.<\/p>\n<p>I&#8217;ve put a small collection of multistrap configuration bits and attached shell scripts up on <a href=\"https:\/\/github.com\/davidmonro\/pi_builder\">github<\/a> if anyone else wants to have a play with it. It includes one configuration file for a base install, and one for a customized install including <a href=\"http:\/\/www.musicpd.org\/\">MPD<\/a>. There&#8217;s a handful of shell scripts which do most of the work beyond getting the packages extracted &#8211; these will almost certainly need customizing for your environment. You will definitely want to read the README. Oh, and you&#8217;ll need a Debian-derived (eg Ubuntu) machine to do the work, since multistrap relies on apt to do all the package work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;ve been mucking around with a better way to generate basic Rasbian installs for the Raspberry Pi&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-179","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/posts\/179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":0,"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.davidmonro.net\/index.php\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}