Haiku (the operating system)

2024-02-18

I have a bunch of things I try and give up, but I realized, finally, I have no time for big stuff.

So instead, I started to toy around and, as time fitting, learn to build and start writing code in or with Haiku. It's not a "daily driver". That goes to Debian GNU/Linux with KDE. Instead, it's a fun diversion instead.

What is particularly interesting for me is that it represents what I think was a panacea for personal computing; after the 90s, it's been incremental as well as market driven (for example, smartphones.) The only meaningful options I specifically have for computers that cost little is Linuxes - which are certainly not a paragon of desktop utility, even if I think KDE is very good. They don't come together well. I am not nostalgic for that past. I can and will, when possible, to use "simpler" programs to work with my primary medium: text. In reality, Haiku gets close to it: it's simple enough and it handles text and some good-enough UI and multimedia handling while exposing useful tools in the process. If I want something else, I'll use that. But Haiku is like 80% there (or 90% there.) Haiku is the only alternative OS that is close enough to do most stuff that at least I do.

What is Haiku?

For the audience that manages to visit my blog and doesn't know what Haiku is (which is probably all visitors), here is a background. In the 90s, a company called Be Inc. tried to build a competing OS against Mac and Windows and probably also target large workstation vendors, with a media-focused operating system that also solves all the problems in consumer OSs. They were in the same league as Amiga. The one point where BeOS could have been something was when Apple considered it for the next Mac OS, but they decided to go with NeXTStep instead (so MacOS today is just a very different NeXTstep, really.) Be eventually folded, and the OS itself was lost behind the proprietary firewall. However, some folks from that time rewrote the OS, first called OpenBeOS and then changed to Haiku, which came from the fact that error messages in the built-in web browser in BeOS used haikus for error messages.

I remember BeOS talked about a lot when I was a teenager and thought it could have been it. As such though, I don't have nostalgia for this OS, but at the least, there is some glimmer of the old Mac OS in it. Be employed ex-Apple engineers at the time and it was founded by a former executive at Apple.

Haiku has been in beta for around 20 years. It's not a surprise - there is no mortal battle anymore for the soul of the people on what OS they should use. But, I really think it got far.

Haiku's differentiator, even though it might not be a differentiator in the wider market, is:

  1. Simple and fast installation,
  2. Super fast boot times that are relatively uncomplicated,
  3. The BSD equivalent in terms of development: kernel to UI to applications, it's developed together. (Even OS services use Be libaries.)
  4. I wanted to do OS level things and something like this is encouraging. It's not the mishmash of packages in Linux distributions.
  5. "Building the kernel" for Haiku and doing light configuration of it is actually simple. I cross-built the x64 and RISC-V versions of it already on my Linux box and built it also on dedicated hardware. On my slow-ish hardware, it took 80 minutes to build, but on my home server/build server, it took 30 minutes for a full installation build (jam -q -j2 @nightly-raw ... it also downloads pre-built HPKG packages.)
  6. This is going to finally force me to learn more C++.

(This is one run, running time on the jam command above:

real    17m15.787s
user    30m12.050s
sys     3m4.305s

)

However, development is slow, because it is a volunteer project, so if something doesn't work ... well, it's something to start learning to then fix. :) For me, in particular:

  1. Sleep states are not supported (or just having it load up all windows as they were would be good enough actually),
  2. It's not an OS feature, but Firefox hasn't been ported to it. Currently, Falkon is a decent browser, if a little crashy. (For non e-commerce transactions, it's actually fine.)
  3. There is a few bugs that I will want to eventually contribute to, but in due-time.

I am writing this on my T430s with a fresh SSD running on a Haiku nightly.

System Info

I installed Emacs with Emacs Prelude. It mostly works except for some tiny issues (had to make a minor modification to the installer script.)

More on software

Haiku is POSIX-compliant (though it is not a UNIX!) The UI is single-user and you are effectively using the root account. However, there are a few directories that you can't touch; they are managed by the OS. This is particularly true with the package directories. These are managed by package_daemon. Since it is POSIX-compliant, it supports all the normal software you would expect on a UNIX: shells, libc, etc. Haiku has to be multi-user to be POSIX-compliant. The question on security is open, but multi-user != secure by default!

Haiku also translates X and Wayland calls to Haiku app_server calls. As a result, porting a lot of software is possible. A lot of KDE applications, for example, are present.

There are a few OS-specific programs that I started to use with noting:

(A little tidbit: You can install onto another drive your whole drive using Installer. It's really handy actually.)

But, it also supports, because of the good POSIX and Qt support (this is just a random list):

Since it lacks a mainstream browser, I don't know if web development on this is possible, but I look out for that.

QEMU

This is my configuration from my "build server" (i.e. my fast-ish desktop computer that I use as a home server):

/usr/bin/kvm
    -monitor stdio \
    -smp 4 \
    --enable-kvm -machine accel=kvm \
    -m 4096 \
    -hda /home/bolsen/haiku_src/haiku/generated.x86_64/haiku-$1.image \
    -boot once=dc,menu=off \
    -net nic \
    -net user -device virtio-net \
    -rtc base=localtime \
    -name "Haiku" \
    -device intel-hda -device hda-duplex -display vnc=:11 -serial /dev/stdout

This turns off USB devices so there is only one PS/2 mouse (I did this for testing). It uses QEMU's VNC server. Using locally,

/usr/bin/kvm
    -monitor stdio \
    -smp 4 \
    --enable-kvm -machine accel=kvm \
    -m 4096 \
    -hda /home/bolsen/haiku_src/haiku/generated.x86_64/haiku-$1.image \
    -boot once=dc,menu=off \
    -net nic \
    -net user -device virtio-net \
    -rtc base=localtime \
    -name "Haiku" \
    -device intel-hda -device hda-duplex \
    --usb -device usb-tablet

The last option makes it more user-friendly when using it with the host OS (mixing it with KDE in my case.)

The only problem is that when the system goes to sleep, QEMU doesn't know about it and Haiku will not sync the clock on wakeup. This is something to look into.

In succeeding blog posts, I will solve smallish problems around this and possibly loading a tiny Debian installation to do some Linux-stuff in Haiku.

What's next

As I said in the beginning: I have a bunch of things I try and give up, but I realized, finally, I have no time for big stuff.

Right now, this is the first test of me trying to deploy my blog with this post using the whole toolchain of emacs, my tool, python, ssh, etc. If you are seeing this specifically, it worked.

I have two ideas for programs: a native UI that implements writing and publishing with my static site generator here and maybe implement my game idea in it. I also thought of porting some software.

For now, I am just reading and trying to fix a couple of bugs I found as a way to learn how to build and debug the OS.

Ideally, if one or another thing is solved, I wouldn't mind this being a daily driver and leave Linuxes on servers and extra laptops. But that is probably a bit distant.

In: programming