text
stringlengths
0
1.49k
**Brian Ketelsen:** Exactly, and that defeats the whole purpose.
**Erik St. Martin:** Add that to the list of things you shouldn't have to worry about before getting stuff done...
**Carlisia Thompson:** But you still want same looking code everywhere, so...
**Brian Ketelsen:** So I do find it amazing that we've been having a podcast and we've been talking 20 minutes with probably my biggest hero in the programming universe, and we've talked about formatting code, and that's the only real topic we've hit. Honestly, that says something big about Go and the tooling and the e...
**Michael Stapelberg:** I'm so flattered... So why don't you ask something that you really wanna know?
**Brian Ketelsen:** Okay, why can't i3 run everywhere? What's keeping us from replacing Aqua in MacOS with something that runs i3, and why can't I run i3 on Windows? What's wrong with those people?
**Michael Stapelberg:** The simple answers in order are Apple, Microsoft... Right? \[laughter\] No, seriously, I actually had this phase where I used a Mac, and I looked into Aqua, but you can't look into it; it doesn't have an API, it doesn't have the concept of a window manager. In fact, on UNIX, the fact that we hav...
**Erik St. Martin:** So this might be interesting... It's not Go-related, but for people who may not be familiar with the difference -- like, what's the difference between a desktop and a window manager in a terminal like or console, \[unintelligible 00:18:38.23\]
**Brian Ketelsen:** That's a good question.
**Michael Stapelberg:** So what people would usually use these days is a desktop environment, where you have a couple of features such as (obviously) the desktop metaphor, which gives it the name, right? You have a couple of files and folders represented by icons on the arrangement, which is a desktop where you have mu...
But a window manager is just that one little subset of a desktop environment, just the thing that is concerned with managing the windows, right? So typically features that are relevant here are keyboard shortcuts that directly do something with the window. The one that I canonically list is either Alt+F4, which of cour...
\[19:56\] I think the term "window manager" means more than just that nowadays on Linux, because you have these communities that sort of gathered around the minimalistic window managers, and they build various parts of the desktop environment. So when you say you're using a window manager, what that really means is you...
For example, for monitor configuration, in i3 you would either directly use the command line tool _xrand_ to access that API, or the more convenient standalone _arandr_ tool. But i3 wouldn't be concerned at all with your monitor configuration; it just adapts to whatever it is that you configure. So the separation of co...
**Erik St. Martin:** I wonder with the Windows subsystem for Linux, I think that's only terminal VIM or would I be able to get X?
**Brian Ketelsen:** There's a terminal, but you can run an X server on Windows side and then i3 from WSL and view it in Windows, which was my [blog post](https://brianketelsen.com/); that's what I do.
**Erik St. Martin:** I may have to play with that.
**Brian Ketelsen:** It's really awesome, I'm not gonna lie. You get the best of many worlds.
**Erik St. Martin:** So what types of things are you working on these days, Michael? Are you mostly working in Go, or are you kind of jumping between languages?
**Michael Stapelberg:** I try to do most of my work in Go, both as a matter of preference and also just practicality... Because when you switch between languages, of course you need a little bit of time to adjust between the differences, be it in the tooling or be it just in the language, right? Of course, there are ex...
I try to make it as similar to Go as possible, in the sense that I do autoformat it, I have a good test suite which is easily executable... Stuff like that. But certainly, my big preference for anything else but existing legacy projects where we can't just make the switch is to do it entirely in Go, or as much as possi...
**Brian Ketelsen:** Nice. One of the things that you've been working on lately that I think is amazing is the [gokrazy](https://gokrazy.org/) user space for Raspberry Pi. Will you tell us what were your motivations behind that?
**Michael Stapelberg:** Right, sure. That's actually a fun little project that we started at the beginning of this year, actually. So the idea is that I was getting fed up with maintaining all of these little Raspberry Pi's. Many of us probably have a little Raspberry Pi at home, doing one thing or another in their hom...
The observation was that if I write most of my programs in Go nowadays, why do I even need to maintain this entire Linux ecosystem on each and every one of my Raspberry Pi's? At the point when I started the project I had three of them running. I looked at them, and I logged in, and because of the custom image that I us...
\[24:16\] I wanna have all of my devices up to date, ideally with an auto-update. Ideally, it goes so far that I have gifted devices to friends of mine and bought a new device where the only difference in operation was that the device auto-updated.
An example of that is the Turris Omnia [OpenWRT](https://openwrt.org/) router, which I would recommend, because it is to the best of my knowledge the only OpenWRT-based Linux router that auto-updates. That just comes from working full-time.
When I was a student, I could of course still spend quite a lot of time administering all of these servers; I was running Debian testing on many of my machines and virtual machines and all of the little devices, and I would auto-update them sort of regularly... But at some point your priorities change and you just can'...
So I wanna have devices that auto-update, and I wanna have devices that don't expose a lot of attack surface, both on the network itself and on the internet, of course. And I figured one way to do that would be to look into whether we could actually run a Linux kernel, and ideally, directly execute Go programs without ...
What gokrazy does is you give it a Go package that you have, be it like a little "Hello, world" program, or distinct bigger programs like the Prometheus Node Exporter if you wanna monitor your Raspberry Pi in Prometheus. You give a Go package to the gokrazy packer program, and what it does is it packs an SD card image ...
These four parts are all that you really have in the image, and then you just copy that image onto an SD card and you boot your Raspberry Pi from it, and there is no other moving parts, there's no Linux distribution; it's not based on Debian or based on Fedora or anything like that. It has just directly the kernel and ...
Another important part of this project is that all of these parts are auto-updated. For the kernel and for the firmware we have a cron job running on Travis, which every day goes and checks the upstream repositories for newer versions of what we have packaged. If there is, for example, a new kernel release - and I lear...
Then we have three pieces of automation which I'm not gonna cover in detail - you can just look at an existing presentation about gokrazy if you're interested - which sort of do this entire dance of "How about I take a pull request, I build a kernel, I amend a kernel into the pull request, I automatically test that new...
That's the ideal state for me. I wake up, I realize that there was a new Linux kernel release, because I'm already running it. Later on I read about it in the news and read the changelog.
**Brian Ketelsen:** That's awesome. That's automation right there.
**Erik St. Martin:** Do you have kind of like this split firmware, where in case it doesn't start up with the new kernel...? Because occasionally there's weird issues and the kernel won't boot.
**Michael Stapelberg:** \[28:05\] Yeah, that's true. One of these issues that we faced a while ago - and in fact the only one that we faced so far, and the project has been running, as I mentioned, since the beginning of the year - is that there's this little bit that needs to be set correctly, so that the kernel drive...
These are weird to debug problems, but aside from that we haven't had any sort of issue. But to answer the original question, no, there's no dual BIOS functionality or anything like that, because unfortunately the Raspberry Pi hardware just doesn't provide any mechanism to implement that. Either it boots or it doesn't ...
**Erik St. Martin:** Yeah, unless you're writing a little Assembly in the beginning, before Linux kicks in, but who wants to do that?
**Michael Stapelberg:** True, yeah. If you're gonna enable the hardware watchdog on the Raspberry Pi early enough, then maybe you could recover from the failed kernel boot. In fact, we also looked into whether we would want to have any sort of automation around that. What you can do on a modern Raspberry Pi is actually...
So as an end user of gokrazy, you wouldn't face a not-booting kernel, because the kernel needs to have booted on my Raspberry Pi. So I have sort of this sacrificial Raspberry Pi running at my home.
**Erik St. Martin:** I guess that's true too, right? We're talking about different worlds. This isn't some military-grade thing that's going to be running in a space shuttle; it's a Raspberry Pi in your home. If you have to pull out the SD card and manually copy over the files from the old version, it's not the end of ...
**Michael Stapelberg:** Absolutely. And I think I'm just personally annoyed enough by it when it doesn't boot that this will not be a problem for anyone else. \[laughter\]
**Brian Ketelsen:** Well, it's an amazing project; I love the idea of getting rid of all of that extra user space, and just booting the app you need. Most of the time we single-purpose our Raspberry Pi's, and this has me thinking now, Erik and I use Raspberry Pi's for our barbecue grills, and this gokrazy would be abso...
**Erik St. Martin:** More reasons to upgrade.
**Brian Ketelsen:** Right?
**Erik St. Martin:** I'm torn, though. I still wanna do some ARM stuff.
**Michael Stapelberg:** Well, what do you mean? You still can do ARM stuff on it, right?
**Erik St. Martin:** Well, so like actual embedded devices... I've got a Cortex-M4 (or something like that) that I've been running against an LCD screen. So I'm back and forth with whether to do a full-blown Linux install or not. But these things run so low-power now that it's -- I'm torn, because you can get developme...
**Michael Stapelberg:** \[32:11\] Absolutely, yeah. I think it totally makes sense if you just wanna play around and have some fun with the embedded device to go that route, but as soon as you just wanna have an idea become reality in any reasonable timeframe, and have it stay working, it makes much more sense to go th...
**Erik St. Martin:** Yeah, I guess that's right, too - time to market, right? If you're trying to build some sort of commercial product, then it makes sense to keep your bill of materials down and your costs down, and all of these things. But for most of us, we're building little trinkets for our house.
**Michael Stapelberg:** Absolutely, and I think if you can get it done in like a weekend, then that's gonna be much more motivating than if you will have to order things and solder them together and then come up with the firmware, and oh gosh, maybe even write it in C, right?