The road forward for systemd
There are many new features in systemd, but the core change is a concept stolen from the MacOS launchd daemon - and from others that came before launchd. There are (at least) two ways to ensure that a service is available when it is needed: (1) try to keep track of all other services which may need it and be sure to start things in the right order, or (2) just wait until somebody tries to connect to the service and start it on demand. Traditional Linux init systems - and upstart too - use the first approach. Systemd, instead, goes for the second. Rather than concern itself with dependencies, it simply creates the sockets that system daemons will use to communicate with their clients. When a connection request arrives on a specific socket, the associated daemon will be started.
This approach simplifies the system configuration process because there is no longer any need to worry about dependencies between services. It holds out the promise of a faster bootstrap process because nothing is started before it is actually needed (plus a fair amount of other work has been done to improve boot time). The systemd approach to managing daemons allows a fair amount of boilerplate code to be removed, at least under the difficult assumption that the daemon no longer needs to work with other initialization systems. Lennart clearly thinks that it is a better way to manage system processes, and a number of others seem to agree.
That said, there are some obstacles to the widespread adoption of systemd by distributors. To begin with, a number of them are just now beginning to use upstart in its native mode; the idea of jumping into another transition is not necessarily all that appealing. Daemons must be patched to work optimally with systemd; otherwise the socket-based activation scheme is not available. The patching is a relatively simple task, but it must be done with a number of daemons and the result accepted back upstream. There are also concerns about how well some types of services (CUPS was mentioned) will work under systemd, but Lennart seems to think there will not be troubles there.
Another area of concern, strangely enough, is the use of control groups (cgroups) by systemd. Cgroups are a Linux-specific feature initially created for use with containers; they allow the grouping of processes under the control of one or more modules which can restrict their behavior. Systemd uses cgroups to track daemon processes that it has created; they allow these processes to be monitored even if they use the familiar daemon tricks for detaching themselves from their parents. So if systemd is told to shut down Apache, it can do a thorough job of it - even to the point of cleaning up leftovers of rogue CGI scripts and such.
Cgroups would also make it easy for system administrators to set up specialized sandboxes for daemons to run in. The problem there is that there is no easy way for systemd to pick up a cgroup setup already created by somebody else; there is no transparent inheritance for cgroups now. So Lennart is asking for that type of inheritance to be added.
Beyond that, though, some people have concerns about the use of cgroups in the first place. Peter Zijlstra worries about adding yet another feature which must be built into the kernel for the system to even boot. The Debian community does not like the use of the "debug" group, which is not currently configured into its kernels. Systemd may eventually get a more appropriately-named cgroup subsystem for its use, but it is not going to work without the cgroup feature at all. So people wanting to boot systems with systemd will need to have cgroups built in. Lennart has this message for people who don't like that:
There are also claims that work on systemd is primarily motivated by antipathy toward Ubuntu and, especially, its copyright assignment policies. There can only be a bit of truth in some of that; hearing early talk about the work which became systemd is part of what inspired this article on assignment policies back in October. That said, Lennart insists that the motivations behind systemd are technical, and he asks that it be judged on its technical merits.
So where do things stand with regard to adoption of systemd?
- There is an
intent to package bug filed for Debian; the packager plans
to make it easy to switch between sysvinit and systemd at boot time.
- Lennart plans to have a systemd
package ready for Fedora 14, saying "
whether we can have it as default is to be seen
". Given that the Fedora 14 cycle has already begun, even thinking about adding a change that fundamental as the default seems ambitious. So it may be a hard sell, but Lennart would like to see it: "It would certainly be a shame though if other distros would ship systemd by default before we do.
" - Gentoo has an
experimental systemd package available, but it has not found its
way into the main distribution yet.
- openSUSE is apparently (according to Lennart's original
announcement) discussing it internally, but, as is often the
case with openSUSE, there is no public indication that it is being
considered.
- Ubuntu seems unlikely to consider a change anytime soon.
So it is not clear that any distribution will make the jump to systemd.
But, then, even the above is a fair amount of attention for a project which
has been public for less than one month. This program has reopened the
discussion on how our systems should initialize themselves, and things may
go on from there: there is talk of using systemd to take over the tasks of
processes like cron and gnome-session. Regardless of who
ends up running systemd, the ideas it expresses are likely to influence
development for some time.
Posted May 26, 2010 16:59 UTC (Wed)
by dhaval.giani (guest, #45724)
[Link]
Posted May 26, 2010 17:00 UTC (Wed)
by jch (guest, #51929)
[Link] (19 responses)
> Daemons must be patched to work optimally with systemd
Am I right in understanding that they don't actually /need/ to be patched, as long as they can be kept from forking? (In other words -- if it works with runit and upstart, it will work with systemd.)
--jch
Posted May 26, 2010 17:05 UTC (Wed)
by corbet (editor, #1)
[Link] (1 responses)
Posted May 26, 2010 17:37 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link]
Posted May 26, 2010 18:39 UTC (Wed)
by smurf (subscriber, #17840)
[Link] (7 responses)
Also, equating "a daemon has definitely bitten the dust" with "its cgroup is now empty" might actually work for a nonzero subset of them, though not all.
In summary, IMHO some of systemd's ideas actually make sense and might actually fit into upstart's model of the world. Just a SMOP. :-P
Posted May 26, 2010 23:58 UTC (Wed)
by Tobu (subscriber, #24111)
[Link] (5 responses)
> Also, equating "a daemon has definitely bitten the dust" with "its cgroup is now empty" might actually work for a nonzero subset of them, though not all.
Indeed. A getty service, screen, and systemd do not mix (nabbed from irc).
getty is started, user logs in and starts screen, detaches it. Now the cgroup isn't empty and getty won't respawn.
Respawning getty with a new cgroup without waiting for the cgroup to empty would work better. A service offering screen sessions with new cgroups would also work, requiring the user to explicitly use those.
Posted May 27, 2010 6:45 UTC (Thu)
by mezcalero (subscriber, #45103)
[Link] (4 responses)
not only every service, but also every user gets its own cgroup in the systemd model. if you monitor services via cgroups it doesnt mean you would stop monitoring it via the traditional sigchld stuff.
Posted May 27, 2010 11:04 UTC (Thu)
by liljencrantz (guest, #28458)
[Link] (2 responses)
* [x]inetd only allows you to load services either lazily (start service when first needed) or on demand (start service once per request). Systemd has a third option, to load a service at systemd startup, right after all sockets have been created. This third option is probably the one that will be used the most.
Posted May 31, 2010 15:29 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (1 responses)
2. Yes, we currently handle socket-triggered, bus-triggered, file-triggered, mount-triggered, automount-triggered, device-triggered, swap-triggered, timer-triggered and service-triggered activation. And the socket-based activation not only covers AF_INET and AF_INET6, but also AF_UNIX and classic named file system fifos. And the sockets can do all of SOCK_STREAM, SOCK_DGRAM and SOCK_SEQPACKET.
3. Of course, systemd can restart daemons for you just fine. And it does so out-of-the-box for many of them (such as the gettys). Restarting a service is a core part of process babysitting. And systemd is really good at that.
4. There is dependency checking for the order. However we always say that the shutdown ordering is identical to the reversed startup ordering. Hence you may not independently configure startup and shutdown ordering. Of course manual ordering of this is not necessary when socket/bus-based activation is used.
5. No, in either way the patch is trivial, if launchd is already supported it is a bit shorter even. For the 10 daemons (or so) in the F13 default install no took more than 10 or 20 lines of changing.
6. Even if you define no native services, and rely exclusively on SysV services boot-up will be a bit faster than in classic F13 (as an example), since we make use of the parallelization information from the LSB headers (if they are available). Some other distributions (Suse) use that informaton even on classic sysv. Ubuntu does not.
7. And no, I see no problem here. The DNS timeout is 30s or so on most systems. If a DNS server really needs that much time to start up then it is definitely broken. (A simple work-around is to edit the .service file of the client service and add a After= line for your super-slow service.) But anyway, this problem is hypothetical.
8. Well, if you want to connect to a socket service you need to know its address. This has always been like that, and is not changed in any way if systemd comes into play.
9. Sure, Upstart could do that. Not sure though how that fits into their current scheme. I mean, you can hack an emacs clone into the Linux kernel if you want to. There's nothing preventing you from doing that, either.
Posted Jun 1, 2010 23:01 UTC (Tue)
by liljencrantz (guest, #28458)
[Link]
Posted May 27, 2010 11:17 UTC (Thu)
by Tobu (subscriber, #24111)
[Link]
Posted May 31, 2010 15:03 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 26, 2010 19:01 UTC (Wed)
by ghigo (guest, #5297)
[Link] (8 responses)
The part that I didn't like is that this function is coupled to the init daemon: I would prefer an init daemon very simple, which start a classic sysv init script. The work to "wait for a connection then start the daemon" may be leaved to the script itself.
To me it seems that these function is coupled to the init daemon only because the init daemon has certain capability because its pid is 1 [*]. If this is true (may be I am missing something), I prefer to extend the capability of the pid=1 process to other process (via a kernel changing), and separate the function of the init process (start the base system) to the one of a "systemd" process (start the expensive daemon).
Finally a simple comment: I understand the importance of a quick boot, but today (I have a debian testing, with a no so old AMD system) the major part of the boot time is consumed by the bios booting. So who care a minimal increase of speed of boot, with the risk of a problem in a real critical part of a linux system. In case of init failure the system is blocked!
[*] IIRC The pid=1 process, has the capability to adopt any process which lost their parent.
Posted May 26, 2010 19:19 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (3 responses)
i really wish people would read the blog story before commenting here. many of the issues raised again and agin are already explained there in detail.
Posted May 27, 2010 7:50 UTC (Thu)
by ghigo (guest, #5297)
[Link] (2 responses)
I wrote that systemd is more powerful than (x)inetd, but the concept is the same.
Posted May 27, 2010 8:04 UTC (Thu)
by rahulsundaram (subscriber, #21946)
[Link]
Posted May 31, 2010 15:34 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
So, please, don't compare systemd with inetd too much, because that misses the core point.
If you don't see what the difference between systemd and inetd is, then please read the story again, particularly the part about "Parallelizing Socket Services".
Posted May 27, 2010 8:37 UTC (Thu)
by marcH (subscriber, #57642)
[Link] (3 responses)
Lucky you.
Posted May 27, 2010 9:04 UTC (Thu)
by dgm (subscriber, #49227)
[Link] (2 responses)
Posted May 27, 2010 14:41 UTC (Thu)
by kronos (subscriber, #55879)
[Link]
Posted Jun 3, 2010 7:33 UTC (Thu)
by eduperez (guest, #11232)
[Link]
Posted May 26, 2010 17:04 UTC (Wed)
by dhaval.giani (guest, #45724)
[Link]
But, since then we have realized about the existence of named hierarchies, which handle the issue for systemd.
We still do need to take care of the cpuset default values issue (as there are other use cases), and it has not exactly proven trivial to fix it in kernel space as well :-)
Posted May 26, 2010 17:11 UTC (Wed)
by alogghe (guest, #6661)
[Link] (8 responses)
However as most of us are -users- of init systems I'm not sure that shaving a few seconds off the boot that is already getting pretty fast is that attractive (non of my systems reboot very often at all) for the further disruption of a new init system.
A key feature that would cause me to be interested in a new init system is something I've seen no awareness of in from the groups involved -
Self healing ala Monit http://mmonit.com/monit/
Here's an example from monit of what I'd like to see in an upstart or systemd configuration -
check process sshd with pidfile /var/run/sshd.pid
Monit allowed me to create bulletproof embedded systems to deploy in developing economy banks.
Most daemon issues are not caused by pids just dying in my experience.. it's when they become unresponsive to user/program interactions. None of the init replacements deal with that (including solaris as I recall).
I'd like this integrated in phone/laptop/server environments.
P.S. Lennart thanks for Pulse, it's been an awesome improvement.
Posted May 26, 2010 22:58 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (2 responses)
Posted May 28, 2010 0:29 UTC (Fri)
by gerdesj (subscriber, #5446)
[Link] (1 responses)
I think that the daemon control system itself (whatever it is called) should be as intelligent as possible. If it can know that a daemon is borked and take remedial action, ie restart it sensibly until it is shown to be buggered and then give up, then great.
Even better if you could feed it rules of some sort that told it how to tell the difference between "recalcitrant" and "properly buggered".
Pretty much all systems I know of have a "status" subcommand to the service/daemon controller - why not make it actually work properly to the point where you can rely on it *completely?
Basically, would it not be nice to be able to believe your service manager when it says that Apache is fine rather than reaching for Monit/Nagios/web browser.
If the Gentoo "/etc/init.d/<service> zap" command went away then this problem is solved.
(* => for a given value of completely, which at the moment on all systems I manage (Gentoo, SLES, Fedora, *buntu, Win{lots of different versions} is local knowledge and folklore)
Posted May 28, 2010 5:27 UTC (Fri)
by jrn (subscriber, #64214)
[Link]
Posted Jun 5, 2010 13:29 UTC (Sat)
by segedunum (guest, #60948)
[Link] (4 responses)
Pffffff. Lennart should fix PulseAudio properly first by solving its extreme latency issues, amongst other things, before faffing about with something else.
PulseAudio is the reason I run a Mac. Seriously.
Posted Jun 7, 2010 11:58 UTC (Mon)
by nye (subscriber, #51576)
[Link] (3 responses)
And the reason I run Windows, in fact.
Posted Jun 7, 2010 13:15 UTC (Mon)
by anselm (subscriber, #2796)
[Link] (2 responses)
The only reason? IMHO this amounts to cutting off one's nose to spite one's face. It is after all quite possible to run Linux on a workstation without PulseAudio. I do, for example (on Debian sid, too), and audio still seems to work for me even so.
Posted Jun 7, 2010 16:23 UTC (Mon)
by nye (subscriber, #51576)
[Link] (1 responses)
Posted Jul 7, 2010 6:06 UTC (Wed)
by Triffid (guest, #68496)
[Link]
Between PA and Avahi, I have had quite a few problems with stuff this guy has written. Systemd looks like another attempt to change things for no good reason.
Posted May 26, 2010 17:37 UTC (Wed)
by clugstj (subscriber, #4020)
[Link] (51 responses)
So, we are back to the "inetd" interface? That's so '80s.
Not everything that runs is accessed as a network service. What about "ntpd"?
Posted May 26, 2010 17:53 UTC (Wed)
by tkreagan (subscriber, #4548)
[Link] (46 responses)
The point is that right now a whole lot of time is wasted synchronously starting daemons that could be started asynchronously. In addition, since the permutations of system configuration necessarily mean infinite startup paths, trying to deterministically manage the startup process is a losing game.
This isn't about network/non-network bias. Many sockets have nothing to do with network sockets. This is about how to manage a network of relationships under uncertainty.
init solves the problem by trying to run everything in order, even if that wastes performance. launchd tries to be much more flexible. systemd establishes rules of engagement and lets the daemons fight it out amongst themselves.
Hope that helps.
Posted May 26, 2010 18:10 UTC (Wed)
by spaetz (guest, #32870)
[Link] (45 responses)
And as for cups, isn't one of its "features" (that I don't use) to announce itself to the world (and all those avahi services) as soon as the computer runs? In that case cups needs to be active anyway and not only when I actually try to access it. How is that taken care of?
Posted May 26, 2010 18:36 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (34 responses)
inetd's focus was on on-demand loading of internet services. in systemd we use socket activation as a tool to maximize parallelization, and for minimizing the need to denote the dependencies of (mostly, but not exclusively) local services.
Posted May 26, 2010 18:54 UTC (Wed)
by smurf (subscriber, #17840)
[Link] (22 responses)
On the other hand, systemd's idea is "run everything only when needed". That is a net win only when most things are in fact not neded at system startup, if at all.
Personally, I tend to not install background programs that I don't need in the first place, so the second way doesn't hold much appeal for me. Moreover, some services have requirements that are a bit more involved than "listen on a TCP or UDP socket (or two)".
Posted May 26, 2010 19:12 UTC (Wed)
by nirbheek (subscriber, #54111)
[Link] (13 responses)
Specifically, "Parallelizing Socket Services" will show how systemd actually short-circuits the service dependency list using early socket creation to get things to start even *earlier*.
The "start things only when needed" behaviour is *after boot*, not during it[2].
1. http://0pointer.de/blog/projects/systemd.html
Posted May 26, 2010 21:53 UTC (Wed)
by Tobu (subscriber, #24111)
[Link] (12 responses)
The article doesn't explain how that big list of all daemons to start in parallel is established.
Either implicit dependencies are used, and you rely on socket activation, but you don't start daemons as early as they could be; or explicit dependencies are used, sockets are used only to help processes wait for each other, and the dependencies list needs to be maintained.
There's an ease-of-maintainance / performance tradeoff here, and you don't get both for free.
Posted May 27, 2010 6:37 UTC (Thu)
by dmk (guest, #50141)
[Link] (6 responses)
There are different types of entities systemd is aware of.
A daemon then connects to a socket, and systemd blocks that connection until the corresponding service is started and then hands off the socket to that daemon (there comes the patching into play).
So there is no big list needed at all.
Cheers,
Posted May 27, 2010 9:58 UTC (Thu)
by Tobu (subscriber, #24111)
[Link] (5 responses)
I have RTFA (thanks for the precise quote), and I don't think you get my point.
You have three services: A, B, and C. C depends on B, B depends on A.
The user wants C started.
systemd can rely on socket activation only; it starts C, then B by socket activation, then A by socket activation. Socket activation is convenient because you don't have to declare dependencies. But it is no faster than what upstart would do; upstart would start A, wait for the A-listening event, start B, wait for B-listening event, start C.
Or systemd can have the dependencies encoded; in which case, when C is requested, systemd will know to start A, B and C simultaneously, and the services will block on each other's sockets. This is faster, but you do need to do the work of writing down the dependencies.
So systemd can be faster or easier than other inits. This is not bad at all; one just can't claim that systemd is both faster and dependency-agnostic.
Posted May 27, 2010 11:34 UTC (Thu)
by dmk (guest, #50141)
[Link] (3 responses)
Anyway, systemd doesn't encode the dependencies, as far as I understand. So it's advantage over upstart is, that it is faster only, because it does not wait for the full service to start.
A starts up until it reads from socket B (which blocks A).
Now either A got unblocked by now, in which case the new scheme is faster, because A can continue even if B isn't startet fully up already,
Does this make any sense?
Posted May 27, 2010 11:48 UTC (Thu)
by dmk (guest, #50141)
[Link] (2 responses)
So you are right, there is a list of services to start.
Posted May 27, 2010 13:06 UTC (Thu)
by Tobu (subscriber, #24111)
[Link] (1 responses)
Yes. There are a few way to declare dependencies, some that allow the runtimes to overlap. Here is a good explanation.
There ought to be a way to record which service triggers socket activation and use it to help write dependencies, someone should write that.
Posted May 31, 2010 15:51 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 31, 2010 15:49 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Example: we know that syslog is used by almost all services, hence we start it right-away, and don't wait until somebody actually connects to it.
Also, we distinguish ordering and requirement dependencies. So if you have a service A and one that is needed by it B and neither of them are really needed at bootup you can define a dependency of type "Requires" between them. That will then have the effect that both are started at the same time if they are requested, and the ordering is then again handled by the socket activation logic/the kernel.
So, to make this clear, and repeating what the original blog story explained: we support dependencies just fine, though for the usual services you won't need them. They will be necessary only for a few selected services, in particular a few ones that are needed during early boot-up and late shut-down.
Posted May 27, 2010 7:28 UTC (Thu)
by khim (subscriber, #9252)
[Link] (3 responses)
I've had this discussion so many times and I still can't believe people are thinking like that. Guys, OR and XOR are different operations! Please open the logic textbook and read about difference between them! This is vital if you want to talk about systemd! This perfect illustration: systemd can do A or B, ok, but since if you do A (but don't do B) you need to do this and if you do B (but not do A) you need to do that - and you so are doing neither this nor that so how can that work? Of course in reality systemd can do "A (activate service via socket) or B (start services from the list) and that means it can do A and B simultaneously! Terrific, uber-uncomprehensible idea, isn't it? Implicit dependencies are used and you start daemons as early as possible (i.e.: you start all daemons in parallel). If daemon A needs deamon B it does not mean daemon B should be started earlier - it means daemon A will start first and then will wait for daemon B activation. This will start the system in fastest time possible. It's all explained in original paper. I know, I know, majority of population can not even imagine OR operation and only think about XOR (they call it OR, of course) - but these people shouldn't discuss design of systemd, that's all.
Posted May 29, 2010 0:25 UTC (Sat)
by baldridgeec (guest, #55283)
[Link] (1 responses)
I haven't done enough thought experiments or study of the init process limitations to have any kind of coherent input about systemd's particulars (despite having read Lennart's blog post with interest last week), but I do have a rather decent knowledge of linguistics in general, and English in particular.
"Either" is a word which introduces a parameter to the conditional expressed by "or." It is a flag which notifies the reader that the first and second clauses of the conditional are mutually exclusive.
In other words:
Posted Jun 4, 2010 23:37 UTC (Fri)
by Wol (subscriber, #4433)
[Link]
"You can borrow my car if you do either A or B" - in other words I don't care which you do and you could do both if you wish. "either" is a filler word which implies "xor" but doesn't require it. If you *really* mean XOR, you have to say "either but not both".
Cheers,
Posted May 29, 2010 0:30 UTC (Sat)
by baldridgeec (guest, #55283)
[Link]
Sorry for the pedantic tone in my previous comment! I guess I get a thrill from taking the wind out of grammar Nazis' sails when they're wrong, but you were addressing a different concern (and you're correct, as far as I understand the process.)
Posted May 31, 2010 15:43 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 27, 2010 6:39 UTC (Thu)
by tzafrir (subscriber, #11501)
[Link] (5 responses)
Care to give an example of a service/daemon that is needed before something connects through a socket? One example was given already: ntpd. It needs to start synchronizing the system regardless of anyone asking for it. But generally this is not the common case.
Also read the blog post (There, I said it myself ;-) ) regarding automounts. Those handle a different class of "services" (as someone mentioned here: get /usr or /home mounted when it's needed. A /usr mount point is the main reason for the "$remote_fs" LSB dependency).
Posted May 27, 2010 7:32 UTC (Thu)
by fperrin (subscriber, #61941)
[Link] (3 responses)
Posted May 27, 2010 9:12 UTC (Thu)
by marcH (subscriber, #57642)
[Link] (2 responses)
Yes, the main (not entire) point of the emacs daemon is save startup time. Saving startup time every time except for the first time looks good enough to me. Especially if this gets me logged in faster.
Posted May 27, 2010 15:12 UTC (Thu)
by drag (guest, #31333)
[Link] (1 responses)
Examples:
SAMBA -- Needs to scan network for services/system names, advertise availability and whatnot. Depends on configuration, of course.
Avahi -- Needs to advertise avialability over network. Used for MDNS
Firefly Server --- Service used Avahi to advertise avialability for DAAP service, but it needs to be able to scan the */Music directory for the server to check for updates and whatnot.
Mythtv-Backend --- Needs to configure hardware, scheduale recordings, and it advertises avialability over uPNP for clients and for media extenders.
MediaTomb -- Advertises over uPNP and needs to scan storage.
Libvirt -- It depends on configuration... if it's configured to launch a VM on boot-up then it'll need to be started on it's own, if it's not then the socket-connect method would work.
Nowadays we have a lot of Zeroconfig-type stuff available. SMB/Windows print services, Multicast DNS, UPNP, and 'Bonjuer' (Avahi). Avahi can take care of most of it for Linux/OS X networks (all the service needs to do is register with Avahi for the most part), but for Windows each uPNP service advertises on it's own stuff.
So, basically, there is a lots of different services that need to be started up and shutdown based on network availability and other circumstances.
Posted May 31, 2010 15:57 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 31, 2010 15:54 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 31, 2010 15:40 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (1 responses)
And no, systemd is about "run everything only when needed". You are missing the point. systemd is *not* about lazy-loading daemons. We can do that too, but that misses the point. We use the socket-based activation to maximize parallelization and to make dependency information unnecessary. Please read the story again to understand this!
Posted May 31, 2010 15:55 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 26, 2010 19:30 UTC (Wed)
by clugstj (subscriber, #4020)
[Link] (10 responses)
Posted May 27, 2010 4:27 UTC (Thu)
by elanthis (guest, #6227)
[Link] (2 responses)
Posted May 27, 2010 14:35 UTC (Thu)
by sharms (guest, #57357)
[Link] (1 responses)
Posted Jul 7, 2010 10:15 UTC (Wed)
by geocar (guest, #68511)
[Link]
Posted May 27, 2010 7:42 UTC (Thu)
by khim (subscriber, #9252)
[Link] (4 responses)
Let's talk about simple example: avahi, dbus and syslogd. avahi uses dbus and both dbus and avahi use syslogd. Suppose they spend 1second to initialize and only then start talking with each other. Init and upstart know the dependences and do the following: inetd does the following: systemd does the following: This is idealized example, but it shows the difference. The fact that systemd can start services both from the list and on-demand guarantees the fastest possible boot speed - and other interesting properties too.
Posted May 27, 2010 16:01 UTC (Thu)
by spaetz (guest, #32870)
[Link] (3 responses)
> Init and upstart know the dependences and do the following:
I agree with init, but doesn't upstart support parallel starting? So upstart might rather:
Am I wrong here?
> inetd does the following:
> systemd does the following:
One of the things I though it that systemd does NOT require explicit dependency information. So how does systemd knows that dbus and syslogd should be started at second 0 whwn avahi is supposed to go up? Nothing requests dbus and syslogd sockets until second 1 when avahi is up, right? So do we need to code in the explicit dependency information into the avahi.service config?
Posted May 27, 2010 16:40 UTC (Thu)
by spaetz (guest, #32870)
[Link] (1 responses)
Posted May 31, 2010 16:08 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
To light this up a bit: in systemd you can express both ordering and requirement dependencies. You can both configure them manually, and systemd will automatically add quite a few additional ones for you (Example: we will automatically add a "Requires" dependency from every file system listed in /etc/fstab to the device it is mounted from). However, for most cases for normal services you will not need to manually configure any dependencies, as the various ways of activation will deal with that automatically. Manual dependency configuration is really only necessary for units necessary for the very early boot, or the very late shut down.
Or in other words: we use dependencies internally, we also expose them to the user, but he should only very seldom need to make use of them.
This is a bit different from launchd, which really knows no dependencies at all. For that they pay a certain price though: their early boot-up is done completely differently from the actual service startup. Since our Linux start-up procedure is more complicated then theirs we hence decided to provide both: the dependency-less main boot-up plus manual dependencies for a few special services involved with very early boot.
Posted May 28, 2010 7:16 UTC (Fri)
by khim (subscriber, #9252)
[Link]
Dbus needs syslog too, so it can not be started in parallel with syslog if you only go by dependences list Dbus and syslog will probably be on the list of "always up" processes. If you'll drop them from said list systemd will start them later because they are requested by avahi.
Posted May 27, 2010 10:37 UTC (Thu)
by Tobu (subscriber, #24111)
[Link] (1 responses)
Posted May 27, 2010 13:15 UTC (Thu)
by Tobu (subscriber, #24111)
[Link]
Posted May 26, 2010 19:39 UTC (Wed)
by zander76 (guest, #6889)
[Link] (9 responses)
Posted May 26, 2010 21:11 UTC (Wed)
by spaetz (guest, #32870)
[Link] (8 responses)
> That meant that for each connection a new process was spawned and initialized,
Inetd is not just for restarting lazily on every new connection it can be used to lazily start on first use and continue running. Which seems to be exactly what systemd also proposes. I know people are going to tell me to read Lennarts blog, I still fail to see how an upstart/inetd combo can't basically achieve most of what systemd achieves. But I might just be dense there. I'll wait for the dust to settle and happily use whatever makes my box boot up...
Posted May 26, 2010 22:54 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (7 responses)
we can start syslog and dbus and avahi at the exact same time, even though avahi needs both syslog and dbus, and dbus needs syslog too. because the kernel will queue the requests, and at no time the sockets will be inaccessible, and the kernel will do all the ordering for aus for free. if dbus sends something to syslog, then that data will be buffered in the kernel socket buffer and delivered only when syslog is ready to process it. and until that time dbus can already go on and do other thinga, without having to wait for syslog to startup.
syslog, dbus, avahi work with af_unix sockets, which were out-of-scope for classic inetd.
so, let me stress again: everybody who claims that systemd was about lazy-loading daemons didnt understand the idea. systemd is about utilizing the socket logic to maximize what we can parallelize, and minimize the amount of dependencies that need to be configured.
and all of this you find explained in the blog story. its just noise i have to repeat that here.
Posted May 27, 2010 0:10 UTC (Thu)
by dbenamy (guest, #39458)
[Link] (1 responses)
Posted May 27, 2010 6:39 UTC (Thu)
by mezcalero (subscriber, #45103)
[Link]
1. we set up all sockets, af_inet and af_unix.
in inetd you only have the first step, and it is mostly about af_inet, not af_unix.
(this is a a simplification btw, its a bit more complex in reality.)
this is explained in the "parallelizing socket services" part of the original blog post.
Posted May 27, 2010 14:07 UTC (Thu)
by BenHutchings (subscriber, #37955)
[Link] (4 responses)
Posted May 28, 2010 9:31 UTC (Fri)
by liljencrantz (guest, #28458)
[Link] (1 responses)
Posted May 28, 2010 10:23 UTC (Fri)
by michich (guest, #17902)
[Link]
No, the backlog length must be set by userspace when making the socket listen, see
Posted May 28, 2010 10:33 UTC (Fri)
by michich (guest, #17902)
[Link]
Posted May 31, 2010 16:11 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 27, 2010 0:05 UTC (Thu)
by neilbrown (subscriber, #359)
[Link] (3 responses)
ntpd is an interesting one. We cannot really make "gettimeofday" block until ntpd has affirmed that the system time is correct.
Most programs probably don't care if the system time is still just based on the cmos clock, or whether it has been synchronised to the Internet or to GPS or whatever yet. Maybe programs that do care need to check with e.g.
ntpdc -np | awk '$0 ~ /^*/ { print $7}'
rather than just assuming that they were started after 'ntpdate' had run...
I suspect there might be other similar hidden assumptions that need to be found out.
Posted May 27, 2010 11:39 UTC (Thu)
by Trelane (subscriber, #56877)
[Link]
Yes, especially since many computers (e.g. laptops) aren't always on the network!
Posted May 27, 2010 13:27 UTC (Thu)
by marcH (subscriber, #57642)
[Link] (1 responses)
I understand that ntpd is different. I do not yet see how it is interesting.
ntpd is different because it has to be always started whatever happens elsewhere. Surely systemd also caters for such "no-deps", no-brainer cases.
> We cannot really make "gettimeofday" block until ntpd has affirmed that the system time is correct.
And "we" never did, and systemd does not plan to (or does it?!)
So what difference could systemd make with respect to ntpd?
Posted May 27, 2010 21:34 UTC (Thu)
by neilbrown (subscriber, #359)
[Link]
It is not clear to me that systemd allows you to specify this dependency as NFS mounts would all be done on-demand.
Whether or not this is a real issue I cannot say, but I think that from a theoretical standpoint it is at least interesting in that there could be a dependency between an on-demand service, and a service which cannot be demanded (if that makes sense).
Posted May 26, 2010 17:45 UTC (Wed)
by ballombe (subscriber, #9523)
[Link] (8 responses)
There is another reason: Debian support non-Linux kernels that do not provide cgroups. Having a default init system that only support Linux is problematic.
Posted May 26, 2010 18:39 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (7 responses)
its not different with upstart, which is linux-only, too.
Posted May 26, 2010 18:43 UTC (Wed)
by aleXXX (subscriber, #2742)
[Link] (6 responses)
Alex
Posted May 26, 2010 22:32 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (5 responses)
or to put it more drastically: i dont believe in portability, i will not let myself be limited by that and will not work on improving the portability of my projects. that said, for other, more high-level projects than systemd i maintain where portability might be interesting and easier to do, i wont make it it particularly hard for people who care about such things. i will merge their patches if they are clean, and i will opt for the portable iface if there is the alternative, but that's where it ends.
i believe the constant call for portability from some folks is just slowing us down, to little value. I for one am interested in making Linux better, not some non-existing abstract idea of an OS.
and to answer more to the point: among other apis upstart uses cn_proc, which is very linux specific.
Posted May 26, 2010 23:49 UTC (Wed)
by alankila (guest, #47141)
[Link]
Posted May 27, 2010 1:29 UTC (Thu)
by rsidd (subscriber, #2582)
[Link] (3 responses)
Posted May 27, 2010 2:12 UTC (Thu)
by da4089 (subscriber, #1195)
[Link] (2 responses)
I find the recent application of so many developer hours to something that matters so little confounding.
Posted May 27, 2010 4:18 UTC (Thu)
by kov (subscriber, #7423)
[Link]
Posted May 28, 2010 9:43 UTC (Fri)
by mpr22 (subscriber, #60784)
[Link]
Posted May 26, 2010 18:06 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (59 responses)
The whole approach of "let's just start everything and hope it works out well" is somewhat messy.
What are we going to do with network sockets and other services, for example? I have an application which bombs out if BIND is not yet started (it needs a resolver to resolve host names when it reads its config). How do I mark this dependency?
Or another thing, with upstart I can specify that my another application depends on PostgreSQL. So there's no sense in running it if Postgres is not started or is disabled. I don't want it to be stuck forever waiting for connection.
Another painful area - stopping services. I want my init system to correctly traverse and carefully deconstruct dependency graph. For example, I want my webapp to be stopped before PostgreSQL is stopped.
Upstart nicely solves all these problems. Systemd - not so much.
Posted May 26, 2010 18:18 UTC (Wed)
by drago01 (subscriber, #50715)
[Link] (9 responses)
Posted May 26, 2010 18:33 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (4 responses)
Lennart also is misguided - target based systems are NOT good. Most of users _need_ NetworkManager to be started as soon as possible.
In essence, the goal is usually 'run everything ASAP' and not just 'run GNOME'. There are generally very little subsystems that don't need to be started on each boot.
However, sometimes we DO need to delay some service (a good example is CUPS). And that's where his ideas might be useful.
'Involuntary confinement' with cgroups might also be useful as an optional feature in Upstart or other init systems (even in standard Sys-V-ish daemon startup scripts).
Posted May 26, 2010 18:44 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (2 responses)
Posted May 26, 2010 22:51 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (1 responses)
So go and read MY post - it contains valid objections.
Posted May 31, 2010 16:16 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 27, 2010 14:21 UTC (Thu)
by buchanmilne (guest, #42315)
[Link]
Posted May 26, 2010 21:11 UTC (Wed)
by sebas (guest, #51660)
[Link] (3 responses)
There's a number of posts in this thread that would, in my opinion, at least qualify to get a short answer, possibly referring to the full article, instead of just being brushed off like this.
Denying anybody the right to comment when the original post (which is quite lengthy indeed) hasn't been fully read, or understood might be OK from a "let's save us all time (especially myself)" point of view, but it also kills off discussions that would otherwise contribute to a better understanding of why the world needs yet another, incompatible system to start their OS. (Yes, not a given, people don't like changes without immediate, positive net effects, and rightfully so.)
More importantly, what systemd needs, especially in its early and uncertain phase of development, is awareness. You don't create that by killing off discussions, you create that by patiently explaining people what it is, does, its benefits and disadvantages. Over and over.
Posted May 27, 2010 14:34 UTC (Thu)
by marcH (subscriber, #57642)
[Link] (2 responses)
What about a short FAQ?
Think about the "F" in "FAQ" for a minute. My guess is that this "F" must somehow be related to all these stupid people not RTFM (with a different "F").
Posted May 31, 2010 16:19 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (1 responses)
Posted Jun 7, 2010 20:06 UTC (Mon)
by marcH (subscriber, #57642)
[Link]
This blog is light years away from being a good systemd sales pitch. That's perfectly OK as long as you do not get angry and annoying when people fail to read between its (too numerous) lines.
Just try to compare your blog to any LWN article and you might understand better the misunderstandings happening here.
Posted May 26, 2010 18:31 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (39 responses)
Posted May 26, 2010 18:42 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (36 responses)
Maybe, like, ability to start CUPS only if there's networking or on an on-demand request (if a client tries to connect to it)?
Posted May 26, 2010 19:07 UTC (Wed)
by martin.langhoff (subscriber, #61417)
[Link] (30 responses)
WRT CUPS and networks, look at the posted messages after the blogpost itself, there are some interesting notes there about it.
The proof is -- as usual -- in the pudding, but the design of systemd seems good, and simplifies things a lot. If it is available for F14, I'll switch to it.
My only worry is the idea of "writing init scripts in C" -- I think it's hyperbole to indicate that you just write a config file, and a C program (systemd) does the right thing. That misses the overrides you can apply trivially in most linuxen by creating /etc/sysconf/$servicename or just hacking the damn initscript.
AIUI, you can just point systemd to an oldstyle script anyway -- that loses the parallelisation and fast-boot properties.
Maybe systemd can provide a low-overhead init script interpreter? Python? Lua? How to do it would be a challenge -- you don't want an embedded interpreter in systemd, but you don't want the startup overhead either.
Posted May 26, 2010 19:57 UTC (Wed)
by jspaleta (subscriber, #50639)
[Link] (2 responses)
There's a lot of flexibility here for service control that sysadmins who have grown to rely on sysV init scripts are going to need to expend some energy learning to wrap their heads around some of the flexibility in control/resource limits that relying on cgroups allows. From a sysadmin pov, this seems like some of the richer benefits are going to be reaped in understanding that particular point of the design... as well as some of the biggest challenges. The discussion about how cgroup level interactions with screen-like detached behavior is going to be important.
-jef
Posted May 26, 2010 21:46 UTC (Wed)
by dlang (guest, #313)
[Link] (1 responses)
this is something useful for desktops, but that's not for where most sysadmins work.
Posted May 26, 2010 22:07 UTC (Wed)
by jspaleta (subscriber, #50639)
[Link]
The design of systemd isn't _just_ about service start up. There are elements in there which deal with resource constraints over the lifetime of the systemd control process via its use of cgroups. I think sysadmins should attempt to wrap their heads around when cgroup level control are going to be useful..and when they are going to be..in the way. Part of that will mean getting familiar with the libcgroup utilities..which are mentioned in the blog story.
To paint systemd as just being a different way to start things up fast is missing a critical point about service management in choosing to rely on cgroups in the design.
-jef
Posted May 26, 2010 20:09 UTC (Wed)
by nybble41 (subscriber, #55106)
[Link] (2 responses)
Posted May 31, 2010 16:26 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (1 responses)
Posted May 31, 2010 18:21 UTC (Mon)
by nix (subscriber, #2304)
[Link]
Posted May 26, 2010 22:49 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (23 responses)
I've read (most of) comments.
Still no answer. So can you just cut'n'paste the relevant passages instead of telling me to RTFBP?
Posted May 27, 2010 8:01 UTC (Thu)
by khim (subscriber, #9252)
[Link] (22 responses)
If the application bombs out before something is started then the application should be fixed - it's as easy as that. It can connect to bind (then it'll be stopped till bind is started) or we can fix the resolver library to block the application till the bind is started (exactly the same thing, but more clear solution). You either need the application, or you don't need it. If you need it then start it and PostgreSQL will be started, if you don't need it then don't start it. What's so painful about it? Your webapp will be stopped before PostgreSQL if it keeps the connection to PostgreSQL active - as it should. Look, the Unix survived for 40 years as a research project - and a lot of components are connected via ducttape and chewing gum. This is crazy. If it's production system then it should be built as production system. systemd removes the chewing gum and ducttape - and there are no way to reattach them. This means components which don't fit without ducttape must be changed to fit better, that's all. If you don't like it - you can use the old system, if you want, it's free software, after all.
Posted May 27, 2010 10:47 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link] (20 responses)
Bombing out on unresolved hosts is a CORRECT behavior. Modifying the app so it can work with a certain init system is crazy.
So we still need to have explicit dependencies at least for SOME services.
"You either need the application, or you don't need it. If you need it then start it and PostgreSQL will be started, if you don't need it then don't start it."
And what if PostgreSQL is down because I'm upgrading it? Or maybe I don't want it to start for some reasons (like system recovery in progress, etc.)?
"What's so painful about it?"
Doing it correctly.
"Your webapp will be stopped before PostgreSQL if it keeps the connection to PostgreSQL active - as it should."
Why should it? I use a connection pool, but it doesn't keep inactive connections forever. So it might certainly be possible that the webapp doesn't have any active connections during shutdown.
"Look, the Unix survived for 40 years as a research project - and a lot of components are connected via ducttape and chewing gum. This is crazy. If it's production system then it should be built as production system. systemd removes the chewing gum and ducttape - and there are no way to reattach them. This means components which don't fit without ducttape must be changed to fit better, that's all. If you don't like it - you can use the old system, if you want, it's free software, after all."
Yes. That's why I hate shell scripting and systemd. They work in _most_ cases and can miserably fail in sometimes.
Upstart has an advantage of clean _explicit_ dependencies. They can be analyzed (with the help of systemd!) and fixed if required. But they are _explicit_.
Posted May 27, 2010 11:16 UTC (Thu)
by khim (subscriber, #9252)
[Link] (2 responses)
Well, the alternative is fix in resolver library as I've pointed before. And if the application should be fixed in some other cases then it may be done with some kind of "babysitter" wrapper. What for? So far all examples were reiterations of the same scheme: "I need the explicit dependencies because I have an application which is broken" and the obvious answer is "well, fix the application"... It can often be done with some kind of wrapper so application itself is intact... Then the systemd must be informed and all applications which need the PostgreSQL will wait. If webapp drops all active connections to PostgreSQL while it has unsaved state then it's buggy and should be fixed. If the active connections are closed because there are no work to be done with them then it does not need PostgreSQL to shut down. I'm yet to see the problem where systemd fails because of it's design and not because some other component is broken. IMNSHO it's disadvantage. Yup. That's why they'll never be correct. Currently dependency graph is partially stored in application code and partially in upstart configuration. This information is often stale and incorrect - but with some application of time and resources the whole system works - but it only proves the #3 truth from RFC1925. But is it correct and good approach? Obviously not - duplication of information is almost always bad because copies grow apart over time. Sometimes it's needed for performance reason, but I'm not seeing such need with regard to systemd...
Posted May 27, 2010 12:03 UTC (Thu)
by hppnq (guest, #14462)
[Link] (1 responses)
But systemd should be able to handle things like socket options, network addresses, file permissions/ownership, and a few more. I don't see how this can be easily done without duplication of information.
(And how about processes that decide on, say, port numbers or domain socket names only after they have been started?)
Posted May 31, 2010 16:38 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 27, 2010 14:47 UTC (Thu)
by buchanmilne (guest, #42315)
[Link] (15 responses)
Posted May 27, 2010 15:10 UTC (Thu)
by keybuk (guest, #18473)
[Link]
Posted May 27, 2010 16:09 UTC (Thu)
by paulj (subscriber, #341)
[Link] (11 responses)
Ugg.. Such polling behaviour is horrid. How frequently should apps poll? No matter how slow or fast apps poll, it will be too slow for someone and it will burn energy for everyone. If systemd leads to lots of apps being modified to poll for resources then: ye gods!
We surely have to get to a stage where these things are event-driven? The most common system for this seems to be DBus now. DBus already can auto-start services on demand. If we really must modify everything, why not just port to DBus? It seems a lot of apps will have to be modified to use an event posting service anyway, if they're ported to systemd, so why not skip the systemd step altogether? Just because these dependencies can be "magiced" away technically at the init level, does *not* mean they go away. They're still there, and so they're still going to have be dealt with at some level. Which may mean that all that systemd accomplishes is a boatload of pointless churn, on the path toward a userspace that's integrated around an event-driven system service (e.g. DBus).
Also, I'm not looking forward to the release or 4 of instability we Fedora users no doubt will go through as all the corner cases get debugged out (systemd and updating apps).
Posted May 31, 2010 16:49 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (10 responses)
There is no polling involved, the normal glibc resolver times out after 30s or so, that is more then enough time to get things started. The problem you are discussing is made up.
Clients need *not* to be patched. Servers do, but the work is minimal, and already finished for all daemons we start by default on F13.
I think you are a bit naive on the amount of coding and political work you'd need to do to make everybody use D-Bus instead of normal sockets. Also, let's not forget that there are quite a few services where D-Bus makes little sense. D-Bus is an RPC. Sockets are on a lower level. I mean, good look in arguing that glibc should now talk D-Bus when resolving DNS info.
Posted May 31, 2010 22:40 UTC (Mon)
by paulj (subscriber, #341)
[Link] (9 responses)
I understand systemd does allow for basic dependencies (the fulfillment state transition of which is obv. an event). However, the stated philosophy in systemd is to eschew encoding dependencies in config files and instead have the apps just "Do The Right Thing" (whatever that may be), as much as possible.
My question then is: Doesn't this philosophy mean that, in addition to systemd managing process lifetimes, that you also need an a higher-layer event-posting system above systemd to allow apps to stay informed of event fullfilment and transitions, and handle them? Events such as "network available", "name resolution service available", "System time may now be considered stable", etc.
Basically, systemd deliberately does not answer these questions, other than that it can act as a proxy for certain services by handling their fd, correct? If so, do you agree that there would such a higher-level system? If so, why do you think it is worth having BOTH a fancy init AND a fancy higher-level event-handling system? Why not just do all the work in this fancier higher-level service, and migrate services to be started by this higher-level service, and stick with the dumb init?
You may say I'm FUDing, but none my assertions in the comment you replied were about systemd. Anything relating to systemd were in the form of questions (except perhaps my fears of instability), as with this comment, and all I'm interested in is to have my questions/concerns addressed.
Posted May 31, 2010 23:34 UTC (Mon)
by nix (subscriber, #2304)
[Link] (7 responses)
'System time may now be considered stable' I have no idea how you could handle. Lennart?
Posted Jun 1, 2010 1:21 UTC (Tue)
by paulj (subscriber, #341)
[Link] (3 responses)
E.g. the printer example Lennart gives, and says "printer plugged in" can be depended on. But what if I want to depend on the type of printer? That's treading into udev below and DBus services above, depending on exactly what I want to do. Or "network available" - but what if I want to depend on a certain kind of network interface? Or a certain location (e.g. "start the automounter, for corporate NFS if ...")? Lots of the information you might use there is being maintained by NetworkManager (using DBus to publish that info).
Basically, if we add systemd to the mix, we're going to have udev, then systemd, then DBus + {various DBus services: NetworkManager, ModemManager, gdm, polkitd, bluez, etc}. Do we really need that extra layer of management? And many services modified for systemd would have to bind into a DBus(-like)? layer anyway, to handle in-lifetime events.
Posted Jun 1, 2010 11:56 UTC (Tue)
by mezcalero (subscriber, #45103)
[Link] (2 responses)
People should handle "in-lifetime" events (as you call them) with the native notification logic available. no need to involve systemd, or dbus or anything.
Posted Jun 1, 2010 13:33 UTC (Tue)
by dlang (guest, #313)
[Link]
on some systems I use the -G option, on others I use ntpdate.
Posted Jun 2, 2010 6:33 UTC (Wed)
by paulj (subscriber, #341)
[Link]
What exactly is the "native notification logic"? (Note that many events are application layer).
Also, I'm not saying systemd needs eventing logic. I'm asking whether it makes sense to try solve these problems in a init process, external to applications. (for value of apps that includes those that would be started by it).
In short I'm asking whether actually its user-space that needs fixing to cope with differences in and changes to environmental state? Because it seems that doing that correctly would allow a not-too-fancy init to fire off apps in parallel and not worry about dependencies, as you argue systemd should be able to do with good apps. It seems applications will have to be modified to do this anyway, to get best effect from systemd.
Posted Jun 1, 2010 11:47 UTC (Tue)
by mezcalero (subscriber, #45103)
[Link] (2 responses)
Posted Jun 2, 2010 7:38 UTC (Wed)
by Darkmere (subscriber, #53695)
[Link] (1 responses)
After network is established, time is then fast-forwarded to "real" time via ntpdate.
This means you have 2 distinct time-jumps. The first one is to avoid the annoyingly bad fsck times when a filesystem is 480+ days out of fsck ( right.) the second one _has_ to run before dovecot, which will detect time warp and decide "Life is bad, hardware broken, we die now" and block. ( doesn't properly shut down, just stops working properly )
So, yes. A few services, mostly mailservices, and some other ones do not like it when time changes too much. ntp itself _requires_ ntpdate early on, or it will simply decide that the time is too much out of sync to even bother adjusting it. And with large timedrifts, ntp isn't fun anyhow.
So, You may consider those services that require proper timekeeping to be broken ( perhaps they are ) but they are common and have to be managed with. And it's easier to deal with that than to deal with other situations.
Posted Jun 9, 2010 12:37 UTC (Wed)
by hackerb9 (guest, #21928)
[Link]
I realize I'm going far off-topic by not contributing to the init flame war and instead giving a small helpful hint. Please forgive me. Don't jump your clock just to avoid fsck. If you're going to skip regular fscks anyway, you can use ObligatoryFlameContribution: "NO! If you had read my blog post you'd realize you are ALL wrong! Using Makefiles for RC dependency is the one true way!
Posted Jun 1, 2010 11:43 UTC (Tue)
by mezcalero (subscriber, #45103)
[Link]
I am not sure what you mean by "basic dependencies". systemd actually has a pretty elaborate dependency system, which distinguishes eight kinds of dependencies: Requires, RequiresOverridable, Requisite, RequisiteOverridable, Wants, Conflicts, Before, After. And you can use that to build dependencies between all ten kinds of units we have.
There doesn't need to be an event for "name resolution available", because in the socket-based actviation scheme it is always available. And most services which need a live network, such as IPv6 discovery daemons, or Avahi or suchlike hook into netlink anyway to get notifications for this -- and rightly so. I see little need for another generalized eventing system. And I don't think that "System time may now be considered stable" is a valid event. On all machines built in the last 25 years or so the RTC should be "stable" from the beginning. I mean, it would be nice to have a notification system where the kernel informs us about a jumping time (i.e. on timezone changes), but that has nothing to do with the monotonic clock or systemd.
So, I fail to see why you'd want any generalized eventing system beyond the dependency system that systemd offers to you and the various notification systems the kernel already provides, such as inotify, netlink, udev, poll() on /proc/mount, and similar. If apps want those events they should use those notification facilities natively, there is little need to involve systemd in that.
Does that answer your question? Because quite frankly, I am not sure I understood the question entirely...
Posted May 27, 2010 16:32 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Because this app must work even without Internet connectivity, using only local authoritative BIND server to resolve local names.
"If there aren't any active connections, there is no harm in shutting Postgresql down at the same time you shut down the web app."
Aside from possible race conditions if app tries to connect to Postgres while Postgres is being shut down. It's especially possible if app needs to do some clean-up actions on shutdown (say, write a log entry to DB).
Unlikely? Yes. Possible? Certainly. And that's what I hate most in Unix systems.
The correct behavior in my opinion would be to explicitly mark certain dependencies as 'parallelizable' so they can be started simultaneously. You won't be able to automatically and reliably detect all dependencies, that's a fact of life.
"Note that earlier dependency-based init systems also have explicit dependencies. For example, Mandriva has used prcsys (since about 2004), which uses LSB-headers for dependency information. Funnily enough, so does systemd. Quoting from the blog post"
Yes. However, earlier init systems were rule based instead of event-based. That's a great advantage of upstart, actually. And another commenter noted that upstart can now use LSB headers.
"Did you read the blog post?"
Yes.
PS:I quite like PulseAudio precisely because it tried to cover _all_ use-cases, including piping audio over the network to a USB bluetooth handset. This project - not so much.
Posted May 27, 2010 17:06 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link]
http://www.netsplit.com/2010/05/27/dependency-based-event...
It also nicely clarifies distinction between event-based and rule-based startup systems.
Posted May 31, 2010 16:34 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
You are discussing a problem that doesn't exist.
Posted May 31, 2010 16:33 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
So, the whole idea of "application bombs out if bind is not yet started" is bogus. Doesn't exist in the systemd scheme.
Posted May 27, 2010 15:06 UTC (Thu)
by buchanmilne (guest, #42315)
[Link] (4 responses)
Or, you need to clarify your "question" further.
Posted May 27, 2010 16:59 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link] (3 responses)
For example, what systemd is going to do if network interface required for the daemon does not go up? Or only one of two interfaces goes up?
There's just too many possibilities.
Posted May 27, 2010 18:27 UTC (Thu)
by drag (guest, #31333)
[Link] (1 responses)
Not sure.
Most network services that want to listen on multiple interfaces will just listen to 0.0.0.0 which will cause them to listen to all network interfaces regardless of the time they come up or not. In that case the service will remain dormant until somebody on any network tries to use it.
For network services that I've used that depend on different ports being open for different purposes the daemon itself just listenned on all interfaces and then only responded appropriately based on it's own internal configuration.
For example: DNSMASQ.
Dnsmasq (just so you don't have to look it up if you never used it) is a clever little daemon used to cache DNS requests and can perform DHCP services if configured. I've used it extensively for building network routers and in doing virtual machine host configurations. It's also used in things like OpenWRT for small soho routers. Very nice little application that allows me to eliminate a number of difficult-to-configure services and can read from yoru hosts file to make it simple to make contained DNS resolved network names for a small/medium sized network.
Well Dnsmasq depends on being able to use the DNS ports and DHCP ports on the internal network. Then it also needs to have the ability to do DNS requests to a external network.
Also it's common to have many multiple network ports on a router, so you can configure it to provide DHCP services to some networks, but not on others.
Now you can hard-code it to use only certain network interfaces or ip addresses, but the recommended configuration just has it listenning to DNS/DHCP requests on all networks simultaniously and it will choose to respond to it based netmasks and that sort of thing. That way you don't have to care about it... it takes care of the policies on it's own.
---------------------------------------
Otherwise what I use for services like that that can't handle things intellegently I'll use If/up, if/down network initialization scripts and/or Network-Manager-Dispatcher (which behaves very similar and uses a similar structure to ifup/ifdown scripts)
Needless to say that all of this would be a advanced system-specific configuration and is a nitch need. For a general purpose thing like Systemd it may not be appropriate for it to address this needs.
But if it could then that would be terrific, of course.
Posted May 27, 2010 19:34 UTC (Thu)
by hppnq (guest, #14462)
[Link]
[1] YMMV.
Posted May 31, 2010 16:52 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 26, 2010 21:03 UTC (Wed)
by spaetz (guest, #32870)
[Link] (1 responses)
Would you please stop telling everyone who has a comment or question that? It is annoying and repetitive. And it is also insulting to assume that I did not read the original LWN article AND the lengthy blog post. I -for example- did and have still questions and doubts. Stop assuming we are all slashdot readers please. Thanks.
Posted May 27, 2010 9:38 UTC (Thu)
by dgm (subscriber, #49227)
[Link]
Posted May 26, 2010 19:12 UTC (Wed)
by drag (guest, #31333)
[Link] (7 responses)
If my understanding is correct:
Presumably when a application requests something from BIND; it will get launched to serve that request.
Sooo... it would go something like this:
1 Application requests name resolution
2 Request goes through the nsswitch stuff. The nsswitch configuration indicates:
3. So the look up checks your hosts files, tries mdns4_minimal (which should trigger Avahi to start up) then finally ties the 'dns' method.
4. The /etc/resolv.conf file is checked. The resolv.conf has, as it's first entry:
5a. The code then connects to UDP or TCP port 53 on localhost.
5b. The Systemd configuration method would have bind service conifigured and the systemd stuff will be listenning on port 53 in a inetd-like fashion.
6. Systemd responds to request on localhost port 53 and launches Bind.
Soooo.... To answer your question of:
You configure /etc/resolv.conf to have localhost as a nameserver.
Posted May 26, 2010 22:37 UTC (Wed)
by mezcalero (subscriber, #45103)
[Link] (3 responses)
Posted May 26, 2010 22:56 UTC (Wed)
by cesarb (subscriber, #6266)
[Link] (2 responses)
With systemd, the listening socket would become available very quickly in the computer with the resolver (limited mostly by the BIOS delay); that is, even between separate machines, it could help.
It would be even cooler if it were possible to have service dependencies across machines (so for instance machine A would delay loading a service until a listening socket in machine B becomes available). This would end the problem of having to figure out which machine you have to boot first when the power went out on your >300-day uptime servers.
Posted May 26, 2010 23:54 UTC (Wed)
by foom (subscriber, #14868)
[Link] (1 responses)
Posted May 27, 2010 19:50 UTC (Thu)
by mgedmin (subscriber, #34497)
[Link]
Posted May 27, 2010 10:32 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link] (2 responses)
Also, what if I want to listen only on a few interfaces (LAN interface and localhost) - are we going to completely replicate inetd (which I have gladly exterminated from my systems) there?
Posted May 27, 2010 15:27 UTC (Thu)
by drag (guest, #31333)
[Link]
Thats the idea, I suppose.
> (I don't have Avahi, BTW)?
You should. It kicks ass. I've long stopped given a shit about static IP configurations and mucking around with DNS on my network because of it. Services like DAAP are cool.
> Can you point out where the blog post says something about _network_ services? Can it even be done correctly?
OK:
So AF_INET == Network Socket for IPv4
> Also, what if I want to listen only on a few interfaces (LAN interface and localhost) -
No clue. Apparently for things to work optimally the services need to be patched so that they can take care of those sort of details themselves.
Probably with 'dumb' non-systemd optimized services you'll have to edit Systemd configs a little bit.
> are we going to completely replicate inetd (which I have gladly exterminated from my systems) there?
Sounds like it. Hope so. I like things to be simple.
Posted May 31, 2010 16:56 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
And, as mentioned we create automatic dependencies between sockets and network interface devices if you for example configure a socket to bind to one particular interface only. That for example is another thing inetd cannot do for you, because it handles only sockets and nothing else. We track and control the entire system state, and hence can easily cover this, too.
Posted May 27, 2010 5:15 UTC (Thu)
by mordae (guest, #54701)
[Link]
So, you just remove native systemd's postgresql service and use your own pair of init scripts for your site-specific deployment which I don't get, since when you get a dedicated DB box, you won't be able to do this anyway and will have to display "db unavailable" from the webapp whenever it's down.
Posted May 26, 2010 20:18 UTC (Wed)
by bangert (subscriber, #28342)
[Link] (8 responses)
why is it that these systems seem to excite so violent reactions of uninformed disapproval?
Posted May 27, 2010 0:07 UTC (Thu)
by mfedyk (guest, #55303)
[Link] (4 responses)
Posted May 27, 2010 1:35 UTC (Thu)
by rsidd (subscriber, #2582)
[Link] (1 responses)
Posted May 27, 2010 4:09 UTC (Thu)
by njs (subscriber, #40338)
[Link]
Posted May 27, 2010 11:11 UTC (Thu)
by cesarb (subscriber, #6266)
[Link] (1 responses)
And the fact that qmail was a huge source of email backscatter (sending bounces to faked email addresses).
And the lack of AXFR/IXFR in djbdns (rsync, anyone?).
These are the complaints I heard the most about DJB's software. My own annoyance with it (besides the bounce spam) was the "million of tiny _invisible_ files (that is, all dotfiles) scattered all over the filesystem" model for configuration, which made administering an inherited mail server harder than it should be (of course, changing to postfix solved that for me); but I do not recall hearing many complaints about this particular point.
There are great ideas which came from DJB's software (Maildir, which solves the >From problem, is my favorite example), but other software quickly adopted them, negating any advantage for DJB's software. What was left was only the annoyances.
Posted May 27, 2010 19:34 UTC (Thu)
by njs (subscriber, #40338)
[Link]
Posted May 28, 2010 11:03 UTC (Fri)
by cesarb (subscriber, #6266)
[Link]
I do not know if that is the cause, but one possibility is that it is some sort of Hype Backlash (warning: link points to a highly addictive wiki).
Posted May 29, 2010 20:34 UTC (Sat)
by man_ls (guest, #15091)
[Link] (1 responses)
Aw crap, I'm addicted...
Posted Jun 5, 2010 11:27 UTC (Sat)
by Wol (subscriber, #4433)
[Link]
I know I made a conscious decision that I was not going to touch any of his software, not because it was bad or good, but because I didn't want anything to do with him the man.
Cheers,
Posted May 26, 2010 20:37 UTC (Wed)
by stijn (subscriber, #570)
[Link]
Posted May 26, 2010 23:45 UTC (Wed)
by neilbrown (subscriber, #359)
[Link]
But thinking a little further, how does auto-mount wait for the underlying device to become available. Assuming that we configure all local mounts to identify the device by uuid, we would probably need to integrate with udev...
I guess automount just keeps retrying and blocking (rather than failing) if the uuid isn't visible yet - would that be safe?
Posted May 26, 2010 23:48 UTC (Wed)
by MrWim (subscriber, #47432)
[Link]
There is a video from the Ubuntu Developers Summit where Scott James Remnant discusses systemd. He touches on cgroups and other bits of systemd he would like to see in upstart or he feels doesn't work in the real world. The session is called Upstart Q&A and the bit on systemd starts at 36:15
Posted May 27, 2010 1:03 UTC (Thu)
by russell (guest, #10458)
[Link] (7 responses)
1. A recipe for unpredictable latency and memory usage. Which can be triggered by outside sources.
2. A nightmare for configuration. Is systemd going to read everyone elses config files to know what ports/interfaces a process should bind to? What about socket options? Does this mean we have to configure these things now in multiple places?
3. Pulseaudio's simplistic view of the world still gives me trouble and I can see the same thing happening here. e.g. He's plugged in a HDMI cable, he must what audio over that. No other option, period!!! Too bad my TV doesn't do HDMI audio.
Posted May 27, 2010 5:24 UTC (Thu)
by mordae (guest, #54701)
[Link] (3 responses)
Not really, you only install/enable services you would have used anyway.
> 2. A nightmare for configuration. Is systemd going to read everyone elses config files to know what ports/interfaces a process should bind to? What about socket options? Does this mean we have to configure these things now in multiple places?
Nope, yes. But since you are already configuring this stuff in multiple places (server, clients), that should not be a big problem. (You really change default socket paths? Why?)
> 3. Pulseaudio's simplistic view of the world still gives me trouble and I can see the same thing happening here. e.g. He's plugged in a HDMI cable, he must what audio over that. No other option, period!!! Too bad my TV doesn't do HDMI audio.
Hmm, are you sure that's a pulseaudio problem? Something tells me that this is handled a bit lower, as in ALSA.
Posted May 27, 2010 6:03 UTC (Thu)
by drag (guest, #31333)
[Link]
Never used HDMI, though.
Posted May 27, 2010 7:04 UTC (Thu)
by dmk (guest, #50141)
[Link]
> Nope, yes. But since you are already configuring this stuff in multiple places (server, clients), that should not be a big problem. (You really change default socket paths? Why?)
Yes. Socket paths are movable. If you want to chroot something, you may need to change the socket path. And sometimes the packager gets it wrong for your setup.
So, in the new system you only need to adapt the socket description of systemd, and the daemon has to implement the hand over.
Cheers,
Posted May 28, 2010 17:39 UTC (Fri)
by tialaramex (subscriber, #21167)
[Link]
So Pulseaudio should probably have (if it doesn't already) a pref that lets you disable its hotplug audio sink behaviour.
(In the ideal world PA would be able to reliably determine that your TV can't play audio, and then ignore the hotplug events from HDMI for that TV, but we don't yet live in such an ideal world)
Posted May 31, 2010 17:03 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (2 responses)
2. No, systemd does not parse anybody else's config files. You can configure everything in systemd's .socket file, including sockopts.
3. Dude, you apparently never used PA. For example: if you have more than one audio device, then things are *way* nicer with PA than without it: you can move active streams between devices on-the-fly. That is pure hotness! HDMI on Linux is still messy and incomplete, but PA certainly plays the least role in that.
Please stop the FUDding!
Posted Jun 5, 2010 13:35 UTC (Sat)
by segedunum (guest, #60948)
[Link] (1 responses)
Heh. Did you think Linux was any kind of gaming platform before? It certainly isn't with the multi-second latencies we get with it, and any audio work is completely out of the window now. Don't give me any of that crap about that not being the right use cases either. The Mac manages it. Windows manages it. They're called desktops for a reason.
It's certainly been a nice way to finish desktop Linux off completely.
Posted Jun 8, 2010 7:12 UTC (Tue)
by michich (guest, #17902)
[Link]
Posted May 27, 2010 7:44 UTC (Thu)
by cyperpunks (subscriber, #39406)
[Link] (3 responses)
Posted May 27, 2010 8:49 UTC (Thu)
by neilbrown (subscriber, #359)
[Link] (1 responses)
Some versions of inetd will listen for RPC services (like ypbind or ypserv) and start the daemon only on demand.
It might be a bit tricky if portmap (or rpcbind) were started on demand. You would want to be able to feed it a list of programs/binding to be able to report immediately rather than waiting for them to be registered.
But it is certainly possible.
Posted May 31, 2010 17:06 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 31, 2010 17:05 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
Posted May 27, 2010 8:54 UTC (Thu)
by nim-nim (subscriber, #34454)
[Link] (4 responses)
Posted May 27, 2010 10:00 UTC (Thu)
by tzafrir (subscriber, #11501)
[Link] (3 responses)
Posted May 28, 2010 11:38 UTC (Fri)
by nim-nim (subscriber, #34454)
[Link] (2 responses)
The point is to have an init system able to instanciate existing j2ee servers (certifications, warts and all), either as a system-wide service (production j2ee server) or as per-user instances in the user session (j2ee server instance attached to user ide).
If rewriting with other tech was the answer we'd have java/.net/ruby/whatever OSes by now.
The value of a good init system is too be able to manage existing software gracefully.
Posted May 28, 2010 13:56 UTC (Fri)
by tzafrir (subscriber, #11501)
[Link] (1 responses)
Posted May 29, 2010 8:15 UTC (Sat)
by nim-nim (subscriber, #34454)
[Link]
You don't understand
People doing dev want their private daemon that is identical (ports excluded) to the one they will have system-wide in production
As soon as you start changing it so it does not behave like the system one you reduce the whole setup value.
Posted May 27, 2010 13:41 UTC (Thu)
by keybuk (guest, #18473)
[Link] (1 responses)
Upstart doesn't quite use the "traditional" post, as you say. I've tried to explain the difference in a blog post, which might also help explain the technical disagreement between myself and Lennart (at least, my side of it). Dependency-based & event-based init daemons and launchd
Posted May 31, 2010 17:40 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link]
First of all, you create the impression that systemds core design was about dependencies. Well, it is not. Dependencies are supported by systemd only for the purpose of early boot. Normal services should not really use that for much. One of the nice things in systemd is that the kernel will get the dependencies and ordering right for you, out of the box.
Also, it is misleading that the hw hotplug logic would only really make sense in an event-based systemd. But well, thats not true. It fits really nicely in a system that does dependencies: for example, there is a dependency between bluetooth dongle is plugged in and bluetoothd must be running. Systems that support dependencies can express that dependency explicitly, while event-based systems cannot.
Did you never get the idea that maybe nobody else is using your event-based design, because it is simply broken? (For the reasons I pointed out in my original blog story.)
Also, claiming that launchds or systemds core design was around on-demand loading of services is misleading. While we support that too, we do socket-based activation mostly to parellelize boot-up and to get rid of explicitly configured dependencies. Only a few services will actually be started on-demand in a systemd system. Most will be started in any case, but fully in parallel due to the socket activation logic.
Yes, systemd does both socket-based activation and dependencies. Manually configured dependencies are however only really needed for early boot-up or late shut-down and a few other cases. launchd does not support dependencies at all, for the price that their early boot-up is completely seperate from the starting of daemons, while in systemd this can be interleaved quite a bit.
OpenSUSE has already given up all Upstart experiments btw. Right now only Ubuntu uses Upstart fully, and Fedora and RHEL use it in sysv compatbility mode only.
And generally I think it would be nice to talk more about stuff Upstart has actually already accomplished, instead of great plans. In my postings about systemd I kept the part about my plans very short. Almost all features I talked about in my various postings can be listed under DONE, not under WILL BE DOING.
Note that systemd supports quite a few triggers for starting a service. And they can be combined in various ways. For example, we can start CUPS as a dependency of printer plugged in, as well as a dependency of client requests CUPS services, as well as theres a file in the CUPS spool dir. Its all implemented, and works fine. CUPS fits perfectly in the systemd model, as all its triggers are available already. If one of the conditions holds, CUPS is started. I dont see how the current Upstart could do anything like this
So, on this topic: systemd 1, upstart 0.
And finally, I dont think you have really understood launchd or systemd. The focus is on using socket-activation for parallelizing and getting rid of explicit dependencies. Its much less on on-demand loading.
Posted May 28, 2010 16:35 UTC (Fri)
by viro (subscriber, #7872)
[Link] (3 responses)
Perhaps the self-described dumb-ass folks wouldn't mind taking a look at the source and deciding if the implementation (and interface design) are too revolting to touch?
Moreover, if there is any piece of software that absolutely Must Not rely on optional kernel features, /sbin/init is it. It has to be able to run on any kernel, and survive things like kernel developer doing bisects jumping back and forth across the point where the damn thing had been added.
Damnit, people, has the mess with udev compatibility taught you nothing? If anything, init is worse than that; it is (thankfully) possible to run system without udev, not to mention dbus, hald and the rest of those turds. Doing that without working init is not possible. Sigh...
Posted May 30, 2010 10:48 UTC (Sun)
by man_ls (guest, #15091)
[Link]
Posted May 31, 2010 17:12 UTC (Mon)
by mezcalero (subscriber, #45103)
[Link] (1 responses)
And if cgroups are really so ugly, why didn't anybody point that out when it got merged? Seems you are criticising us for a failure of the kernel community in reviewing the cgroup code then. And that is unfair.
Well, and it is really a very kernel-developer-centric view of the world if you say that running kernels without sysfs or cgroups or stuff like that should work with every init system. But, first of all, kernel developers make up only a tiny fraction of our users, and they are the ones who should be able to pass "init=/bin/sh" to the kernel, to make the system boot up in any case. Also, nothing forces you to use systemd. You can always continue to run SysV init if that makes you happy.
And I fail to see that there was any mess with udev. Also, isn't it a bit unfair if you ask us to basically stop development of userspace where it was 10 years ago, just because you are unwilling to follow any new userspace development and find it boring and stupid in general?
Posted Jun 4, 2010 14:18 UTC (Fri)
by obi (guest, #5784)
[Link]
Just recently I got a message while upgrading saying udev >150 is incompatible with a kernel I was running, that had CONFIG_SYSFS_DEPRECATED compiled in. Now, it's not a huge deal, but udev and init are "special"; developers can collectively decide that using certain new features and conflicting with deprecated features is the right way forward, but I'd prefer people to thread carefully and would like this to happen rarely. With udev this happened a bit too often, and it has burned users in the past. The whole "upgrade udev in lock-step with your kernel" is a little... annoying.
That being said I do understand it's worth it sometimes.
Posted Jun 1, 2010 9:06 UTC (Tue)
by __alex (guest, #38036)
[Link] (4 responses)
Posted Jun 1, 2010 16:11 UTC (Tue)
by SEMW (guest, #52697)
[Link] (3 responses)
Posted Jun 1, 2010 16:18 UTC (Tue)
by __alex (guest, #38036)
[Link] (2 responses)
Posted Jun 1, 2010 17:55 UTC (Tue)
by anselm (subscriber, #2796)
[Link] (1 responses)
I don't worry about the boot times a great deal – even with the traditional init my machine boots a lot quicker these days than it used to.
So never mind the benchmarks; if systemd merely does the other things it is said to do, at upstart's or even Sys-V init's speed, that will be just fine by me, and I'd be happy to just skip over upstart, thank you very much.
Posted Jun 3, 2010 21:37 UTC (Thu)
by oak (guest, #2786)
[Link]
With Upstart one needs to modify the servers and have some extra code to communicate with these mods from the Upstart or its scripts. Or to have some trivial utility waiting & polling the server's socket availability before Upstart can fire the "started" event. If you don't have these with Upstart, your bootup process is fragile to timings issues.
That's the problem that systemd seems to be nicely solving. Doing the dependencies _correctly_ (based on server's service, not execution) with minimal modifications & complications required.
Posted Jul 7, 2010 21:28 UTC (Wed)
by nas (subscriber, #17)
[Link] (3 responses)
Posted Jul 13, 2010 8:40 UTC (Tue)
by smurf (subscriber, #17840)
[Link] (2 responses)
That's exactly what systemd does right now.
The kernel doesn't provide a mechanism to queue TCP SYN packets until the corresponding port gets opened. I don't think there should be. Either some process is listening on a port (you send a SYN+ACK back), or not (you send a REJ back).
Posted Jul 13, 2010 9:01 UTC (Tue)
by dlang (guest, #313)
[Link] (1 responses)
no, I don't remember the mechanism, but in the dial-up days I used diald extensively
Posted Jul 13, 2010 9:09 UTC (Tue)
by paulj (subscriber, #341)
[Link]
Posted Jul 27, 2010 21:20 UTC (Tue)
by sebikal (guest, #69267)
[Link] (3 responses)
Posted Jul 27, 2010 21:33 UTC (Tue)
by rahulsundaram (subscriber, #21946)
[Link] (1 responses)
Posted Jul 28, 2010 7:12 UTC (Wed)
by sebikal (guest, #69267)
[Link]
Posted Oct 21, 2010 8:17 UTC (Thu)
by sebikal (guest, #69267)
[Link]
thank you
The road forward for systemd
The road forward for systemd
Daemons do not need to be patched; they don't even need to be kept from forking. The use of the word "optimally" was intentional; if you want to use the launchd-inspired mechanism, you need a patched daemon.
Patching daemons
Patching daemons
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
* [x]inetd handles network sockets, systemd also handles unix sockets and file systems in exactly the same way.
* Unlike upstart, systemd does not solve the problem of automatically restarting services if they go down.
* There is no dependency checking when stopping services, so I can't make it so that when I restart postgres, my web service will be automatically restarted too. Your solution is to fix all services that can't gracefully handle downtime in their dependent services. Your rationale is that they will run into that problem when the services are on different machines in the future anyway.
* Enabling systemd support in a daemon can be a fair bit of work since it requires the ability for the daemon to take over an already open socket instead of creating a new one, but many popular daemons already support this because it's what launchd does too. A service that supports launchd can be trivially ported to systemd.
* If one does not convert a server to systemd init and opts to use the sysvinit compatibility layer, boot performance will be unchanged, but one will still get the increased service control of cgroups.
* If service A takes a long time to start, and service B needs A and has a short time out, problems will ensue. This is likely to happen when A is a name server. There is currently no fix for this in systemd, service B needs to be patched to become more patient.
* Socket location configuration is usually moved from service config into the systemd init file for the service, thus in the common case there is no duplication of information. An exception to this is with services that have both a client and server part running on the same system, and the server part is started by systemd. In these cases, the client side of the service will need to duplicate the socket information somewhere.
* Theoretically, there is nothing preventing upstart from using the same socket trick that systemd and launchd uses, but the existence of pre/post startup scripts would mean that some amount of serialisation would still happen.
The road forward for systemd
The road forward for systemd
Using sigchld certainly works, I think it's a good idea to have systemd be flexible on that. Counting a cgroup empty when it has non-empty sub-cgroups (the tty group still having a tty+user subgroup) might also do, if that's what you were getting at.
The road forward for systemd
The road forward for systemd
The road forward for systemd
As someone has pointed out, this is already implemented in (x)inetd. Yes systemd is more powerful but the concept is the same of inetd.
This will simplify also the adoption of systemd.
The road forward for systemd
The road forward for systemd
<cite>
The idea is actually even older than launchd. Prior to launchd the venerable inetd worked much like this: sockets were centrally created in a daemon that would start the actual service daemons passing the socket file descriptors during exec(). However the focus of inetd certainly wasn't local services, but Internet services (although later reimplementations supported AF_UNIX sockets, too). It also wasn't a tool to parallelize boot-up or even useful for getting implicit dependencies right.
</cite>
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
With Asus ExpressGate enabled (default) it takes 38 second from power on to grub...
Without EG it takes "only" 26...
The road forward for systemd
The road forward for systemd
The road forward for systemd
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
2. But I could be wrong, in which case, feel free to make fun of me :)
The road forward for systemd
The road forward for systemd
The "service" unit and the "socket" unit are what describes the interface to a daemon. Each socket description needs a matching service description.
Flo
The road forward for systemd
The road forward for systemd
B starts up until it reads from socket C (which blocks B).
Or both A and B block on socket C right now. In which case it would be roughly the same as starting all three in a row.
Except that A and B only block until C reads from it's socket. So there is a little bit time saving. But I don't think this is what systemd is about.
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
Why it's so hard to understand?
Either implicit dependencies are used, and you rely on socket activation, but you don't start daemons as early as they could be
Why it's so hard to understand?
I've had this discussion so many times and I still can't believe people are thinking like that. Guys, OR and XOR are different operations! Please open the logic textbook and read about difference between them! This is vital if you want to talk about systemd!
Either implicit dependencies are used, and you rely on socket activation, but you don't start daemons as early as they could be
("OR" != "XOR") == 1
but also
("XOR" == "Either..or") == 1
Why it's so hard to understand?
Wol
Why it's so hard to understand?
The road forward for systemd
The road forward for systemd
The road forward for systemd
Care to give an example of a service/daemon that is needed before something connects through a socket? One example was given already: ntpd. It needs to start synchronizing the system regardless of anyone asking for it. But generally this is not the common case.
Looking at the ones currently started on my server...
On my workstation:
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The novelity is in combination of ideas...
1. Start the systlog.
... 1 second passes ...
2. Start the dbus.
... 1 second passes ...
3. Start the avahi.
... 1 second passes ...
4. System is usable.
1. Start the avahi.
... 1 second passes...
2. dbus is requested and syslog is requested too - start them...
... 1 second passes...
3. System is usable.
1. Start avahi, dbus and syslogd.
... 1 second passes...
2. System is usableThe novelity is in combination of ideas...
> 1. Start the systlog.
> 2. Start the dbus.
> 3. Start the avahi.
> 4. System is usable.
1)Request avahi start
2)Start dbus and syslog as prerequisites
...1 sec passes
3) dbus and syslog are up, start avahi
...1 sec passes
4)System is usable
Right. 2 secs and no explicit dependency info needed.
> 1. Start avahi, dbus and syslogd.
> ... 1 second passes...
> 2. System is usable
> One of the things I thought is that systemd does NOT require explicit dependency information.[...]The novelity is in combination of ideas...
> So do we need to code in the explicit dependency information into the
> avahi.service config?
I was not sure because the initial blog post both seems to hint that explicit dependencies become redundant:
"Also, dependencies between services will no longer necessarily have to be configured to allow proper parallelized start-up" "...dependency management also becomes redundant..." "[In critique of upstart] So, instead of letting the computer figure out what to do based on the dependencies, the user has to manually translate the dependencies into simple event/action rules."
But it also says that it is possible:
"All these units can have dependencies between each other (both positive and negative, i.e. 'Requires' and 'Conflicts')" "11. systemd supports several kinds of dependencies between units. After/Before can be used to fix the ordering how units are activated. It is completely orthogonal to Requires and Wants,"
So would avahi explicitely specify dependencies on dbus and syslogd in its .service file? It seems it would. BTW, dependencies seem to be better explained in this mail explaining the dependency information in .service files:
http://lists.freedesktop.org/archives/systemd-devel/2010-May/000015.html
The novelity is in combination of ideas...
Dbus uses syslog too...
I agree with init, but doesn't upstart support parallel starting? So upstart might rather:
1)Request avahi start
2)Start dbus and syslog as prerequisites
...1 sec passes
3) dbus and syslog are up, start avahi
...1 sec passes
4)System is usable
Am I wrong here?So how does systemd knows that dbus and syslogd should be started at second 0 whwn avahi is supposed to go up?
My take on the inetd/systemd relationship is that systemd merges init concepts and inetd concepts. You could do things separately, with an inetd that supports unix domain sockets like xinetd, a user-level init like runit, and an optional dependency resolver to configure both (runit starts everything by default, the resolver would have to mask services that aren't explicitly needed at a given runlevel). It just wouldn't be very convenient. xinetd wasn't meant for services that can be activated on multiple sockets, or through d-bus activation. And neither xinetd nor runit support cgroups. On the other hand, a user-level systemd can replace xinetd and runit, or be a hybrid of both.
The road forward for systemd
For completeness of the UNIXy, modular approach: cgroup support could go into chpst.
The road forward for systemd
The road forward for systemd
The road forward for systemd
> which is not a recipe for high-performance servers.
> However, right from the beginning inetd also supported another mode,
> where a single daemon was spawned on the first connection, and that
> single instance would then go on and also accept the follow-up connections...
The road forward for systemd
The road forward for systemd
The road forward for systemd
2. after that is done, we start all daemons at the same time
3. and then, the kernel figures everything else out for us, for free
The road forward for systemd
The road forward for systemd
The road forward for systemd
listen(3p)
:int listen(int socket, int backlog);
Looking at the code... It uses SOMAXCONN by default (The road forward for systemd
src/socket.c:socket_init()
) and it allows overriding it in the config file with a Backlog=...
line (src/load-fragment.c
).
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
What parts of upstart depend on Linux and couldn't work e.g. on FreeBSD ?
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
It matters a load for me, and I am a Debian user and developer, so I find your sentence amusing.
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
Most of users _need_ NetworkManager to be started as soon as possible.
AFAICT, systemd should start NetworkManager sooner, because systemd won't wait for (e.g.) messagebus to finish starting before starting NetworkManager. If there are any other D-Bus-based services that NetworkManager requires (maybe wpa_supplicant?, sorry, my distro doesn't use NetworkManager, and all network interfaces come up very early, including WiFi ...), they will also be started in parallel.
This is covered in the blog post.
In essence, the goal is usually 'run everything ASAP' and not just 'run GNOME'.
Where do you see this goal of 'run GNOME'? It's certainly not in the systemd blog post ...
However, sometimes we DO need to delay some service (a good example is CUPS)
Quote from the blog post:
Same for a printing system: unless the machine physically is connected to a printer, or an application wants to print something, there is no need to run a printing daemon such as CUPS
Did you read the blog post?
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The answers are there, you just don't want to admit they are right answers...
I have an application which bombs out if BIND is not yet started (it needs a resolver to resolve host names when it reads its config). How do I mark this dependency?
Or another thing, with upstart I can specify that my another application depends on PostgreSQL. So there's no sense in running it if Postgres is not started or is disabled. I don't want it to be stuck forever waiting for connection.
Another painful area - stopping services.
I want my init system to correctly traverse and carefully deconstruct dependency graph. For example, I want my webapp to be stopped before PostgreSQL is stopped.
The answers are there, you just don't want to admit they are right answers...
It's all fixable...
Bombing out on unresolved hosts is a CORRECT behavior. Modifying the app so it can work with a certain init system is crazy.
So we still need to have explicit dependencies at least for SOME services.
And what if PostgreSQL is down because I'm upgrading it? Or maybe I don't want it to start for some reasons (like system recovery in progress, etc.)?
Why should it? I use a connection pool, but it doesn't keep inactive connections forever. So it might certainly be possible that the webapp doesn't have any active connections during shutdown.
Yes. That's why I hate shell scripting and systemd. They work in _most_ cases and can miserably fail in sometimes.
Upstart has an advantage of clean _explicit_ dependencies.
They can be analyzed (with the help of systemd!) and fixed if required. But they are _explicit_.
It's all fixable...
But is it correct and good approach? Obviously not - duplication of information is almost always bad because copies grow apart over time. Sometimes it's needed for performance reason, but I'm not seeing such need with regard to systemd...
It's all fixable...
The answers are there, you just don't want to admit they are right answers...
Bombing out on unresolved hosts is a CORRECT behavior.
Depends on the app, and you haven't described it. Maybe it should be restarted when bind restarts, but then ... why does name resolution depend on a local DNS server? openvpn keeps retrying when it can't resolve, and that works just fine for me. When I have connectivity, it starts, when I don't it just retries every one in a while.
Why should it? I use a connection pool, but it doesn't keep inactive connections forever. So it might certainly be possible that the webapp doesn't have any active connections during shutdown.
If there aren't any active connections, there is no harm in shutting Postgresql down at the same time you shut down the web app.
Upstart has an advantage of clean _explicit_ dependencies. They can be analyzed (with the help of systemd!) and fixed if required. But they are _explicit_.
Note that earlier dependency-based init systems also have explicit dependencies. For example, Mandriva has used prcsys (since about 2004), which uses LSB-headers for dependency information. Funnily enough, so does systemd. Quoting from the blog post:
"Note that we make use of the dependency information from the LSB init script headers, and translate those into native systemd dependencies. Side note: Upstart is unable to harvest and make use of that information."
Did you read the blog post?
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
why does name resolution depend on a local DNS server? openvpn keeps retrying when it can't resolve, and that works just fine for me. When I have connectivity, it starts, when I don't it just retries every one in a while.
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
Annoying time based fsck
This means you have 2 distinct time-jumps. The first one is to avoid the annoyingly bad fsck times when a filesystem is 480+ days out of fsck ( right.)
tune2fs -i 0 /dev/sdaX
to disable the time based fsck.
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The answers are there, you just don't want to admit they are right answers...
The road forward for systemd
What makes you think I haven't read it? Care to point me to a place where it says something about network, for example?
Search for "AF_INET" or "IP " in the blog post.
The road forward for systemd
The road forward for systemd
There has been a solution [1] for this for a while: ip_nonlocal_bind enables binding to a specific address that is (temporarily) unavailable. Of course, it has nothing to do with systemd, but neither has this problem. ;-)
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
So In my opinion it was not insulting. It *is* a long read, so maybe you just need to read it a couple of times to grasp it completely (I had to).
The road forward for systemd
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
nameserver 127.0.0.1
>How do I mark this dependency?
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
> 2. socket: this unit encapsulates a socket in the file-system or on the Internet. We currently support AF_INET, AF_INET6, AF_UNIX sockets of the types stream, datagram, and sequential packet. We also support classic FIFOs as transport. Each socket unit has a matching service unit, that is started if the first connection comes in on the socket or FIFO. Example nscd.socket starts nscd.service on an incoming connection.
So AF_INET6 == Network Socket for IPv6
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
Novel concepts do that: they screw your mind and make you resist the new idea, but in the end they often become the established truth (not with djb though).
Too novel
Too novel
Wol
The road forward for systemd
The road forward for systemd
I'm particularly thinking of 'md' arrays as the device to be mounted. The trend is to assemble these via udev - as soon as enough devices have appeared the array appears.
SJR discusses Upstart
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
But I also don't think this is a new problem with systemd. The section "Putting it All Together: systemd" of "The Blog Post" (*g*) illustrates a little bit, how the service description works. Instead of having a startup script, you have a socket description and a service description. At startup all sockets are created and as soon as the socket is accessed the corresponding service is started and the socket is handed to the service.
It seems, this gets easier?
Flo
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
Should a getent call trigger ypbind to start?
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
> don't use it, this is only here so that you don't use it. Thanks!" Maybe then
> dumb-ass folks like me will notice and refrain from using it.
In two or three years this point will be moot: all kernels without this feature will be considered ancient history (like, say, 2.6.25 now). If you are designing a next-generation init system you should certainly be able to rely on anything already included in future kernels.
cgroups for dummies
The road forward for systemd
The road forward for systemd
The road forward for systemd
If you find the explanation in the article inadequate ("Sorry, no bootcharts or hard data on start-up times for the moment. We'll publish that as soon as we have fully parallelized all services from the default Fedora install. Then, we'll welcome you to benchmark the systemd approach, and provide our own benchmark data as well"), you might get farther by posting your actual problem with it. Just rhetorically asking "Where are the benchmarks?" might mislead people into wrongly thinking that you just hadn't read the article.
The road forward for systemd
The road forward for systemd
The road forward for systemd
The road forward for systemd
It seems to me that a better solution would be for the kernel to provide explicit support for this model. To be sure, it would require some serious work to get the interface correct. I'm thinking of something similar to udev. Perhaps a user space program could register its interest in a certain events (e.g. connection to a certain port) and take appropriate actions (e.g. start a daemon).
Better kernel support
Perhaps a user space program could register its interest in a certain events (e.g. connection to a certain port) and take appropriate actions (e.g. start a daemon). Better kernel support
Better kernel support
Better kernel support
The road forward for systemd
I've been trying out systemd for a few days and seem to have a bit of an issue. The way I've installed it is using a Fedora core 13 installation, then "yum install fedora-release-rawhide" then installed fc-14 systemd with yum. I'm booting the system using kernel boot args "init=/bin/systemd systemd.default=multi-user.target". The first time I did this I was unable to log in the system (not even through virtual consoles). To get past this, I issued "chcon -t init_exec_t /bin/systemd" and that fixed the login issue. However, sshd starting per connection basis is not working. Systemd is not starting sshd when I try to connect through ssh. Initially, I did not have any of the sshd.service, sshd@.service nor sshd.socket files. Shouldn't they have been installed by the systemd-units rpm package? Then, I copied them over from http://0pointer.de/public/systemd-units/ but to no avail. I first need to manually start sshd in order to connect with ssh. Any ideas?
The road forward for systemd
The road forward for systemd
The road forward for systemd
When trying to connect to the ssh server, systemd spits out a "function not implemented" message. Any thought on this?