aboutsummaryrefslogtreecommitdiff
path: root/build/posts/alpine/index.html
blob: ce078c78438695814690a2598bb9d46f52151031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="color-scheme" content="dark light">
	<link rel="icon" href="data:,">
	<title>Adventures in Creating a Minimal Alpine Linux Installer</title>
	<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
	<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>

<nav>
	<a href="#menu">Menu &darr;</a>
</nav>

<main>
<h1 id="adventures-in-creating-a-minimal-alpine-linux-installer">Adventures in Creating a Minimal Alpine Linux Installer</h1>
<p>2022-12-08</p>
<h2 id="introduction">Introduction</h2>
<p>I&#8217;ve made the switch to Alpine Linux as my main laptop&#47;desktop hybrid
workstation and I love it - warts and all. This post will follow my process building my Alpine Linux &#8220;installer&#8221; I used for this workstation, along with covering some bugs I found during my adventure.</p>
<p>My main goals when starting this project were to have a daily driver that was:</p>
<ul>
<li>free of any &#8220;real&#8221; desktop environment</li>
<li>Wayland based with SwayWM</li>
<li>as lightweight as possible</li>
</ul>
<p>Overall, I think I achieved what I was aiming for. After logging in (there is no login manager, you do it directly through the boot terminal) you will see:</p>
<p><img src="/public/images/alpine-1.jpg" alt="" /></p>
<p>(You can view the <a href="/public/images/alpine-1.jpg">full res image here</a>)</p>
<p>For reference this is running on a X260 ThinkPad with 16GB RAM, docked and connected to a 27&#8221; 4K monitor.</p>
<blockquote>
<p>If you&#8217;d prefer to just go straight to the installer, feel free to jump over to the project repo: <a href="https://git.sr.ht/~bt/alpine-linux-setup">https:&#47;&#47;git.sr.ht&#47;~bt&#47;alpine-linux-setup</a></p>
</blockquote>
<h2 id="getting-started">Getting Started</h2>
<p>My main reasoning for switching away from my previous setup (Garuda Linux running Sway) to Alpine was two fold:</p>
<ol>
<li>I wanted a more lightweight, less resource hungry system</li>
<li>I wanted to go as &#8220;full&#8221; Wayland as possible</li>
</ol>
<h3 id="benchmarks-comparisons">Benchmarks Comparisons</h3>
<p>I should mention that these are not official &#8220;benchmark&#8221; applications or proper testing. I merely reproduced the same tasks, using the same applications, for the same amount of time and compared the usage. Just keep that in mind!</p>
<ul>
<li><strong>Garuda Linux</strong>
<ul>
<li>SwayWM</li>
<li>Firefox: 9 tabs (Figma included)</li>
<li>qutebrowser: 7 tabs</li>
<li>aerc: open&#47;running</li>
<li>tut: open-running</li>
<li>Sublime Text: single project open</li>
<li><strong>Memory usage (range): 6.0-7.2 GB</strong></li>
</ul></li>
<li><strong>Alpine Linux</strong>
<ul>
<li>SwayWM</li>
<li>Firefox: 9 tabs (Figma included)</li>
<li>qutebrowser: 7 tabs</li>
<li>aerc: open&#47;running</li>
<li>tut: open-running</li>
<li><strong>Memory usage (range): 1.0-3.5 GB</strong></li>
</ul></li>
</ul>
<p>Switching over has basically cut my system memory usage <strong>in half</strong>. That ended up being a much better improvement than I predicted. These are beyond just numbers too - the system <em>feels</em> snappier.</p>
<p>So, from a speed and usability stand point I considered this a success already.</p>
<h2 id="crashes-roadblocks">Crashes &#38; Roadblocks</h2>
<p>Of course, things didn&#8217;t run 100% flawlessly out-of-the-box. There were some pretty annoying <strong>crashes</strong> and issues.</p>
<h3 id="greetings-tty">Greetings, tty</h3>
<p>After installing <code>tut</code> I started walking through its guided setup. Once it prompted me to login via browser in order to authenticate, I clicked the link provided in the terminal. I was immediately thrown out of my session and into <code>tty</code>. Awesome.</p>
<p>I&#8217;ll save you both the headache and large amount of time I wasted on this silly &#8220;bug&#8221; and just say it had to do with my user settings trying to launch &#8220;Chromium&#8221; as my default browser. I normally set qutebrowser as much default, so this was a change I needed to make anyway.</p>
<p>I put the following in my <code>&#47;etc&#47;xdg&#47;mimeapps.list</code> (which is included by default with the installer)</p>
<pre><code>[Default Applications]
x-scheme-handler&#47;http=org.qutebrowser.qutebrowser.desktop
x-scheme-handler&#47;https=org.qutebrowser.qutebrowser.desktop
x-scheme-handler&#47;ftp=org.qutebrowser.qutebrowser.desktop
x-scheme-handler&#47;chrome=org.qutebrowser.qutebrowser.desktop
text&#47;html=org.qutebrowser.qutebrowser.desktop
application&#47;x-extension-htm=org.qutebrowser.qutebrowser.desktop
application&#47;x-extension-html=org.qutebrowser.qutebrowser.desktop
application&#47;x-extension-shtml=org.qutebrowser.qutebrowser.desktop
application&#47;xhtml+xml=org.qutebrowser.qutebrowser.desktop
application&#47;x-extension-xhtml=org.qutebrowser.qutebrowser.desktop
application&#47;x-extension-xht=org.qutebrowser.qutebrowser.desktop
image&#47;bmp=feh.desktop
image&#47;gif=feh.desktop
image&#47;jpeg=feh.desktop
image&#47;jpg=feh.desktop
image&#47;png=feh.desktop
image&#47;tiff=feh.desktop
image&#47;x-bmp=feh.desktop
image&#47;x-pcx=feh.desktop
image&#47;x-tga=feh.desktop
image&#47;x-portable-pixmap=feh.desktop
image&#47;x-portable-bitmap=feh.desktop
image&#47;x-targa=feh.desktop
image&#47;x-portable-greymap=feh.desktop
application&#47;pcx=feh.desktop
image&#47;svg+xml=feh.desktop
image&#47;svg-xml=feh.desktop
</code></pre>
<p>You might have also noticed that I use <code>feh</code> as my default image viewer as well. That&#8217;s just my personal preference, feel free to switch that out as you see fit.</p>
<p><strong>Sidenote:</strong> Chromium now runs perfectly fine since the original crashes. I have no clue how or why. Wayland black magic, I assume? Maybe I installed a package that helped or an update occurred. <em>Shrug</em></p>
<h3 id="screen-sharing">Screen Sharing</h3>
<p>This has been a complete failure for me. I&#8217;ve tried both the Chromium and Firefox <a href="https://lr.vern.cc/r/swaywm/comments/l4e55v/guide_how_to_screenshare_from_chromiumfirefox/">implementations of these &#8220;hacks&#8221;</a> but neither work. For now I will fallback to my Garuda Linux OS boot and share my screen there. It&#8217;s a silly workaround but I hardly ever need to &#8220;show my screen&#8221; in any capacity as is.</p>
<p>I can live without this for now. (Please <a href="https://lists.sr.ht/~bt/public-inbox">leave a message in my personal inbox</a> if you know of another workaround for this!)</p>
<h2 id="some-minor-tweaks">Some Minor Tweaks</h2>
<p>Some of these &#8220;hacks&#8221; or tweaks I had to implement might help others who run into similar issues when setting up their own Alpine desktops.</p>
<h3 id="aerc-mail">aerc-mail</h3>
<p>It is important to install <code>gawk</code> since <code>awk</code> isn&#8217;t &#8220;real&#8221; on Alpine. Once you have that on you system <code>aerc</code> will render emails out-of-the-box.[^1]</p>
<pre><code>apk add gawk
</code></pre>
<h3 id="sublime-text">Sublime Text</h3>
<p>Sublime Text requires flatpak, so if that isn&#8217;t your <em>thing</em> then you&#8217;re better off snagging a different editor. I&#8217;ve tried multiple times throughout my career to use an alternate editor (preferably 100% open source) but keep finding myself returning to Sublime. Maybe one day&#8230;</p>
<pre><code>apk add flatpak
flatpak remote-add --if-not-exists flathub https:&#47;&#47;flathub.org&#47;repo&#47;flathub.flatpakrepo
</code></pre>
<p>Then reboot your machine for the changes to take. Login again and run:</p>
<pre><code>flatpak install flathub com.sublimetext.three
</code></pre>
<p>FYI: You <em>might</em> need to run the above commands under <code>sudo</code> if your current user lacks proper permissions.</p>
<h3 id="cursors">Cursors</h3>
<p>This was an odd edge case. For the most part, the default system cursors worked out of the box. Then I installed Firefox. That caused me to go down a rabbit-hole of (still open) tickets referencing poor cursor rendering for Wayland Firefox. Apparently some users even have their cursors disappear completely!</p>
<p>Not to worry though - there is an easy fix!</p>
<ol>
<li>Install <a href="https://github.com/keeferrourke/capitaine-cursors">capitaine cursors</a>:
apk add capitaine-cursors</li>
<li>Make a new directory:
mkdir -p ~&#47;.icons&#47;capitaine-cursors</li>
<li>Copy the files over: 
sudo cp -r &#47;usr&#47;share&#47;icons&#47;capitaine-cursors-dark ~&#47;.icons&#47;capitaine-cursors</li>
<li>The make your cursor changes using <code>gnome-tweaks</code></li>
<li>Profit!</li>
</ol>
<h2 id="closing-thoughts">Closing Thoughts</h2>
<p>Overall I&#8217;m decently satisfied with my &#8220;installer&#8221;. I&#8217;ve included <em>just enough</em> packages to hit the ground running when using this on new hardware or even needing to recover existing devices. This project certainly won&#8217;t cover the needs of all users, but my hope is that others can always fork their own and give it a spin! (Please do report any bugs or issues as you come across them!)</p>
<p>Alpine Linux can be more than just a &#8220;server distro&#8221;. My daily driver proves it!</p>
<h2 id="refs">Refs</h2>
<ol>
<li>This is now included in my official installer script, but I originally had to install this manually.</li>
</ol>
<footer role="contentinfo">
    <h2>Menu Navigation</h2>
    <ul id="menu">
        <li><a href="/">Home</a></li>
        <li><a href="/projects">Projects</a></li>
        <li><a href="/uses">Uses</a></li>
        <li><a href="/wiki">Wiki</a></li>
        <li><a href="/resume">Resume</a></li>
        <li><a href="/colophon">Colophon</a></li>
        <li><a href="/now">Now</a></li>
        <li><a href="/donate">Donate</a></li>
        <li><a href="/atom.xml">RSS</a></li>
        <li><a href="#top">&uarr; Top of the page</a></li>
    </ul>
    <small>
        Built with <a href="https://barf.btxx.org">barf</a>. <br>
        Feeds: <a href="/atom.xml">Atom</a> & <a href="/rss.xml">RSS</a><br>
        Maintained with ♥ for the web. <br>
        Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
        The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
    </small>
</footer>