Luet – Resources https://luet.io/docs/resources/ Recent content in Resources on Luet Hugo -- gohugo.io Thu, 05 Jan 2017 00:00:00 +0000 Docs: ARM images https://luet.io/docs/resources/arm/ Mon, 01 Jan 0001 00:00:00 +0000 https://luet.io/docs/resources/arm/ <div class="alert alert-warning" role="alert"> <h4 class="alert-heading">Warning</h4> This article is outdated. Please refer to the <a href="../../tutorials/hello_world/">&ldquo;Hello World&rdquo;</a> tutorial instead. </div> <p>Here we show an example on how to build &ldquo;burnable&rdquo; SD images for Raspberry Pi with Luet. This approach lets you describe and version OTA upgrades for your embedded devices, delivering upgrades as layer upgrades on the Pi.</p> <p>The other good side of the medal is that you can build a Luet package repository with multiple distributions (e.g. <code>Raspbian</code>, <code>OpenSUSE</code>, <code>Gentoo</code>, &hellip; ) and switch among them in runtime. In the above example <code>Raspbian</code> and <code>Funtoo</code> (at the time of writing) are available.</p> <h2 id="prerequisites">Prerequisites</h2> <p>You have to run the following steps inside an ARM board to produce arm-compatible binaries. Any distribution with Docker will work. Note that the same steps could be done in a cross-compilation approach, or with qemu-binfmt in a amd64 host.</p> <p>You will also need in your host:</p> <ul> <li>Docker</li> <li>Luet installed (+container-diff) in <code>/usr/bin/luet</code> (arm build)</li> <li>make</li> </ul> <h2 id="build-the-packages">Build the packages</h2> <p>Clone the repository <a href="https://github.com/Luet-lab/luet-embedded">https://github.com/Luet-lab/luet-embedded</a></p> <pre><code>$&gt; git clone https://github.com/Luet-lab/luet-embedded $&gt; cd luet-embedded $&gt; sudo make build-all ... </code></pre> <p>If a rebuild is needed, just do <code>sudo make rebuild-all</code> after applying the changes.</p> <h2 id="create-the-repository">Create the repository</h2> <pre><code>$&gt; sudo make create-repo ... </code></pre> <h2 id="serve-the-repo-locally">Serve the repo locally</h2> <pre><code>$&gt; make serve-repo ... </code></pre> <h2 id="create-the-flashable-image">Create the flashable image</h2> <h3 id="funtoo-based-system">Funtoo based system</h3> <pre><code>$&gt; sudo LUET_PACKAGES='distro/funtoo-1.4 distro/raspbian-boot-0.20191208 system/luet-develop-0.5' make image ... </code></pre> <h3 id="raspbian-based-system">Raspbian based system</h3> <pre><code>$&gt; sudo LUET_PACKAGES='distro/raspbian-0.20191208 distro/raspbian-boot-0.20191208 system/luet-develop-0.5' make image ... </code></pre> <p>At the end of the process, a file <code>luet_os.img</code>, ready to be flashed to an SD card, should be present in the current directory.</p> <h2 id="add-packages">Add packages</h2> <p>In order to build and add <a href="https://luet.io/docs/concepts/packages/">packages</a> to the exiting repository, simply add or edit the <a href="https://luet.io/docs/concepts/packages/specfile">specfiles</a> under the <code>distro</code> folder. When doing <code>make rebuild-all</code> the packages will be automatically compiled and made available to the local repository.</p> Docs: Building https://luet.io/docs/resources/building/ Mon, 01 Jan 0001 00:00:00 +0000 https://luet.io/docs/resources/building/ <h2 id="simple-package-build">Simple package build</h2> <p>Creating and building a simple <a href="https://luet.io/docs/concepts/packages/">package</a>:</p> <pre tabindex="0"><code>$&gt; mkdir package $&gt; cat &lt;&lt;EOF &gt; package/build.yaml image: busybox steps: - echo &quot;foo&quot; &gt; /foo EOF $&gt; cat &lt;&lt;EOF &gt; package/definition.yaml name: &quot;foo&quot; version: &quot;0.1&quot; EOF $&gt; luet build --all 📦 Selecting foo 0.1 📦 Compiling foo version 0.1 .... ☕ 🐋 Downloading image luet/cache-foo-bar-0.1-builder 🐋 Downloading image luet/cache-foo-bar-0.1 📦 foo Generating 🐋 definition for builder image from busybox 🐋 Building image luet/cache-foo-bar-0.1-builder 🐋 Building image luet/cache-foo-bar-0.1-builder done Sending build context to Docker daemon 4.096kB ... </code></pre><h3 id="build-packages">Build packages</h3> <p>In order to build a specific version, a full <a href="https://luet.io/docs/concepts/packages/">package</a> definition (triple of <code>category</code>, <code>name</code> and <code>version</code>) has to be specified. In this example we will also enable package compression (gzip).</p> <pre tabindex="0"><code>$&gt; mkdir package $&gt; cat &lt;&lt;EOF &gt; package/build.yaml image: busybox steps: - echo &quot;foo&quot; &gt; /foo EOF $&gt; cat &lt;&lt;EOF &gt; package/definition.yaml name: &quot;foo&quot; version: &quot;0.1&quot; category: &quot;bar&quot; EOF $&gt; luet build bar/foo-0.1 --compression gzip 📦 Selecting foo 0.1 📦 Compiling foo version 0.1 .... ☕ 🐋 Downloading image luet/cache-foo-bar-0.1-builder 🐋 Downloading image luet/cache-foo-bar-0.1 📦 foo Generating 🐋 definition for builder image from busybox 🐋 Building image luet/cache-foo-bar-0.1-builder 🐋 Building image luet/cache-foo-bar-0.1-builder done Sending build context to Docker daemon 4.096kB ... </code></pre> Docs: Frequently Asked Questions https://luet.io/docs/resources/faq/ Mon, 01 Jan 0001 00:00:00 +0000 https://luet.io/docs/resources/faq/ <h2 id="cant-build-packages">Can&rsquo;t build packages</h2> <p>There might be several reasons why packages fails to build, for example, if your build fails like this:</p> <pre tabindex="0"><code>$ luet build ... INFO Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ERROR Error: Failed compiling development/toolchain-go-0.6: failed building package image: Could not push image: quay.io/mocaccino/micro-toolchain:latest toolchain-go-development-0.6-builder.dockerfile: Could not build image: quay.io/mocaccino/micro-toolchain:latest toolchain-go-development-0.6-builder.dockerfile: Failed running command: : exit status 1 ERROR Bailing out </code></pre><p>means the user you are running the build command can&rsquo;t either connect to docker or <code>docker</code> is not started.</p> <p>Check if the user you are running the build is in the <code>docker</code> group, or if the <code>docker</code> daemon is started.</p> <p>Luet by default if run with multiple packages summarize errors and can be difficult to navigate to logs, but if you think you might have found a bug, run the build with <code>--debug</code> before opening an issue.</p> <h2 id="why-the-name-luet">Why the name <code>luet</code>?</h2> <p>Well, I have the idea that programs should be small, so they are not difficult to type and easy to remember, and easy to stick in. <code>luet</code> is really a combination of the first letters of my fiancee name (Lucia) and my name (Ettore) <code>lu+et = luet</code>! and besides, happen to be also a <a href="http://www.comuniterrae.it/punto/ponte-luet/">small bridge</a> in Italy ;)</p> Docs: Images from scratch https://luet.io/docs/resources/scratch/ Mon, 01 Jan 0001 00:00:00 +0000 https://luet.io/docs/resources/scratch/ <p>The Docker image <code>quay.io/luet/base</code> is a <code>scratch</code> Docker image always kept up-to-date with the latest luet version. That image can be used to bootstrap new images with Luet repositories with the packages you want, from the repositories you prefer.</p> <p>For example we can mount a config file, and later on install a package:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">cat <span style="color:#4e9a06">&lt;&lt;EOF &gt; $PWD/luet.yaml </span><span style="color:#4e9a06">repositories: </span><span style="color:#4e9a06"> - name: &#34;micro-stable&#34; </span><span style="color:#4e9a06"> enable: true </span><span style="color:#4e9a06"> cached: true </span><span style="color:#4e9a06"> priority: 1 </span><span style="color:#4e9a06"> type: &#34;http&#34; </span><span style="color:#4e9a06"> urls: </span><span style="color:#4e9a06"> - &#34;https://get.mocaccino.org/mocaccino-micro-stable&#34; </span><span style="color:#4e9a06">EOF</span> docker rm luet-runtime-test <span style="color:#ce5c00;font-weight:bold">||</span> <span style="color:#204a87">true</span> docker run --name luet-runtime-test <span style="color:#4e9a06">\ </span><span style="color:#4e9a06"></span> -ti -v /tmp:/tmp <span style="color:#4e9a06">\ </span><span style="color:#4e9a06"></span> -v <span style="color:#000">$PWD</span>/luet.yaml:/etc/luet/luet.yaml:ro <span style="color:#4e9a06">\ </span><span style="color:#4e9a06"></span> quay.io/luet/base install shells/bash docker commit luet-runtime-test luet-runtime-test-image <span style="color:#8f5902;font-style:italic"># Try your new image!</span> docker run -ti --entrypoint /bin/bash --rm luet-runtime-test-image </code></pre></div><p>In this way we will create a new image, with only <code>luet</code> and <code>bash</code>, and nothing else from a scratch image.</p> Docs: References https://luet.io/docs/resources/references/ Mon, 01 Jan 0001 00:00:00 +0000 https://luet.io/docs/resources/references/ <h2 id="references">References</h2> <p>Here is a list of references to projects that are related to Luet (open up a PR to add yours to the list!):</p> <table> <thead> <tr> <th>Description</th> <th>URL</th> </tr> </thead> <tbody> <tr> <td>Official Luet repository</td> <td><a href="https://github.com/Luet-lab/luet-repo">https://github.com/Luet-lab/luet-repo</a></td> </tr> <tr> <td>Example repository to host package browser websites on gh-pages. It uses the package-browser extension to generate HTML pages from a list of luet repositories</td> <td><a href="https://github.com/Luet-lab/package-browser-sample">https://github.com/Luet-lab/package-browser-sample</a></td> </tr> <tr> <td>LineageOS builds with luet</td> <td><a href="https://github.com/mudler/android-builds">https://github.com/mudler/android-builds</a></td> </tr> <tr> <td>Example repository template to build packages on github actions and push packages on a container registry</td> <td><a href="https://github.com/Luet-lab/github-repository">https://github.com/Luet-lab/github-repository</a></td> </tr> <tr> <td>Immutable container OS toolkit</td> <td><a href="https://github.com/rancher-sandbox/cOS-toolkit">https://github.com/rancher-sandbox/cOS-toolkit</a></td> </tr> <tr> <td>mocaccinoOS desktop</td> <td><a href="https://github.com/mocaccinoOS/desktop">https://github.com/mocaccinoOS/desktop</a></td> </tr> <tr> <td>mocaccinoOS extra</td> <td><a href="https://github.com/mocaccinoOS/mocaccino-extra">https://github.com/mocaccinoOS/mocaccino-extra</a></td> </tr> <tr> <td>agregOS built with luet/mocaccino</td> <td><a href="https://interne.agreg.org/agregOS/">https://interne.agreg.org/agregOS/</a></td> </tr> </tbody> </table>