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" id="top">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<title>Adventures in Creating a Minimal Alpine Linux Installer</title>
<link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
<style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
</head>
<nav>
<a href="#menu">Menu ↓</a>
</nav>
<main>
<h1>Adventures in Creating a Minimal Alpine Linux Installer</h1>
<p>2022-12-08</p>
<h2>Introduction</h2>
<p>I've made the switch to Alpine Linux as my main laptop/desktop hybrid
workstation and I love it - warts and all. This post will follow my process building my Alpine Linux "installer" 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 "real" 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" 4K monitor.</p>
<blockquote><p>If you'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://git.sr.ht/~bt/alpine-linux-setup</a></p>
</blockquote>
<h2>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 "full" Wayland as possible</li>
</ol>
<h3>Benchmarks Comparisons</h3>
<p>I should mention that these are not official "benchmark" 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><p><strong>Garuda Linux</strong></p>
<ul>
<li>SwayWM</li>
<li>Firefox: 9 tabs (Figma included)</li>
<li>qutebrowser: 7 tabs</li>
<li>aerc: open/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><p><strong>Alpine Linux</strong></p>
<ul>
<li>SwayWM</li>
<li>Firefox: 9 tabs (Figma included)</li>
<li>qutebrowser: 7 tabs</li>
<li>aerc: open/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>Crashes & Roadblocks</h2>
<p>Of course, things didn't run 100% flawlessly out-of-the-box. There were some pretty annoying <strong>crashes</strong> and issues.</p>
<h3>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'll save you both the headache and large amount of time I wasted on this silly "bug" and just say it had to do with my user settings trying to launch "Chromium" 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>/etc/xdg/mimeapps.list</code> (which is included by default with the installer)</p>
<pre><code>[Default Applications]
x-scheme-handler/http=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/ftp=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/chrome=org.qutebrowser.qutebrowser.desktop
text/html=org.qutebrowser.qutebrowser.desktop
application/x-extension-htm=org.qutebrowser.qutebrowser.desktop
application/x-extension-html=org.qutebrowser.qutebrowser.desktop
application/x-extension-shtml=org.qutebrowser.qutebrowser.desktop
application/xhtml+xml=org.qutebrowser.qutebrowser.desktop
application/x-extension-xhtml=org.qutebrowser.qutebrowser.desktop
application/x-extension-xht=org.qutebrowser.qutebrowser.desktop
image/bmp=feh.desktop
image/gif=feh.desktop
image/jpeg=feh.desktop
image/jpg=feh.desktop
image/png=feh.desktop
image/tiff=feh.desktop
image/x-bmp=feh.desktop
image/x-pcx=feh.desktop
image/x-tga=feh.desktop
image/x-portable-pixmap=feh.desktop
image/x-portable-bitmap=feh.desktop
image/x-targa=feh.desktop
image/x-portable-greymap=feh.desktop
application/pcx=feh.desktop
image/svg+xml=feh.desktop
image/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'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>Screen Sharing</h3>
<p>This has been a complete failure for me. I'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 "hacks"</a> but neither work. For now I will fallback to my Garuda Linux OS boot and share my screen there. It's a silly workaround but I hardly ever need to "show my screen" 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>Some Minor Tweaks</h2>
<p>Some of these "hacks" or tweaks I had to implement might help others who run into similar issues when setting up their own Alpine desktops.</p>
<h3>aerc-mail</h3>
<p>It is important to install <code>gawk</code> since <code>awk</code> isn't "real" 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>Sublime Text</h3>
<p>Sublime Text requires flatpak, so if that isn't your <em>thing</em> then you're better off snagging a different editor. I'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...</p>
<pre><code>apk add flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/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>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 ~/.icons/capitaine-cursors</li>
<li>Copy the files over:
sudo cp -r /usr/share/icons/capitaine-cursors-dark ~/.icons/capitaine-cursors</li>
<li>The make your cursor changes using <code>gnome-tweaks</code></li>
<li>Profit!</li>
</ol>
<h2>Closing Thoughts</h2>
<p>Overall I'm decently satisfied with my "installer". I'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'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 "server distro". My daily driver proves it!</p>
<h2>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">↑ Top of the page</a></li>
</ul>
<small>
Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
Maintained with ♥ for the web. <br>
Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> & <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>
|