11 ms·
Systemd takes a reliable, known, thoroughly debugged process (init, or various of its tweaks, including Ubuntu's upstart and Debian's insserv), and converts boo
by dredmorbius 14y ago
Systemd takes a reliable, known, thoroughly debugged process (init, or various of its tweaks, including Ubuntu's upstart and Debian's insserv), and converts booting from a deterministic, predictable process to one that's inherently unpredictable.
And the stated objective? "To reduce boot times".
The best way to reduce boot times is to not boot. The reason I reboot systems is to return them to a known good state (or, very rarely, to perform a kernel upgrade).
On server hardware, I perform boots infrequently, and really, really, really want them to work right.
On end-user hardware, I perform boots infrequently, preferring to use suspend/restore to quiesce my systems (suspend to RAM, occasionally suspend to disk). That is a process which I'd like to have very thoroughly debugged and not give me any unhappy surprises (say: crash my video, e.g.: interactive session, lose track of drivers/hardware, especially wireless).
Systemd is the wrong answer to the wrong problem.
Much written better than I can:
http://blog.mywarwithentropy.com/2010/10/upstart-better-init-or-more-painful-one.html http://blog.mywarwithentropy.com/2010/10/upstart-better-init...
Systemd loses the huge transitivity of shell scripting, and puts you in the position of needing to acquire a novel skill at the one time you least need to be learning and most need to be applying: when your systems won't boot straight:
https://lwn.net/Articles/494711/ https://lwn.net/Articles/494711/
I'm also not much surprised that Red Hat, who've had such a historic problem with consistency and reliable dependency management within their packaging system (as compared to Debian/Ubuntu) are proponents of this technology (hint: it's not the package format, it's the policy, or lack thereof). And now Arch.
- adestefan 14y ago> Systemd loses the huge transitivity of shell scripting, and puts you in the position of needing to acquire a novel skill at the one time you least need to be learning and most need to be applying: when your systems won't boot straight: What about those that can't debug when a shell script breaks? Your answer is going to be that they have no business administering a server where a shell script is an integral part of the system working. Conversely, someone that can't debug when a system can't start that uses systemd has no business administering a server where systemd is an integral part of the system working. If your system uses systemd, then you're going to need to learn a new tool. Get used to it.
- ori_b 14y ago> What about those that can't debug when a shell script breaks? Are they more able to debug when a systemd setup breaks? If not, it seems like a moot point to bring up. They're hosed either way. Although I do have to say, I like the systemd model. The use of sockets to do process activation and thus doing away with almost all of the need for dependency management is pretty cool. I haven't used it enough to pass judgement, but the concept has the potential to be a good deal simpler than the init hackery we have now.
- masterzora 14y agoHow is it a moot point? If you are equally unable to debug it either way then dredmorbius' original argument about the failure point being a bad time to learn to debug is completely meaningless. The point is that either way you're going to have to learn how to fix problems before they happen but dredmorbius is complaining because ey just happens to already know how to debug one form.
- mseepgood 14y ago> Are they more able to debug when a systemd setup breaks? Yes, because no programming skills are necessary for editing systemd unit files.
- dredmorbius 14y agoIf they can't debug it, they can find someone who can, and that skillset is, I can guarantee you, going to be far more widely available than Systemd debugging fu. On which point, specifically: when Debian breaks during initrd execution, the system is dumped to a shell, "dash", a POSIX-compliant shell. It doesn't have all the niceties of bash, but it's usable. When a Red Hat system breaks during initrd execution, the system shell doesn't handle terminal IO. You literally can't even fucking talk to the damned thing. It's a scripting-only shell. The kicker: the RHEL initrd shell is larger than dash. Guess which of these two systems is easier to troubleshoot / debug / rescue in a pinch?
- dfc 14y ago
- FooBarWidget 14y agoI'm sorry, but shell scripts suck as a language for booting the system. You need to fork() and exec() for almost anything non-trivial, wasting precious CPU cycles in the progress. It looks like every Linux distro has its own way to manage boot scripts. And when they fail, you have no idea what happened. More importantly, init only handles starting and stopping of services. They don't manage services, like restarting them when they crash. Systemd can do that. The socket activation stuff also allows one to potentially save resources by not starting services until they're really needed. The best way to reduce boot times is to not boot? Have you ever heard of "laptops" and "average users"? Even on my servers, a shorter boot time is welcome.
- dredmorbius 14y agoExactly how precious are those CPU cycles? I mean, really. Can you put a dollar figure on them? And then contrast that with the dollar figure for consultant / employee / remote hands time to figure out WTF went wrong? There are numerous systems for managing services: monit is the best known, mon and several proprietary systems also exist. Nagios can tell you if the service is running or not (though it doesn't handle the start/stop logic). These are small details and extensions on top of the existing SysV init foundation. Ubuntu's boot time is already down to 8.6 seconds -- a restore from suspend is barely less than that (and restore from disk is considerably longer), though both restores preserve user state. You know, what applications / files you had open, and what was in them when you left off, positions of windows on your desktop. All that jazz. http://www.jamesward.com/2010/09/08/ubuntu-10-10-boots-in-8-6-seconds/ http://www.jamesward.com/2010/09/08/ubuntu-10-10-boots-in-8-... The socket management is kind of nifty, but doesn't add a whole lot that xinetd didn't already offer (systemd does allow multi-socket services and d-bus-initiated services). I'm not convinced these couldn't be hacked into xinetd while preserving the simplicity and stability of init. My desktop state (and its preservation) is worth a lot more than fast boot. Yes. I've heard of inane gratuitous questions. As I said: if you're forcing average users to reboot with any frequency, you're Doing It Wrong.
- jaylevitt 14y agoNo, monit doesn't manage services. Monit tries to follow clues you've given it about what's running, it polls them once in a while, and if something appears to be not running (as measured by the instructions you've given it), it runs the one-liner you've given it that should start the thing up again. Monit does a thing that approximates managing a process, for certain values of "approximates", "managing", and "process". Supervisory process management is one of Linux's absolute weakest points. I cut my teeth on fault-tolerant HA minicomputers, and it pains me to think that 30 years later, we still don't have a way to say "make sure apache is always running. period." As a great blog pointed out, there is exactly one process that KNOWS when a service has stopped running, and it doesn't need .pid files or polling or anything else to tell it: process 1. I'm not a systemd advocate - I don't know enough about it, and we're using Ubuntu so I'll end up learning upstart anyway - but read this, it's way more eloquent that I can be: http://dustin.github.com/2010/02/28/running-processes.html http://dustin.github.com/2010/02/28/running-processes.html
- throwaway54-762 14y agoYour "much written better than I can" article is about Upstart, not Systemd. They're unrelated init daemons, and it seems like many of the complaints in the article relate specifically to upstart (event-triggered services with no dependencies, minimal scripting support, killing daemons, not all daemons managable by upstart) but do NOT apply to systemd. Systemd has service dependencies, support for old-style init scripts, and can stop daemons with arbitrary commands. Are you confusing the two init systems? On the other hand, this would be nice: "There is no tool that will print out a dependency map." It's also pretty trivial to implement with a little shell script and graphviz.
- dredmorbius 14y agoPoint. I'd linked that off another discussion I'd had some months ago and failed to re-read it with full_comprehension bit set.
- fmoralesc 14y ago> There is no tool that will print out a dependency map. systemctl dot | dot -Tsvg > systemd.svg
- dredmorbius 14y agoAnd the article I had in mind to post: Juliusz Chroboczek: A few observations about systemd http://lwn.net/Articles/453004/ http://lwn.net/Articles/453004/ Editorial / discussion at LWN: http://lwn.net/Articles/452865/ http://lwn.net/Articles/452865/ And for the record: I'm not particularly much a fan of upstart, but it annoys me somewhat less than systemd.
- sciurus 14y agoYou're going to bash systemd but give a pass to upstart? Give me a break. Upstart is just as radical a departure from SysV init as systemd is, but the documentation (and IMHO, features) is much poorer. As far as I can see your arguments are 1) you boot your systems infrequently, so any work in that area isn't valuable 2) socket-based activation is somehow not predictable 3) you're familiar with shell scripting, so a change that replaces shell scripting with something else must be bad. 4) and then you thow in some unclear Red Hat FUD for no apparent reason. None of those sound convicing to me.
- dredmorbius 14y agoHow often do you reboot your systems? What is giving rise to the need to reboot them when you do?
- hollerith 14y agoMy computer changes location at least twice a week as I commute between my place and my girlfriend's place. A Mac mini serves my needs very well because (including AC adapter) it weighs only 2.7 pounds, and I really appreciate having more ports than most laptops have and not having to pay for and carry around a bad keyboard and a laptop display. (I consider all laptop keyboards bad keyboards, and -- maybe because I am "far-sighted" -- much prefer my girlfriend's 32-inch TV to any laptop display.) But since the Mac mini does not have a battery, S3 sleep mode does not survive unplugging the device. And since suspend-to-disk is not supported by the OS I run, shutting down is the only option. P.S., I would have preferred something like a Mac mini, but with a small battery that powers S3 sleep mode. Sadly, I could not find anything like that on the market. P.P.S., I run OS X on it. If I were to switch to Linux, would suspend-to-disk work reliably?
- dredmorbius 14y agoWell ... you're not running Linux, so systemd is moot (you've got launchd instead, which has certain similarities). I'm a fan of small form-factor systems, though I suspect we'll start seeing these as G3 tablets (where the iPad was G1, and the current Android-and-others are G2). Which is to say, devices with integrated display and battery, to which other peripherals may be attached (physically or wirelessly, say, by Bluetooth). That said, we're not there yet. And yes, small form-factor PCs (CPU, no battery, no display) are pretty slick. I'm something of a fan of the FitPC offerings: http://www.fit-pc.com/web/purchase/order-direct-fit-pc3/ http://www.fit-pc.com/web/purchase/order-direct-fit-pc3/ (Googling "small form factor" will show you numerous other vendors). I used a similar configuration under Linux for a time, and as of mid 2000s, found suspend-to-disk worked pretty reliably, though not perfectly. In the past 4-5 years on laptops and desktops, I've had very few problems, mostly traceable to display drivers.
- antihero 14y agoExcept in practise, systemd works fantastically and you're all worried about nothing. Systemd also does much more than that and handles stuff like daemonization and socket creation, so that these things don't need to be re-implemented in every program that requires them. Bash scripts are overly verbose, repetitive, and awkward in comparison to unit files. And you can always use sysvinit if you still aren't convinced, just Arch will be optimised for systemd.
- caf 14y ago...except that those things do still need to be re-implemented in every program that requires them, since most POSIXy programs are portable to more than just systems using systemd.
- yew 14y agoThis being my primary problem with the current upheaval in Linux system organization. Its instigators have mostly made it clear that they consider everything not Linux (or possibly preferably not their favorite flavor thereof) to be obsolete - throwing portability out the window. Frankly, it's getting old.
- bkor 14y agoI fail to see the problem. Either something is portable, or something is not. It is basically up to the developer. If not being portable means way less time spent on development, then some people might choose that. Good for them.
- pjmlp 14y agoYeah, but then when developers in other OS besides GNU/Linux take the same attitude, they get bashed to death for not caring about portable software.
- gillianseed 14y ago
- zik 14y agoI work on embedded linux boxes in vehicles and boot times are hugely important to us. The time from when someone turns on their car ignition to the time when our box is usable is critical. I understand that this feature isn't important to dredmorbius, but to some of us this type of improvement is fantastic.
- dredmorbius 14y agoAny reason you can't just sleep/suspend your system at ignition-off? I can see that there might be times when the system does go down hard and you've got no option but to reboot, but still, that should be rare. I work with a fair number of embedded systems myself. Most avoid full boots where possible.
- ansible 14y agoDepending on the app, sleep may be possible. But for some apps, like automotive, it is not surprising to see requirements like current draw being less than one milliamp in the sleep state. I haven't seen or heard of any embedded apps which hibernate to flash. That would not be terribly fast, and would wear out the flash quickly.
- dredmorbius 14y agoThat could raise some interesting engineering/maintenance considerations. A local capacitor might provide the latent power to support sleep state. Or you could provision flash with enough ECC and reserve capacity (a 16 GB microSD drive fits on my pinkie nail) to survive years. Might even make swapping the storage a regular maintenance item, say 5-year cycle. Figure a high-end duty-cycle of 10 starts/day, 365 days/year -- that's 3650 read/write cycles a year. Even if that's a 100x low estimate, we're talking 365,000 cycles/year (that's assuming 1000 starts/day). As of 2003, AMD were discussing 1,000,000 cycle lifetimes for flash storage: http://www.spansion.com/Support/Application%20Notes/AMD%20DL160%20and%20DL320%20Series%20Flash-%20New%20Densities,%20New%20Features.pdf http://www.spansion.com/Support/Application%20Notes/AMD%20DL... Actually, in five years, controller technology would likely advance enough that, provided your unit production count is high enough, you'd just swap the entire controller for a new component with enhanced capabilities.
- leif 14y agoShell scripts are awful for boot. They have no expression of a dependency graph and truly pathetic notions of state. Hell, starting a process in the background takes ACTUAL THOUGHT in a shell script. How insane is that? systemd may not be as thoroughly tested but at least it's designed thoughtfully and will eventually be more reliable. For now, let it be relegated to arch and let them test it. What are you even doing with arch on a server anyway?
- onedognight 14y ago> For now, let it be relegated to arch and let them test it. FWIW, Fedora moved to systemd a year or so ago.
- dredmorbius 14y agoinssrv adds the dependency graph you're looking for. Standard on wheezy. Allows for parallel launch of services. I'll spend more time in hardware init (especially on servers) and fsck (even just journal replays) than service startups for most part. Even my servers (minimal services starting) take a while to come live, mostly due to the actual workload stack coming up. Then caches get to warm up and all that jazz. Boot time is still a very small part of this.
- jpiasetz 14y agoIs any of this really an argument against Arch adopting it? Arch and Gentoo and all the other rolling distros are the cowboy distros (I run Arch on my laptop). Literally anything can break with an update on Arch. Is Arch not the best place to try new ideas and see if they work out with a bunch of fairly technical users? I'm not about to switch all my servers to it but I'm more then willing to play around with it on my laptop.
- franzus 14y ago> Literally anything can break with an update on Arch. I can confirm that. After the 3rd time such a thing happened to me I switched to Ubuntu. Arch is a testing bed for people who like screwing around with Linux. Nothing against that but from time to time I'd like to be able to do actual work on my workstation :)
- lmm 14y agoJust for the record, if you leave keywords at its default setting rather than ~arch you can run a perfectly stable system under Gentoo.
- comex 14y agoAs an OS X, and thus launchd user... I think you guys are crazy! :) For launchd, the service description is a few declarative entries: on OS X, ssh.plist is 37 lines, but only because XML plists are really verbose; it could be half that in a saner format. On my Debian system, /etc/init.d/ssh is 167 lines of almost entirely boilerplate shell script that has to be maintained separately for each service (and that isn't even enough to make the script standalone; it invokes the 1400 line start-stop-daemon). The only thing simpler about SysV init is that it's the legacy everything is compatible with: the simplicity of shell scripts doesn't hold up when you need over 100 lines for a simple daemon. launchd itself is many thousands of lines of code (too much?), but it provides cron and inetd-like services (i.e. generalized on-demand services - it is really nice to know that a daemon has zero effect on my system, no pages that had to be loaded from disk, when it's not being used, but still operates efficiently when it comes under load; this also makes the implementation for the daemon simpler in some cases), as well as automatic process termination/restarting. Its service-on-demand focused dependency model is nondeterministic in the same way that systemd is (?), but it's completely reliable, since it's standard by now so everything is designed to work with it. Of course I usually use suspend and restore, but making rebooting really fast makes the system more fun to use. And yes, I'm talking about launchd, not systemd, but from what I've heard systemd is pretty similar in design and goals.
- papsosouid 14y ago>On my Debian system, /etc/init.d/ssh is 167 lines of almost entirely boilerplate shell script that has to be maintained separately for each service That's a failure on debian's part, not a fundamental flaw of init. Guess what the equivalent looks like on openbsd? daemon="/usr/sbin/sshd" . /etc/rc.d/rc.subr rc_cmd $1
- lloeki 14y ago> And the stated objective? "To reduce boot times". boot times is only the third point mentioned: Systemd has a overall better design than SysV, lots of useful administrative features and provide quicker boot up
- CJefferson 14y agoWhile I understand why you don't want to boot all the time, some of us do. Here are some reasons: * Despite years of work on it, I find sleeping on laptops on linux is still flakey. My Thinkpad T420s failed to wake up about once a week (on Ubuntu), so I tend to shut down. * I like having a clean desktop when I start on a morning. If I keep sleeping my machine, I just tend to gather up programs. Of course, you could argue I should get more sorted, but I don't really want to. * One other problem you have is to do with Linux being used on both servers and desktops. I can see your problem. Personally, if my machine ever got in such a mess that they couldn't boot, I'd just reinstall, regardless of what had broken. I suspect most people are the same. However, I can understand if you want to be able to edit how your machine starts up, and fix it when it brakes.
- dredmorbius 14y ago1: File a bug report. As I said: if you want faster boots, boot less. We should be fixing problems (like hibernate/restore flakiness) that cause people to reboot. Or long-term power draw that requires embedded devices to require poweroff. Or flash read/write duty cycle limitations that limit the ability of embedded devices to save state / the rate at which they can save/restore data. Etc. 2. You can bounce your X session. No need to reboot the full box (me? I prefer saved state). 3. My servers may be anywhere from several feet from me (stuffed into a closet with limited access and a crap POS keyboard and monitor) to tens to thousands of miles away. With varying values of ILOM / remote hands / virtual media support. "Reinstall" isn't generally a highly tenable operation. Being able to handle issues without having to dedicate one or more staff days to travel and unavailability for other tasks really sucks productivity down.
- bkor 14y agoDependency problems on Red Hat? News to me, and I admin various RHEL servers. I do know that there were issues maybe 10+ years ago. Bringing things up that were solved 10+ years ago is a bit pointless. Also regarding your systemd summary is inaccurate. You give the impression you just don't like Red Hat, because you don't really say anything concrete about systemd aside from some very generic remarks.
- nodata 14y ago> I'm also not much surprised that Red Hat, who've had such a historic problem with consistency and reliable dependency management within their packaging system (as compared to Debian/Ubuntu) Yawn this again. Give an example please.
- VMG 14y agodevelopers boot more often than normal users
- dredmorbius 14y agoI've been through phases where I've done frequent reboots. As noted above, hardware POSTs are usually the bulk of the cycle. There used to be other annoyances (Sendmail's 2-3 minute timeout on non-networked hosts was a real PITA). Now it's other stuff. With chef and automated system management, repeat 'apt-get update' runs, which even with local caches and other tricks give about 120-150s per startup.
- bdunbar 14y agoOn server hardware, I perform boots infrequently, and really, really, really want them to work right. My philosophy is different. Make a change to a server, reboot. The goal is to eliminate surprises if the server is restarted unexpectedly. I'd rather have them during the maintenance window than at 03:30 after a power outage. Anyway - to systemd. I was appalled when we moved up to Solaris 10 and the SMF facility started to replace init scripts. It felt wrong. I adapted. It's not wrong, it's just different. Better in some respects: you can still use bash scripts, but you have better control over them, a standardized way of managing things. Now we're abandoning Solaris for Linux and ... I'm appalled that 'linux' default method is still .. init scripts. And a hodge-podge of stuff like djb, systemd, etc, all with competing fan boys and advocates.
- dredmorbius 14y agoI'm a big fan of knowing my systems will initialize properly as well. AT&T ran into a little restart issue, as I recall, in 1990 when a software upgrade gone wrong crashed much of the phone network. Among the problems were that most of the switches had been upgraded in place, many over decades, and there had never been a cold-boot restart. There was some uncertainty as to whether the system would start up properly or not. While long uptimes are nice, I generally prefer seeing a few reboots annually just to be sure things will come up right. There's a balance between "restart for every change" and "restart regularly enough to not be surprised at 3am". http://catless.ncl.ac.uk/Risks/9.62.html#subj2 http://catless.ncl.ac.uk/Risks/9.62.html#subj2