Goa - sticking together a little Unix (part 1)
Whereas the first article about Goa was concerned with building software using commodity build systems, this article takes you on a ride of creating a small Unix OS out of Genode's ready-to-use building blocks, publishing the result, and deploying it on top of Sculpt OS.
In the Goa introduction linked above, I already hinted at Goa's functionality beyond the porting and building of software. This article shows the fun and productive way of crafting component compositions out of Genode's readily available building blocks. What could be a better example than building an old-school operating system - Unix - that we all know and love? You can find the results of this tutorial in Norman's Goa-projects repository.
Preparations
Before continuing, please make sure to have installed the Goa tool, which is available at https://codeberg.org/genodelabs/goa. If you have it installed already, please make sure the tool is up to date. You can issue the following command to update Goa to the latest version:
$ goa update-goa 26.10
Hello bash
As the first step, we want to get a life sign of the bash shell. We start with a new Goa project appropriately named unix that hosts a runtime package but no source code.
$ mkdir -p unix/pkg $ cd unix
Let's pretend we don't know what we are doing and create an archives file with only bash listed, and an almost empty runtime file. The runtime starts the binary init, which is supposed to be a ROM module. Please have a look at goa help runtime for more details on how to write runtime files.
The pkg/archives file:
genodelabs/src/bash
The pkg/runtime file:
runtime | ram: 100M | caps: 5000 | binary: init + content + rom init -
Let's see what happens when issuing the run command:
unix$ goa run download genodelabs/bin/x86_64/bash/2026-11-14.tar.xz download genodelabs/bin/x86_64/bash/2026-11-14.tar.xz.sig download genodelabs/src/bash/2026-11-14.tar.xz download genodelabs/src/bash/2026-11-14.tar.xz.sig download genodelabs/api/libc/2026-11-14.tar.xz download genodelabs/api/libc/2026-11-14.tar.xz.sig download genodelabs/api/noux/2026-09-28.tar.xz download genodelabs/api/noux/2026-09-28.tar.xz.sig download genodelabs/api/posix/2020-05-17.tar.xz download genodelabs/api/posix/2020-05-17.tar.xz.sig [unix] Error: runtime lacks a configuration You may declare a 'config' attribute for the 'runtime' node, or define a 'config' node inside the 'runtime' node.
Let's follow the advice by adding an empty config node to our pkg/runtime file:
runtime | ram: 100M | caps: 5000 | binary: init + config + content + rom init -
Besides the error message, you could see that Goa automatically downloaded bash along with its dependencies such as the libc. Besides the binaries, it also fetches all source codes. You can find all the downloads at var/depot/. One particularly interesting directory is the binary archive for bash:
unix$ ls var/depot/genodelabs/bin/x86_64/bash/2026-11-14/bash.tar bash.tar
It contains a single tar archive, which in turn, contains all installation files of bash. Let's take a look inside:
unix$ tar tf var/depot/genodelabs/bin/x86_64/bash/2026-11-14/bash.tar ./ ./bin/bash ./bin/bashbug ... ./share ./share/doc ...
Of course, the most interesting bit is the bash executable at bin/bash. When using the binary archive, the whole bash.tar is supplemented to Genode as a single ROM module. Let's add it to the content of the pkg/runtime:
runtime | ram: 100M | caps: 5000 | binary: init + config + content + rom init + rom bash.tar -
After issuing goa run again, Goa downloads the additional packages needed to run our pkg/runtime on Linux, integrates the scenario, and starts it.
unix$ goa run download genodelabs/bin/x86_64/base-linux/2026-11-14.tar.xz download genodelabs/bin/x86_64/base-linux/2026-11-14.tar.xz.sig download genodelabs/bin/x86_64/init/2026-11-14.tar.xz download genodelabs/bin/x86_64/init/2026-11-14.tar.xz.sig download genodelabs/src/base-linux/2026-11-14.tar.xz download genodelabs/src/base-linux/2026-11-14.tar.xz.sig download genodelabs/src/init/2026-11-14.tar.xz download genodelabs/src/init/2026-11-14.tar.xz.sig download genodelabs/api/base/2026-10-22.tar.xz download genodelabs/api/base/2026-10-22.tar.xz.sig download genodelabs/api/os/2026-11-14.tar.xz download genodelabs/api/os/2026-11-14.tar.xz.sig download genodelabs/api/report_session/2024-08-28.tar.xz download genodelabs/api/report_session/2024-08-28.tar.xz.sig download genodelabs/api/sandbox/2025-12-11.tar.xz download genodelabs/api/sandbox/2025-12-11.tar.xz.sig download genodelabs/api/timer_session/2026-08-24.tar.xz download genodelabs/api/timer_session/2026-08-24.tar.xz.sig Genode sculpt-26.10-55-ge9c42e8bbe5 17592186044415 MiB RAM and 19000 caps assigned to init
You can find bash.tar added to the var/run/ directory, which comprises all the ROM modules of our Genode system.
Of course, we cannot start a TAR archive. It is not an executable after all. We rather need to access the content of the archive. Here, the combination of three Genode components namely VFS, fs_rom, and init come to the rescue.
-
The VFS server is able to mount a TAR archive locally as a virtual file system and offer its content as a file-system service.
-
The fs_rom component provides a ROM service by fetching the content of ROM modules from a file system. By connecting the fs_rom with the VFS component, the files of the bash.tar archives become available as ROM modules. With the bash executable binary accessible, we can execute it.
-
The init component allows us to stick components together and let the result appear to the surrounding system as a single component. We can use it to host the composition of the VFS, fs_rom, and bash.
Note that our pkg/runtime refers to Genode's init component in the attribute binary: init. So as a whole, our subsystem will be an instance of init. Internally, init will host several child components and manage their resources and relationships according to its configuration. Let's start with a fresh init that hosts only the VFS server by replacing our empty config in our pkg/runtime file by the following configuration.
+ config
+ parent-provides
+ service ROM
+ service LOG
+ service RM
+ service CPU
+ service PD
+ service Timer
+ start vfs | caps: 100 | ram: 10M
+ provides
| + service File_system
+ config
| + vfs
| + tar bash.tar
| + default-policy | root: /
+ route
+ any-service
+ parent
The default-policy expresses that any client should be able to access the root of the virtual file system in a read-only fashion.
When trying to run the scenario now, you see a bunch of messages:
unix$ goa run
[unix] config 'parent-provides' mentions a timer service;
consider adding 'timer' as a required runtime service
Genode 26.02-309-g6ae975a32c8
17592186044415 MiB RAM and 19000 caps assigned to init
[init -> unix] Error: vfs: environment ROM session denied (label="vfs", ...)
The first message points out that init's parent-provides declaration refers to a service that should better also be announced as a requirement in the runtime file. This can be done by adding the following requires node inside the runtime node.
runtime ... + requires + timer ... -
The subsequent "Error:" messages tell us that init requested the ROM module vfs that is not available to the scenario, yet. To make this ingredient available to our scenario, we have to declare it in the archives and as content in the runtime file. While we are at it, let's also capture the need for init because our entire scenario is based on this component. Let's add the following lines to pkg/archives:
genodelabs/src/vfs genodelabs/src/init
Also make sure to have the ROM modules listed as content in the pkg/runtime so that it looks as follows:
+ content + rom init + rom bash.tar + rom vfs
When issuing goa run again, we can see Goa downloading the additional components. On the attempt to start the scenario, we are confronted with another error message:
[init -> unix -> vfs] Error: stop because parent denied ROM-session:
label="vfs.lib.so", , ram_quota=10K, cap_quota=3
This message tells us that the VFS server requests another ROM module, which is a shared library. The vfs.lib.so contains the actual implementation of the virtual file system. It comes in the form of a library to enable its use either locally by an individual application or via the VFS server. The library is part of the genodelabs/src/vfs archive that is already listed in our pkg/archives file. So we can resolve this error by adding a corresponding rom entry to the pkg/runtime file. The content should now look as follows:
+ content + rom init + rom bash.tar + rom vfs + rom vfs.lib.so
When running the scenario again, we see a sign of hope:
unix$ goa run Genode 26.02-309-g6ae975a32c8 17592186044415 MiB RAM and 19000 caps assigned to init
No further errors! That means that the VFS server is running and has presumably mounted the bash.tar archive. On a second terminal, you can indeed observe the VFS server showing up.
$ ps u ... [Genode] init ... [Genode] init -> timer ... [Genode] init -> unix ... [Genode] init -> unix -> vfs
The second piece of the puzzle is the fs_rom server, which can be added to the config node of pkg/runtime with the following snippet. Watch the indentation. Make sure that both start nodes line up.
+ start vfs_rom | caps: 100 | ram: 10M
+ binary fs_rom
+ provides | + service ROM
+ config
+ route
+ service File_system | + child vfs
+ any-service | + parent
By using the binary node, we can label the component in a meaningful way, calling it "vfs_rom". The first entry of the route node defines that the request for a file-system session should be routed to the "vfs" component.
On the next attempt to issue goa run, we face an error message:
[init -> unix] Error: vfs_rom: environment ROM session denied (...)
The executable binary fs_rom is not yet an official part of our scenario. By now, I'm sure you know how to resolve this one. Corresponding entries to your pkg/archives file and the pkg/runtime file's content are added swiftly. The fs_rom component gives us no life sign, which is normal. If you want to get a little bit more action on screen, you may add the verbose: yes attribute to init's config node. Another try of goa run reveals the following output.
unix$ goa run Genode 26.02-309-g6ae975a32c8 17592186044415 MiB RAM and 19000 caps assigned to init [init -> unix] parent provides [init -> unix] service "ROM" [init -> unix] service "LOG" [init -> unix] service "RM" [init -> unix] service "CPU" [init -> unix] service "PD" [init -> unix] service "Timer" [init -> unix] child "vfs" [init -> unix] RAM quota: 9992K [init -> unix] cap quota: 66 [init -> unix] ELF binary: vfs [init -> unix] priority: 0 [init -> unix] provides service File_system [init -> unix] child "vfs_rom" [init -> unix] RAM quota: 9992K [init -> unix] cap quota: 66 [init -> unix] ELF binary: fs_rom [init -> unix] priority: 0 [init -> unix] provides service ROM [init -> unix] child "vfs" announces service "File_system" [init -> unix] child "vfs_rom" announces service "ROM"
That looks promising. Now with the bash executable available as ROM module, let's give the bash shell a spin:
+ start /bin/bash | caps: 1000 | ram: 10M
+ config
| + libc | stdin: /dev/null
| | stdout: /dev/log
| | stderr: /dev/log
| | rtc: /dev/null
| + vfs
| + dir dev
| + device | + null
| + device | + log
| + arg | : bash
| + arg | : -c
| + arg | : echo files at /dev: /dev/*
+ route
+ service ROM | label_last: /bin/bash | + child vfs_rom
+ any-service | + parent
The following parts are worth highlighting:
-
The bash has its own VFS! This has nothing to do with the VFS server we started above. In fact, bash's VFS - as configured by the vfs node - merely contains the two pseudo files /dev/null and /dev/log. The latter one is a LOG connection that enables the bash to write messages to the outside world.
-
The libc node contains the configuration of the C runtime used by bash. Here we say how the standard output should go, or that the C runtime should obtain its "real-time-clock" information from /dev/null. No time for you this time!
-
Via the sequence of arg nodes, we execute the command
echo files at /dev: /dev/*
It uses the shell's file-globbing mechanism to obtain the list of files matching the pattern "/dev/*" and prints it via the echo built-in command.
-
The route rules explicitly tell init that the binary of the component should be obtained from the "vfs_rom" component.
When trying to goa run the scenario now, we have to add a few more entries to our pkg/archives and content, specifically because bash uses the C runtime (libc and libm) as well as the posix library. The full list of archives now looks as follows:
genodelabs/src/bash genodelabs/src/vfs genodelabs/src/init genodelabs/src/fs_rom genodelabs/src/libc genodelabs/src/posix
For reference, the rom modules listed in the pkg/runtime file's content node:
+ content + rom init + rom bash.tar + rom vfs + rom vfs.lib.so + rom fs_rom + rom libc.lib.so + rom libm.lib.so + rom posix.lib.so
Once these stumbling blocks are out of the way, goa run greets us with the following output:
... [init -> unix] child "vfs" announces service "File_system" [init -> unix] child "vfs_rom" announces service "ROM" [init -> unix -> /bin/bash] Warning: /dev/null not readable, returning 0 [init -> unix -> /bin/bash] files at /dev: /dev/log /dev/null [init -> unix] child "/bin/bash" exited with exit value 0
The message "files at /dev: /dev/log /dev/null" is the output of the bash command we have hoped for!
Granted, our scenario is still a far cry from being a Unix system. In the next episode, we will add an interactive terminal. Read on...
Edit (2021-03-02): updated to Genode 21.02
Edit (2023-05-02): updated to Sculpt OS 23.04
Edit (2023-11-15): updated to Sculpt OS 23.10
Edit (2026-11-17): updated to Sculpt OS 26.10


Norman Feske