I am a Linux user, but I don’t really know how most things work, even after years of casual use on my Main, I just started getting into Devuan and wondered then, what exacly does systemd do that most distros have it? What even is init freedom? And why should I care?

81 points

Systemd is the first program that runs once the kernel has started. It’s job is mostly just starting up other processes, and managing those other processes. If you don’t know what systemd is, then you probably shouldn’t care about if you’re using it or not, it’s good software but there are fine alternatives.

What makes systemd particularly interesting is that it is different from historical init systems. Historically these init systems were an unholy mess of shell scripts. This offers maximum flexibility, but limits the functionality of the init system itself. Systemd replaces these shell scripts with simple ini-like service files that allow everything to be declared simply and declaratively, and allows specifying more rich metadata, like dependencies. But it’s different, and some people place a higher value on “how it’s always been” than pragmatism. I personally have zero sympathy for them because throwing out objective progress to hold onto a broken system designed for 1960s computing is just dumb.

permalink
report
reply
27 points

throwing out objective progress to hold onto a broken system designed for 1960s computing is just dumb

Preach.

permalink
report
parent
reply
5 points
*

I was with you until the last paragraph. Just about every init system is different from historical init systems. Do you really think OpenRC or runit or any of the other init systems people are using have any similarity to SysV init? I think you’re attacking a strawman in the last paragraph. (Edit: Except Slackware users. Slackware still does init the way it’s traditionally been done, but I can’t think of anyone else who does)

permalink
report
parent
reply
3 points
*

Do you really think OpenRC or runit or any of the other init systems people are using have any similarity to SysV init?

Yes? OpenRC is certainly much closer to sysvinit than systemd and in many ways just expands upon it.

permalink
report
parent
reply
4 points

I thought people hate systemd because it’s a resource hog compared to OpenRC. TIL i guess

permalink
report
parent
reply
3 points

Solid answer.

permalink
report
parent
reply
21 points
*

You are asking the wrong question, my friend. You should be asking what doesn’t systemd do?

permalink
report
reply
11 points

permalink
report
reply
11 points

Once the kernel has loaded itself, it needs to start up userspace as well. This is usually (perhaps exclusively) done by starting an ‘init’ program as process number 1, which then starts up all the other userspace programs: systemd is no different in that regard. It solves a variety of problems that traditional inits have, though:

  • rather than having near-incomprehensible shell scripts to start, stop, etc. all your programmes and services, it uses INI-style service files which are merely fiddly. They’re kept in a few logical places, not ‘everywhere’

  • starting and stopping services is done with simple, consistent commands - systemctl enable tomcat will start the Tomcat webserver at next boot; start, restart, stop and disable do basically what you think. Shell scripts are… less predictable, especially between distros.

  • rather than having to inspect all of your scripts and work out what order they start in, SystemD just lets you declare what they depend on, and it works it out for you - much simpler, much more robust.

  • rather than needing a separate tool to manage scheduled events (usually a chron-like, like anachron), SystemD just lets you write a ‘timer’ with the same syntax as its service files. They can be set to only trigger based on other events, like start-up, so you can do once-an-hour database snapshots (but only if the DB is running) very easily. That’s painful with traditional inits.

  • also manages disk and network mounts, so you don’t need a separate tool for those, and you can trigger other events off of them as well. That was also painful in older inits.

  • and power events too, if you want to trigger other tasks before sleep or when your laptop wakes up. (Again, was painful before.)

  • log files all in one place and controlled in the same way and accessed with one tool - again, traditional inits aren’t like that.

  • (advanced usages) works well with cgroups, so if you’re looking to limit the CPU time on a web service and make sure that it only uses its share of memory, that’s dead easy. Very difficult with traditional init.

You can get a reasonable idea of what systemd is doing with a systemctl status at the command line; shows you the overall system status, with a nice tree view of what’s running and what caused it to start. Getting that kind of overview on a eg. SysV init is much less simple.

Administrators and devops generally love it; it’s very simple and straightforward and consistent and predictable. Certain devs dislike it, due to the original author, or feelings of overreach and complexity (although it’s much simpler than learning everything that it replaces), or because they’re attached to Bash scripts. (You can trigger Bash scripts with SystemD if you like, but they’re not ‘in control’.)

permalink
report
reply
10 points

What exactly does systemd do?

Too much.

permalink
report
reply
9 points

But makes your life easier, especially when you’re a noob.

permalink
report
parent
reply
1 point

Easier compared to what? Easier compared to sysvinit, of course. Easier compared to all the other alternatives? Six of one, half a dozen of the other, on balance, I would say.

But SystemD has inertia behind it now. If you run into problems, there are probably 1e10 web pages out there that will help you fix it. That’s why Debian solidified on SystemD: not because it’s any better than any of the others, but because it’s the same as everybody else.

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 43

    Monthly active users

  • 3.3K

    Posts

  • 19K

    Comments