SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What makes an init hard is getting things in the proper order.
With a shell script it is easy - the order is specified by the order of commands in the script.
nice bait with systemd crap
i'm talking about a proper init, not one that thinks mounting a partition is a service
(in other words, not one that started as My First Init then went crazy)
order of starting things needs to be determined anyway
you need to mount /lib to load modules
you need to load the graphics modules (driver, drm etc.) to start Plymouth
you need to... actually there is not great many things that need you to explicitly take care of (maybe there was a few 10 years ago)
all those are common sense
it is people that make things complicated, and this is not complicated
can you tell me what "service" depends on ssh or apache ?
(yes i know they depend on the network; while we'r at it i looked at dhcp protocol couple days ago, its very simple)
PS shell is a programming language, one that can be made parallel
(shell can even be compiled, idk why gcc and clang people didnt make a parser already)
C is not far and can easily be made parallel (actually easier with fork+exec as you can wait4() multiple children at a time)
Distribution: slack 7.1 till latest and -current, LFS
Posts: 368
Rep:
Quote:
Originally Posted by jpollard
What makes an init hard is getting things in the proper order.
With a shell script it is easy - the order is specified by the order of commands in the script.
With systemd, it is next to impossible. Systemd uses a random scheduling order, with a multi-level dependency network that has to be analyzed by systemd. If you miss some obscure dependency, the system may hang, or that particular service may not work (before, after, requires, ...).
The reason systemd has so much trouble is that it has to assume the service is ready when it starts it. This is NOT true. Before the service is ready it has to process its configuration file(s). In all other init systems (sysVinit, BSD, and slackware) the completion of this phase is when the service forks/becomes a daemon process, and the parent process exits. Systemd doesn't have that. To provide the equivalent each service must be modified to send systemd a message. In the case of networks, it becomes a two level thing - Systemd has to have NetworkManager send a message... but NetworkManager can't always know if the network is up either - specifically, in the case of DHCP. This can take up to around 30 seconds (depending on the dhcp server). Yet, NetworkManager has to assume it is ready when dhclient is started... Thus the message back to systemd indicating the network is ready is wrong.
This incorrect assumption allows other processes that may need the network to run... and fail.
The rest of the problem is assuming that one service can analyze all the dependencies. Here you get multiple dependencies - between services like apache, database servers, the network... To get those right requires each service to be modified to send back notifications to systemd...
And that makes the service incompatible with any other init because systemd just doesn't work well with other init systems, and is nonportable.
And worse, the developers don't care.
They do certainly care.
the network not functioning properly was a big problem.
systemd will/has developped hardware deamons.
systemd-networkd.
there is also a patch (.service file) for NetworkManager that basically tells if the network is running.
i'm talking about a proper init, not one that thinks mounting a partition is a service
(in other words, not one that started as My First Init then went crazy)
So you aren't talking about systemd...
Quote:
order of starting things needs to be determined anyway
you need to mount /lib to load modules
you need root mounted first...
Quote:
you need to load the graphics modules (driver, drm etc.) to start Plymouth
you need to... actually there is not great many things that need you to explicitly take care of (maybe there was a few 10 years ago)
all those are common sense
it is people that make things complicated, and this is not complicated
True that.
The initrd I had investigated (fairly deeply) used the command line "root=" to mount root on /mnt. Then it scanned the fstab on /mnt/etc for required filesystems like /var, /usr, /var/log... and mounted them. Once these mounts completed it would do the piviot_root and start the systems init from /sbin.
If one of these required mounts fails it would start a shell so that the admin could fix things (usually a typo in the fstab, or to do fsck runs).
Quote:
can you tell me what "service" depends on ssh or apache ?
(yes i know they depend on the network; while we'r at it i looked at dhcp protocol couple days ago, its very simple)
Well, one I ran across was monitoring software - it required apache to be running before it checked or it would report a system failure, even though that would be a "false alarm". And the monitoring checked as soon as it started. In the SysVinit it was a S99... which worked.
A more likely scenario is a database... and potentially clients of that database that provide services that are referenced by apache. I know this is usually just a CGI, but sometimes things get complicated, and it is considered better to separate that CGI from apache (it may require some data access barred to apache).
Yup - dhcp is simple, and works quite well. But it must wait for external service which is tricky for systemd to properly handle.
I know that... Unfortunately, that is exactly the process systemd is not useful for. Remember, systemd is also a process monitoring service, and can restart services if they fail. It is ALSO required to be monitored if a dependency is declared by a "requires" entry for a dependent service.
So what happens is that the service is "started"...the dependant service start - but because "required" service has exited, the dependent service can also be terminated... falsely. Alternatively (if systemd assumes the service is properly running), the service in question may exit for some other reason... and now the dependent service fails because the other service isn't running (a cascading failure).
Quote:
PS shell is a programming language, one that can be made parallel
(shell can even be compiled, idk why gcc and clang people didnt make a parser already)
C is not far and can easily be made parallel (actually easier with fork+exec as you can wait4() multiple children at a time)
That WOULD be my preferred method. Even most shells implement a wait using a wait4 now.
Personally, systemd is just a disaster waiting to happen, but the developers keep adding stuff to it: dbus, udev, journald,... if any of those abort, the system has a tendency to also crash. previously it was just a problem with the subsystem (and if syslog failed, the messages were still sent to the console).
Slackware already has Runit in the SlackBuilds and it can be used as an alternative Init, but my work with it was limited, but I can say it does work if proper scripts for it are made.
Perhaps eventually if and when a new init is needed Patrick can pull in Runit and look into it's inclusion.
Eudev from Gentoo and LFS can be easily imported if Patrick ever needs to update udev to a newer version that's sane to use.
Don't worry, he only calls systemd utility to clean temporary files which can be trivially rewriten with File class.
He also starts udevd which is already bound to systemd in Arch Linux, however again it can be trivially rewriten to call either Slackware's init script /etc/rc.d/rc.udev or by invoking /sbin/udevadm directly.
That's all. So in fact it does not need systemd at all.
Last edited by dunric; 05-15-2014 at 10:48 PM.
Reason: typo
Out of curiosity (and because I wasn't in a mood of making anything useful at that time) just yesterday I made a package for Slackware-14.0 of eudev-1.6 [...] Still just out of curiosity I 'll have a closer look to the differences with udev-182 in the coming days, as at least that could help Gentoo developers in case they didn't receive reports from someone trying it with Slackware's init system yet.
Correct me if I am wrong, but I got interested in the subject and did some reading up on systemd, and if I am not mistaken the fundamental driving force in their architecture is improved VPS performance. They want a linux optimized to run as a virtual machine, and to start and stop very quickly on demand in that environment, right?
The design makes a lot more sense in that context. You can be pretty certain that the DHCP response is coming within a certain number of seconds and just assume success and that will normally work. And saving a couple seconds on boot time would actually be worth some effort, if you are talking about booting thousands of virtual servers every hour it actually starts to add up.
If I understand correctly this is why they are building this entire layer of stuff around systemd instead of using something compatible like OpenRC - squeezing that last second out of your boot time is an incredible waste of time for a traditional user, but again makes sense if you are talking about booting VMs thousands of times an hour.
Can you be a more specific ?
In the code there is nowhere else used any part od systemd than I've described. The script is just a simplified example not 100% emulation of systemd init. It only monitors termination of processes at shutdown and responds to SIGCHLD signal.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.