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?

  • jsveiga@sh.itjust.works
    link
    fedilink
    arrow-up
    30
    arrow-down
    4
    ·
    edit-2
    1 year ago

    What does exactly systemd do?

    It mostly causes heated discussions and a feeling of nostalgia for simpler times.

    When your computer finishes loading the kernel, you have to tell it what to do next. There are dozens of systems and services that have to run (once or keep running) for everything to work. Mounting your disk partitions, bringing the networking up, starting the GUI, initializing all kinds of services, etc.

    Once upon a time most (all?) distros used sysVinit, adapted from Unix’s System V to do that. It was simple and very easy to understand and setup: Very basically the init program would call scripts by alphanumerical order (passing “start” to scripts starting with S and “stop” to ones starting with K). You’d place these scripts in /etc/rcX.d, X being a number, the runlevel (and you had just a handful of runlevels, like halt, reboot, single user, gui, etc). Want to run something between starting the network and bringing up sshd? Just create a script in /etc/init.d and link it to /etc/rcX.d naming it SNNmyscript, with NN being a number between the ones in SNNnetwork and SNNsshd. Want to disable a service? Change its script name from S… to K… Change startup sequences? Just change the NN.

    Beautiful. But although it worked perfectly for most of us, it did have deficiencies. An obvious one is that it ran these scripts sequentially. Even if your computer was using 0.1% of its power to run each of them, you’d be waiting for each one to run in a single queue.

    So a very nice and polite guy came up with systemd. Instead of simple scripts running sequentially, you could now create “unit files”, describing each “thing to do”, for what “targets” (similar to runlevels) that thing is needed, which scripts to run to make that thing happen, and which previous things should have been done before this thing (dependencies). With this, your computer can fire up multiple startup scripts (and stopping scripts) at the same time, only making sure to queue stuff so dependencies are met. For example, you don’t need to wait for sshd to start your database server, but you do need networking before you mount shared disks.

    That made boot times much better, but at the cost of complexity and maintainability (and here come heated discussions…).

    The problem is that not everyone wanted that tradeoff, but systemd was shoved down everyone’s throat as most (all?) distros adopted it.

    So init freedom is a reaction to that, offering you the option of multiple init systems (there are more than just sysVinit and systemd).

    No offense to all the other init systems, but I’d stick with sysV if you’re really after simplicity and backwards compatibility with most older systems (and the old ways), or systemd, because it became the de facto standard, it’s faster and more modern.

    Should you care? If you have to ask this, then no.

    If you had to craft your own init scripts and configurations, and had a ton of legacy scripts, or maybe were building very simple barebones systems, or very complex, always changing startup scenarios and targets or runlevels, or want to exercise your “freedom” just for the heck of it, then you could care.

    If you’re a distro hopper (i.e. are more dedicated to “use Linux” than to use applications which run on Linux), having tried 5 different init systems may be one more thing to brag about in distro hopper meetings.

    If you’re getting into Linux to learn Linux administration for career purposes, systemd is what you’ll find in commercial systems.

    If you’re after an OS to just be an OS (i.e. just run your programs), just pick a well supported (community) and mainstream one, it will most likely come with systemd, and you’ll probably never need to touch systemd. My wife (not technical) has been using exclusively Linux for 15+ years, and I can assure you with 100% certainty that she doesn’t know which init system is there, or what is systemd or sysV.

    If you’re new to Linux, curious and want to learn all you can about it, I’d say there are many other interesting and useful things in Linux to learn and care about before you go down this rabbit hole, summoning some nice nostalgic but outdated tech from the dead.

      • Kevin@programming.dev
        link
        fedilink
        English
        arrow-up
        12
        arrow-down
        1
        ·
        edit-2
        1 year ago

        Because systemd (the project) extends more than just systemd (the init system). It also includes things like:

        • systemd-journald (system logging)
        • systemd-timesyncd (Network Time Sync)
        • NetworkManager systemd-networkd (network interface/connection management)
        • systemd-homed (Home directory management)
        • systemd-resolved (DNS Resolver)

        and so many more

        Now, in my personal opinion, I do find it good in that these being under one umbrella project led to fairly good integration between these aspects of “system management” as a whole. But I do also concede that this may feel like too many responsibilities handled by one project

        • cdombroski@programming.dev
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 year ago

          NetworkManager (network interface/connection management)

          Pretty sure you mean systemd-networkd here. I find systemd-networkd to be very nice for headless systems, but NetworkManager seems to be a better fit for desktops because of the integrations it has available with KDE/Gnome/system tray

      • jsveiga@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        It doesn’t do “only” that; I was comparing it with other init systems and described their main, basic init functionality. Sorry if I didn’t do it well.