Live data from Hacker News

Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

gokrazy.org

31–40 of 90 posts

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#31

It is really interesting that Gokrazy uses an upstream kernel (with a couple of minor patches). https://github.com/gokrazy/kernel/blob/3ecdc901da51c2c5b6bf7...

Why is that interesting? Just that they're not having to carry special patches for the RPi3 or what?

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#32
post #10

Earlier quoted context omitted.

Yep - for home automation style stuff (which the author seems to have built it for - see the showcase section), having a full Linux distro is actually a real pain. I've taken to building my own stuff with the ESP series of microcontrollers, home made PCBs, etc - once it's built - it just keeps chugging along, unlike my original stuff I built atop RaspberryPis with Linux.

I've done a lot of this sort of this as well. The ESP8266 is so great for simple on/off switches and sensors. But-- there are so many applications for having a full IoT Linux distribution that I can't believe this isn't already a solved problem. I'm imagining an ultra-stable distro that is easy to deploy to a headless machine, handles security updates, handles flaky wi-fi issues, tests the SD card (I've had more than…

People have been building stuff like this. Often for firewall appliances (eg SCC Sidewinder, Immunix Linux, genua w/ OpenBSD). They usually do one of these: (a) get big under new management that doesnt care about either security or the little people (enterprise focus); (b) sell out to company like that; (c) go bankrupt cuz market values assurance of security the least.

Sad but true. There's still a few companies selling microkernel-based solutions in defense and mobile with Linux user-lands. They'd OEM license their stacks for a new set of products aimed to do this. They cost a fortune. Whoever pays it wont get it back, though, cuz folks dont usually pay for security in that volume. So, nobody is doing it for small players for now.

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#33
> The motivation is that @stapelberg spends way more time on C software and their various issues than he would like. Hence, he is going Go-only where feasible.

This is so cool! I’m very happy to learn an effort like this exists, and looking forward to perusing the code for it... in Go (a language I really enjoy reading).

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#34
post #19
post #17

Earlier quoted context omitted.

Are there not many statically typed, compiled languages that ship a runtime with a garbage collector? Why is Go a good choice here? Why is this choice better than a language that provides memory safety using linear types so you don't even need a runtime or garbage collector?

You can read more about why I like Go at https://michael.stapelberg.de/posts/2017-08-19-golang_favori... . Of course I used my favorite programming language for building gokrazy :).

I've only dipped into Go recently (and not for any production code) but your article very nicely summarises my impressions with it so far. I've found a kind of fluid pleasure in writing Go that wouldn't be apparent from a bullet list of its (lack of) features. It really allows my attention to fall mainly on the problem domain in a way few other languages afford.

I can't resist while here thanking you for i3. I've been a mac user recently, but will likely be back to linux in the next year or so. Using i3 again will be probably be the greatest pleasure involved in that return ;)

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#35
post #26

Earlier quoted context omitted.

ResinOS does all that and more. It's container-based. Works super-well on a Pi3.

Oh, this is awesome. Can't wait to try it. Thank you!

Linuxkit is another option, slightly different approach.

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#36

It is really interesting that Gokrazy uses an upstream kernel (with a couple of minor patches). https://github.com/gokrazy/kernel/blob/3ecdc901da51c2c5b6bf7...

Why is that interesting? Just that they're not having to carry special patches for the RPi3 or what?

Yes. I have only tried Raspbian and I'm not used to getting RPi kernels from kernel.org

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#37
post #9

Earlier quoted context omitted.

So it’s like it’s own OS almost? What’s a userland?

It's everything the kernel doesn't do. In general, that means the surface with which you interact as a user. So if you're used to using a terminal, your SSH connection, your Bash session, are all userland programs (that use kernel features to do things). You can think of it as kernel is a framework like Rails and userland stuff is developers using and expending the interfaces... sort of. When your computer runs headl…

So it's a distribution ?

... that will have security issues, require updates, distribution maintenance, and all that stuff they claim is unacceptable ?

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#38
post #14

Earlier quoted context omitted.

Go is memory-safe. See also https://en.wikipedia.org/wiki/Memory_safety

Go is not memory safe (though is certainly safer than C++). Various Go constructs like interfaces and slices are implemented via non-atomic multiword structs, and data races may result in invalid values leading to memory corruption, etc. See https://blog.stalkr.net/2015/04/golang-data-races-to-break-m...

Is there any language not safer than C++?

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#39

Earlier quoted context omitted.

Go is not memory safe (though is certainly safer than C++). Various Go constructs like interfaces and slices are implemented via non-atomic multiword structs, and data races may result in invalid values leading to memory corruption, etc. See https://blog.stalkr.net/2015/04/golang-data-races-to-break-m...

Is there any language not safer than C++?

Many. I like bashing C++ as much as the next dev, but modern C++ has nice type checks, interesting types/wrappers which help with common patterns (shared, unique ptrs, etc), and the compilers learned some great tricks which allow you to run memory safety checks yourself. (Asan and others)

Also multithreading gets some improvements which will take more of the manual sync details away from the business logic. (http://www.modernescpp.com/index.php/multithreading-in-c-17-...)

It's still delivered attached to a foot-gun, but you could do worse.

Re: Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances

#40
Super nice. Glad to see A/B partiton updating scheme, that is the way to go on appliance / embedded device.

Want something like this for one of the languages that I know... Node.js, Python or Rust. I'd include C++11, though for this kind of deployment method I think one needs packages easily available in a way separate from Linux distro (since there is none).

Post reply on HN