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?

  • bamboo@lemm.ee
    ·
    1 year ago

    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.

    • teft@startrek.website
      ·
      1 year ago

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

      Preach.

    • duncesplayed@lemmy.one
      ·
      edit-2
      1 year ago

      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)

      • Deathcrow@lemmy.ml
        ·
        edit-2
        1 year ago

        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.

  • jman6495@lemmy.ml
    ·
    edit-2
    1 year ago

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

  • addie@feddit.uk
    ·
    1 year ago

    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'.)

      • duncesplayed@lemmy.one
        ·
        1 year ago

        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.

  • thisbenzingring@lemmy.sdf.org
    ·
    1 year ago

    In a very basic description, systemd is your system schedule agent. It's the component that kicks things off in order so all the vital parts start in order so they have the other parts in place before they load.

    It's reputation is muddy because it's doing more than a single task and old fashioned thinking is that system components should only do one thing. It's easier to configure but harder to understand than the older init

  • s_s@lemmy.one
    ·
    1 year ago

    Linux is based on unix, which was an operating system designed to run on computers like the PDP-11 of the 1970s.

    The problem is that computers have changed a lot, and Richie and Thompson couldn't perfectly forecast all those changes. Most notably, it predates the internet.

    Anyways, computers changed and so systemd was invented to copy MacOS Tiger's launchd service model. Here's the only video you need to watch on the subject

  • jollyrogue@lemmy.ml
    ·
    1 year ago

    Why should you care? Tech diversity is good, and people can try out different approaches. Aside from that, there’s not a reason. Systemd is a really good desktop init.

    What is init freedom? It means the init system can be changed without other software breaking because there is a dependency on some functionality of the init. In this case, a dependency on systemd. Although it’s probably a dependency on a subproject under the systemd umbrella rather then systemd itself.

    Why systemd? It’s tailored to weirdnesses in the Linux kernel. The Linux kernel isn’t perfect, and it’s user land isn’t tied to the kernel. Systemd is a shim which papers over the oddities. I don’t remember which oddities, but they’re there and people ignore them.

    Were there dumb decisions made? Yes, especially for the server side. I should test out some other inits for servers, but it ultimately works fine.

  • Synthead@lemmy.ml
    ·
    edit-2
    1 year ago

    From man systemd:

    DESCRIPTION
           systemd is a system and service manager for Linux operating systems. When run as first process on boot
           (as PID 1), it acts as init system that brings up and maintains userspace services. Separate instances
           are started for logged-in users to start their services.
    
           systemd is usually not invoked directly by the user, but is installed as the /sbin/init symlink and
           started during early boot. The user manager instances are started automatically through the
           user@.service(5) service.
    
           For compatibility with SysV, if the binary is called as init and is not the first process on the
           machine (PID is not 1), it will execute telinit and pass all command line arguments unmodified. That
           means init and telinit are mostly equivalent when invoked from normal login sessions. See telinit(8)
           for more information.
    
           When run as a system instance, systemd interprets the configuration file system.conf and the files in
           system.conf.d directories; when run as a user instance, systemd interprets the configuration file
           user.conf and the files in user.conf.d directories. See systemd-system.conf(5) for more information.