r/plan9 • • 19d ago

9Linux - a small Linux distribution built the way Plan 9

9Linux is a small Linux distribution built the way Plan 9 is: one /bin, plain text configuration, static programs, a Plan 9 file tree, and 9P for system services.

There is no libc, no init system, no initramfs, no kernel modules, no bootloader and no tmpfs. The firmware loads the kernel through its EFI stub, the kernel mounts the root file system and runs /bin/startup.sh, a shell script. The window system is rio.

Everything is written in POSIX sh, C99 and x86_64 assembly. The one exception is the 9LinuxFS kernel driver, a fork of ext4, which is kernel code and uses the kernel's GNU C.

Source: https://gitlab.com/9linux1/9Linux

Warning: Project is Under Development and Not daily drivable for now!!!! test it on QEMU or another Virtualization engine you trust.

first release
latest testing
60 Upvotes

25 comments sorted by

12

u/emonshr 19d ago edited 19d ago

I tried to read the wiki and found the filesystem concept which can ruin everything.
That says your very own filesystem is a "9LinuxFS, a fork of ext4 with one fixed feature set"

That's enough to make it a spaghetti project. Plan9 just orbits around the 9p protocol, if you can't keep it as it is you can't keep anything.

If you are trying to do that POSIX-compliant, then just don't do it anymore. You are not doing anything meaningful. Plan9 and unix architecture has light years of distance. Which is way more than linux and freebsd. That's why you can not do anything like chimera linux with plan9.

I am not an AI disbeliever. But every once in a while your markdowns with prompt just sparking doubt and unfair feeling that you are wasting people's time. Just try to understand, what are you trying to achieve.
AI or whatever you are using, engage yourself with the project. If you don't care about these, then it's not our league.

1

u/9Linux 18d ago

yeah I started to write the documents myself while learning english better so there can be minor spelling issues and ı'm rewriting documents right now not finished

1

u/9Linux 19d ago edited 19d ago

Also i will not remove posix standarts for now because wiping the posix standarts would not make it a linux distro anymore  you know

-1

u/9Linux 19d ago edited 19d ago

İ will not lie or protect my ego on this one youre right on the project being a Frankenstein Also I'm using ai to translate my markdowns thats why it looks so Artificial I'm learning english to write the documents myself also The project is very new right now, and I'm making radical decisions. My future goal is to completely revamp Linux with Plan 9. Right now, all of this is just the baseplate of the project 

Also thank you for letting me out from that echo chamber 

5

u/Achawaaa 19d ago

does it include my boi acme?

6

u/9Linux 19d ago

I'm porting it to 9Linux right now so yes it will

5

u/9Linux 19d ago

I added acme on the repo right now

2

u/Achawaaa 18d ago

nice, thank you!

4

u/emonshr 19d ago

Posix, C99 'without libc'? but is that without reinventing the libc logics all over again? Please in detail!

-2

u/9Linux 19d ago edited 19d ago

yeah, its currently like that if the project gets bigger I'll switch onto plan9's LibC probably but no libc is currently enough for the project

---edit----

also you can take a look at the wiki for projects one of the documentation for the structure because POSIX without LibC looks wrong at the first
https://gitlab.com/9linux1/9Linux/-/wikis/home

--edit2--

yeah nobody reads the wiki so I'll explain it myself:

SOURCE: 9Linux Wiki https://gitlab.com/9linux1/9Linux/-/wikis/Writing-Programs

Which library

You are writingUseHeader
A command-line tool or a system programthe runtime, src/rt#include "rt.h"
A program from Plan 9 or 9front, or in that stylelib9<u.h>, <libc.h>
A graphical program for riolibdraw on lib9<draw.h>, <event.h>
A file serverlib9p on the runtime"9p.h"

The runtime (src/rt)

One header, rt.h. It has the system calls under their Linux names (open, read, write, close, fork, execve, poll, mmap, socket, ...), strings, malloc, formatted printing, and some helpers:

print, fprint, snprint, smprintformatting; %r prints the last error
sysfatal(fmt, ...)print "prog: message: error" and exit 1
fatalx(fmt, ...)the same without the error
emalloc, erealloc, estrdupallocation that cannot fail
ARGBEGIN { case 'x': ... } ARGENDoption parsing, as in Plan 9
EARGF(usage())an option's argument
readfile, writeall, binit/bgetlinefiles and buffered input
dial(host, port), resolve(name, &ip)TCP and names
ndbget, ndbloadthe network database
recomp, reexecregular expressions
opendir/readdir/closedirdirectories
now(), civil()time

Read rt.h for the full list; it is the reference. A minimal program:

/* 9Linux hello: print a greeting */
/* SPDX-License-Identifier: MIT */

#include "rt.h"

int
main(int argc, char **argv)
{
char *who;

who = "world";
ARGBEGIN {
default:
fprint(2, "usage: hello [name]\n");
return 2;
} ARGEND
if (argc > 0)
who = argv[0];
print("hello, %s\n", who);
return 0;
}

lib9 (src/lib9)

The Plan 9 C library on top of the runtime: print with installable verbs, Rune and UTF-8 functions, Dir and dirread, rfork, exec, notes, Plan 9 regexp, plumbing, and Plan 9 meanings for open modes and sleep. Programs use void main(int argc, char **argv) and exits(nil) as on Plan 9.

Differences from Plan 9:

  • rfork(RFMEM) is refused. Use procmem(fn, arg) for a process that shares memory with its parent.
  • There is no thread library.
  • Names that clash with the runtime are renamed with macros (p9print and so on); this is invisible to programs.Which library You are writing Use Header A command-line tool or a system programthe runtime, src/rt#include "rt.h" A program from Plan 9 or 9front, or in that stylelib9<u.h>, <libc.h> A graphical program for riolibdraw on lib9<draw.h>, <event.h> A file serverlib9p on the runtime"9p.h" The runtime (src/rt) One header, rt.h. It has the system calls under their Linux names (open, read, write, close, fork, execve, poll, mmap, socket, ...), strings, malloc, formatted printing, and some helpers: print, fprint, snprint, smprintformatting; %r prints the last error sysfatal(fmt, ...)print "prog: message: error" and exit 1 fatalx(fmt, ...)the same without the error emalloc, erealloc, estrdupallocation that cannot fail ARGBEGIN { case 'x': ... } ARGENDoption parsing, as in Plan 9 EARGF(usage())an option's argument readfile, writeall, binit/bgetlinefiles and buffered input dial(host, port), resolve(name, &ip)TCP and names ndbget, ndbloadthe network database recomp, reexecregular expressions opendir/readdir/closedirdirectories now(), civil()time Read rt.h for the full list; it is the reference. A minimal program: /* 9Linux hello: print a greeting */ /* SPDX-License-Identifier: MIT */ #include "rt.h" int main(int argc, char **argv) { char *who; who = "world"; ARGBEGIN { default: fprint(2, "usage: hello [name]\n"); return 2; } ARGEND if (argc > 0) who = argv[0]; print("hello, %s\n", who); return 0; } lib9 (src/lib9) The Plan 9 C library on top of the runtime: print with installable verbs, Rune and UTF-8 functions, Dir and dirread, rfork, exec, notes, Plan 9 regexp, plumbing, and Plan 9 meanings for open modes and sleep. Programs use void main(int argc, char **argv) and exits(nil) as on Plan 9. Differences from Plan 9: rfork(RFMEM) is refused. Use procmem(fn, arg) for a process that shares memory with its parent. There is no thread library. Names that clash with the runtime are renamed with macros (p9print and so on); this is invisible to programs.

SOURCE: 9Linux Wiki https://gitlab.com/9linux1/9Linux/-/wikis/Writing-Programs

1

u/ElePHPant666 19d ago

Why do you need an ext4 fork. If ext4 isn't good enough why not use one of the other 7 acceptable filesystems in linux?

0

u/9Linux 19d ago

i dont diss or hate ext4 i just needed a dead simple rock solid base storage layer so i could focus entirely on the 9P namespace userspace stuff without fighting complex modern fs internals like btrfs it's just a pragmatic bootstrap bridge for the project nothing more

1

u/edo-lag 19d ago

You used AI, right?

5

u/9Linux 19d ago

only on wikis and some debuggings because my english is not really good and I'm using AI for translating, debugging also I'm a indie developer so AI helps me on debugging

2

u/edo-lag 19d ago

Then why do commits make so many changes with such vague messages?

2

u/9Linux 19d ago

I love doing commits in batch style instead of committing everything i do one by one
also I'm trying to lighten everything as i can
also you can see that I'm doing batch style via the time between my commits

3

u/Lizrd_demon 19d ago

Uhhhhhhhh... That's how I commit lol.

9

u/VisualHuckleberry542 19d ago

Yeah actually if I let my agent do my commits for me it breaks them down into relevant batches and comments beautifully. Me I'm just going to push 3 months of work in one commit called "added features”

6

u/VisualHuckleberry542 19d ago

3 months later, "more features"

3

u/edo-lag 19d ago

Agents break commits down if you instruct them to. One could just use agents for writing 30k lines of code and then just commit everything in one shot.

4

u/edo-lag 19d ago

It's wrong to do so, to the point that it makes no sense to use tools like Git. It's equivalent to copying code in another directory to make a new version. My advice is: learn to commit properly, you'll only benefit from it.

1

u/Lizrd_demon 19d ago

Yeah tarbells are better anyway. Good point.

2

u/edo-lag 19d ago

What? That was not the point.

3

u/Lizrd_demon 19d ago

I use git like a glorified undo button. I don't need to know how to do anything else and I don't care unless I get a job that requires it.

2

u/dr1zzzt 19d ago

This is pretty cool, looking forward to seeing how it progresses.