WLOG - blog something different

tags: ai arduino bass games godot i2c linux plan9 random web werc zig
Dare to be stupid
link | random | Sat Jan 27 10:14:32 CET 2024 No.30

The process of learning hurts. Physically! Just like working out. Anyone who says otherwise is lying! Just remember your math (or history) days in high school.

And just like working out, the experience gets easier with practice and even pleasurable with motivation. That lesson you have to figure out for yourself.

The path is one of feeling embarrassed. As in, I am embarrassed at how long it took me to run a process as another user under plan9. Let me explain.

I experimented with ramfs (to try and save on SD card life and maybe speed up some things) and everything that comes along with it (namespaces, permissions, sharing data between processes, …). Sensor data in “gizmos” is collected by the system owner, but the web server is run as an unprivileged user none. I could not read data from the web server. So, as necessity is the mother of invention, I managed to run the web server as a normal user set up for all things web. A year to figure how to do this since first failed attempts in the beginning and leaving everything on default. Probably because of an input error in the terminal. Now, with the developed rc history the iteration was less painful and produced success.

This allowed testing and setting up a new chain of scripts that read, save and process data in a shared memory. The result was about a half-second faster graph generation on the “gizmos” pages, since data was read from RAM instead of an SD card. For about 10 KB worth of text, not bad.

BUT, as I have found, that would increase the whole generation time by about five seconds, since now, the process had to be spawned as another user with a full namespace.

Back to beginning to figure out the proper way to define workspaces and not just quick fixing it by needlessly running an exposed process with a privileged user. It turns out, once you have a proper syntax-free command, the plan9 system is brilliant about these things. Once you know how to run commands in the same way or in the same configured environment as the system does for you, debugging is a cinch.

Of course, as with all interesting things, why would there be an example?! Yes, you can read the documentation, but all theory is slow to practical progress. Sometimes you just need to see the order of parameters for things to click.

So, for anyone finding this, an example of spawning a process with an unprivileged user with a specific namespace where you can then run and debug with printouts:

auth/as -d -n /bin/service/tcp80.namespace none #command or without for rc