You are not logged in.
Pages: 1
Interesting. Let me follow up on that.
First, thank you, blackhole and greenjeans, for your reply. I noticed that you did not answer the question: What is an admin or user supposed to do if a service fails due to a transient error? How do they know that?
@greenjeans: No, this is not "incongruous thinking". When I get the story right it was like that (feel free to correct me): Around 2000 Linux was the new kid on at the table. HP-UX, IBM AIX, SCO, Sun and yes, Microsoft too were the established names for the server room. You had to persuade your manager to bring Linux. But was still a freaky and nerdy thing made by a group of coder led by some Finish guy. How could that possibly work? But you got the permission. Then the day came where the mail, print, file or web server (or all together) failed. That was clear from the beginning, wasn't it? I mean, what quality can you expect from a bunch of non-professional coders? With good luck they were working for a university (iow: an egghead). Can you even imagine how bad such an admin feels? He then turns to SysV for assistance and what he gets back is like: "Well, you know, the philosophy is that services don't fail". Now Linux does offer great opportunities for everyone, so the admin might have answererd: "Thank you, but I will fork off."
Another question for you:
greenjeans most definitely breaks stuff to see what's possible, just not the important stuff
How do you make the decision what is it important? Or let me ask that otherwise: There was a time before SysV init-style. That was changed (broken?) for SysV. What made this change so extremely good that it seem to hit some optimum, which cannot be enhanced by further changes? Oh, please @blackhole: you might also have suggestion on that. Please let me know.
can't have stable things just working without breaking
Changing is not automatically breaking. There was I time when I asked myself: "How could I change SysV init into something with supervision with minimal (scriptable?) changes to the init scripts?" to have the best of both worlds. But that would things only on the surface.
Thank you, JCK, for mentioning other init-styles. It remembers that the init-space is totally fragmented. Changing / enhancing SysV would only increase that. I'm not suggesting anything like that and I'm really no longer care about init-styles. Instead I started to make my own pidN service controllers that could run with minimal impact below any init-system I find. (If I would have to choose, I think I would take runit: I like its concepts anbd ideas but not so much the implementation.) SysV, systemd, /sbin/init? I doesn't matter. It's pretty easy to configure a single service to whatever the system runs and from that I'm on my own. And in addition to the small footprint, I do not depend on others, their implementation or whatever.
But back to the question above, I would be really interested in how you (all) decide what to consinder to change or update and what not. Because there the difference between bloat and not-bloat starts.
And what's wrong in general with Linux these days.
I agree to that partly. What I think is wrong with Linux is that every program has to have address all (!) possible use cases. Even if they are only useful in years where Easter Monday is on Thursday.
Puh, there's so much to say to this that I do not know where to start.
Stability, simplicity,code correctness, robustness and reliability are worth pursuing.
SysV init is a lot but robust and reliable? No, sorry. It works if rc-scripts play according to the rules of SysV. If they fail (of cause, they are simply not allowed to fail, right?
) the service does not work - bad and no other init system solves that - but the user or admin is the last who learns that because there's no service supervision. The service might also start and fail later for any reason and again, no one takes notice. The logs will not even show an error code.
Service supervision is "real world" crap which enterprise demands. There's a reason why BSD projects don't include it in the base system - the philosophy was always "write your programs correctly, so that they don't crash".
Service supervision is just a modern requirement. I mean, come on, should the system really not try to fix a terminated service by restarting it? Should always an admin be there? What are normal users supposed to do? I also guess there's a reason why BSD is not the chosen Unix for the majority of servers or desktops. And sorry, but from here the mentioned philosophy sound so much like "Trust me bro, I'm a programmer and know what I do". No way.
The harsh reality is that if you're just a desktop user, and not a server admin, you may see no benefits from something like runit, where the main focus is service supervision ...
I fully agree to this. But the other half of that "harsh reality" is that SysV init is something for hobbyist.
Is SysV stable? Yes - which is part of the problem. It's simple: times, expectations and requirements have change since SysV was invented or later introduced to Linux in the mid 90s. It was then a big step forward but it failed to meet evolveing expectations. There is a reason why there were / are so many alternatives to SysV exists. They were no invented for fun but for real reasons.
Simplicity? I don't know. But when you look into one of the init-scripts you see that all scripts source /lib/lsb/init-functions. Doesn't that "feel" wrong? Shouldn't this environment not be provided by some "master" process which runs all the time, very much like pid1 (with or without supervision)? For me, that's a clear sign of bad design. Not bad for the mid 90s but really not good enough for 201x or later.
A problem I remember was (is it still?) that if a service was not configured to automatically start ("START=no" in the defaults file), even root couldn't do this manually from the command line. Thanks to shell scripts that could be changed (check for a tty and ignore the START parameter). But when the runlevel was later changed SysV didn't care about the extra process and didn't stop that. No, it was stupidely processing the links in rc2.d, nmot caring about the actual system status. Not what I would call a super clever solution.
To sum it up: I can easily imagine better init systems than SysV and prefer to do my own stuff and ignore / bypass the system's init system as much as possible. But nowadays I'm also only a hobby hacker.
Btw.: if you use runit (I don't) you might want to take a look at nitro from voildlinux which is (as I understand it) a runit plus some enhancements: https://leahneukirchen.org/blog/archive … runit.html.
This should be no big surprise. In the end it's all Redhat stuff, isn't? I mean as far as I understand they "own" systemd, Gnome, Wayland (?), flatpak, util-linux ... 80% of the relevant Linux user space?
When you say are created with systemd in mind, can you give some examples?
I took a look at shed (version shed.v0.2.0-120-gd7af2d4) to see how you manage is processes are running. I guess I made something completely wrong due to my impatience or missing experience with gaming X sessions. Nevertheless, I got what I already suspected. shed was reporting that is was already running (line 142) when that was really not the case. It's because shed relies on pidfiles only. (If there is one single thing I should name that was giving me most issues with SysV init then it is the reliance on pidfiles in the "early"? init scripts.)
Instead you could use start-stop-daemon, and if that's not installed busybox start-stop-daemon (busybox is widely used in Linux installations because of its use in initrd) but (1) I have no idea about non-Linux UNIX systems and (2) I don't think that it would help in checking for the shed script.
Here is a suggestion for some "stuff"
that might work too.
#!/bin/sh
#
is_running() {
/usr/bin/awk '#
function getarg(name, p) {
if (argi >= ARGC) {
printf ("%s: missing arg: %s\n", program, name) >>"/dev/stderr";
exit (1);
}
p = ARGV[argi];
ARGV[argi++] = "";
return (p);
}
BEGIN {
program = "is-running";
argi = 1;
pidfile = getarg("pidfile");
pid = getarg("pid");
if (pidfile != "" && pidfile != ".") {
getline pid2 <pidfile;
close(pidfile);
if (pid == "" || pid == ".")
pid = pid2;
else if (pid != pid2)
exit (1);
}
fn = "/proc/" pid "/cmdline";
FS = "\0";
getline <fn;
close (fn);
for (i = 1; ARGV[argi] != ""; argi++) {
if (ARGV[argi] == "" || ARGV[argi] != $(i++))
exit (1);
}
exit (0);
}' "$@"
return $?
}
is_running "$@"
exit $?is_running is a draft of a shell function *relying on /proc* (again: don't know about non-Linux) accepting 3 or more parameters:
the name of the process' pidfile; this is optional
the process' pid; optional: if pidfile is given its value is compared against pid and they are expected to match; if missing the pidfile's content is used as pid
the process' executable (optional - if not set only pids would compared but that would not make much sense for this function)
addtional optional parameter would be compared against the process' command line parameters.
Arguments for process executable or parameter might be empty string to ignore the for comparison.
So, how could that been used in shed? Just guessing here, but testing for a running service should be
is_running $pidfile "" $EXECbut that does not work for interpreted scripts (bad). Adding `$E_ARGS` should help
is_running $pidfile "" $EXEC $E_ARGSbut the script's `$EXEC` must be the interpreter (i.e. no use of `#!` here).
Also
is_running $startfile "" /bin/sh shedshould check if shed is running. You can replace `/bin/sh` with `""` if you are unsure about the shell interpreter.
Yor are right, EDX-0, pico-init has become large (it's no longer "pico"). I see two major scenarios where it fits:
as pidN service controller/supervisor if the use case is strong enough (e.g. for a Rasperry Pi gadget device) or
as experimental or test kit for processes control: as soon as you know what you want and need you would copy&paste idea and/or code to your project.
Just yesterday I got an idea for a possible scenario 2
.
@EDX-0, I really like what you are doing here and I think we should have more of that (to have alternatives to choose from or copy&paste code or ideas). One of my projects is to work on a Raspberry Pi gadget where I combine system services into a "functional device". I don't give a pfff about writing systemd units for them but instead I use my own process supervisor for that. This too makes starting the relevant services pid1-agnostic. That is easier to handle (you do not have to understand the 300+ unit options) and it is easier to port to other pid1's (SysV, systemd, s6, runit/nitro, you-name-it).
Having said that, I must admit that I'm not going to use your controller because I have my own pony on the lawn: https://codeberg.org/awk-scripting/pico-init. It supervises the process but requires bash or busybox ash (or any other shell with `wait -n` which excludes dash) for that. I'm just going to add runlevels
to it which brings the script to approx. 1500 lines of code
(comments and empty line count extra).
Of course, "no one" needs another editor and this is also not what the apps do. E.g., the console notes app is a large GNU awk script that uses vi (or nano or your-editor) for editing. So, what is the script doing?
- Years ago I decided to put my notes where they belong - into the project directories. To keep the directories uncluttered, all notes go into the file Notes.md and they begin with a `###` markdown header. So the app's first function is to know the format and present the notes as directory.
- Displaying notes inserts ANSI sequences to color markdown markup and uses `less -XRF` for output.
- Then the app understands where to look when I enter `Lin:` (opens Linux.md from the "wiki" directory) or "micro:" (opens Notes.md from micro-boot directory).
- The app knows where to find all files when I run a search through all of my notes (`//systemd +boot`)
- Then the app can open links in a console (or GUI) browser, start a shell, open the editor or duplicate itself in a new xterm, tmux or screen window.
- It also knows how to open files on a gvfs directory.
So while it's true, that there are plenty of good text editors, there is so much more around organising and finding notes and this is what the apps really do.
Thank you for posting this. Your app gave me the final push to create an X-version for a note format I'm using for years now in Linux terminals. It's written in Java and I understand it's not for everyone but in case you are looking for additional inspiration, the documentation is here: https://codeberg.org/awk-scripting/Note … ntation.md
Hello EDX-0, I like your shell approach and the idea of being agnostic of window system. init-system or whatever is there. (I'm using a similar thing for my own stuff on Raspberry Pi.) I have a small suggestion just in case there are distro maintainers with aversion of too much shell commands:
get_shed_cgroup_2() {
awk '
BEGIN {
pid = ARGV[1];
cmd = "ps ax -o pid,cgroup,cmd=CMD ";
while (cmd | getline > 0) {
if ($0 ~ /grep/ || $0 !~ /shed/)
continue;
else if ($1 != pid)
continue;
sub(/^.*::\//, "", $2);
print $2;
}
}' "$shed_pid"
}
shed_pid=$$
get_shed_cgroup
get_shed_cgroup_2Pages: 1