this post was submitted on 10 Aug 2023
282 points (95.8% liked)

Linux

56362 readers
1188 users here now

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

Related Communities

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

founded 6 years ago
MODERATORS
 

After a few conversations with people on Lemmy and other places it became clear to me that most aren't aware of what it can do and how much more robust it is compared to the usual "jankiness" we're used to.

In this article I highlight less known features and give out a few practice examples on how to leverage Systemd to remove tons of redundant packages and processes.

And yes, Systemd does containers. :)

top 50 comments
sorted by: hot top controversial new old
[–] ozymandias117@lemmy.world 43 points 2 years ago (1 children)

One of the big complaints of systemd detractors I read is that it’s “monolithic” and “taking over everything” and this “shouldn’t all be part of init”

You might want to point out that all the features outside of systemd-as-init are optional and can be replaced or ignored if you don’t want them. They also don’t run as PID 1

You do have to use systemd-journald, but you can also just forward it to syslog if you want

[–] TCB13@lemmy.world 15 points 2 years ago (2 children)

all the features outside of systemd-as-init are optional and can be replaced or ignored if you don’t want them

Yes, but the point of the article was kind of the opposite - simply try all the systemd tools and components and see how much better things can get.

[–] ozymandias117@lemmy.world 6 points 2 years ago (1 children)

Sure, but if you’re trying to convince the groups that hates systemd, a preamble of “these don’t run in PID 1 and are just extra features you might find useful” could help

[–] TCB13@lemmy.world 2 points 2 years ago

That's fair.

[–] nicman24@kbin.social 2 points 2 years ago

yeah but the OP's point was not

[–] mrvictory1@lemmy.world 29 points 2 years ago (1 children)

Finally a systemd praise post after so many hateful remarks. I knew systemd could do dns resolving but just learned it could handle the entire network stack and replace NetworkManager. I have a question: How can services such as Apache adapt to both NM and systemd at the same time? NM and systemd have different wait-online services. You can also add systemd-analyze for boot time analysis to the list.

[–] TCB13@lemmy.world 5 points 2 years ago* (last edited 2 years ago)

How can services such as Apache adapt to both NM and systemd at the same time? NM and systemd have different wait-online services

If you look at the systemd unit for Apache you'll just find After=network.target - it doesn't wait-online at all. Apache doesn't really care if you're using NM or systemd-networkd, it simply queries the system (like the ip command does) to know what's going on with the network. It was designed as recommended for moderns programs: it is aware that your network might change and listens for the appropriate signals and takes care of the binds dynamically.

[–] Quazatron@lemmy.world 17 points 2 years ago (1 children)

Very interesting article with lots of links that I'm sure to revisit often. I use Linux daily and was not aware of all the possibilities that systemd has to offer.

Some of the cruft I use nowadays to manage Linux machines can be optimized by simply moving over to the systemd equivalent. Of particular interest to me are: triggers, timers, file monitoring, and ntp.

[–] TCB13@lemmy.world 5 points 2 years ago (2 children)

Thank you. NTP and DNS are the easiest to get into. Simply enable the services and move on.

[–] t0m5k1@lemmy.world 5 points 2 years ago (1 children)

I stopped using resolved as it tends to ignore what I tell it to do and still grab DNS from the router which I don't want and can't disable on the proprietary router.

openresolv/Resolveconf was never broken in the first place so I'm not sure what systemd was trying to fix with this.

[–] TCB13@lemmy.world 3 points 2 years ago* (last edited 2 years ago) (1 children)

That's most likely because... you didn't read the manual! :D

FallbackDNS= A space-separated list of IPv4 and IPv6 addresses to use as the fallback DNS servers. Please see DNS= for acceptable format of addresses. Any per-link DNS servers obtained from systemd-networkd.service(8) take precedence over this setting, as do any servers set via DNS= above or /etc/resolv.conf.

Assuming your network is DHCP, edit your config eg. /etc/systemd/network/10-eth0.network:

[DHCPv4]
UseNTP=no
UseDNS=no
UseHostname=no

Your system will not pick NTP and DNS servers and also ignore the hostname provided by the router. Also make sure you ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

https://www.freedesktop.org/software/systemd/man/systemd.network.html#%5BDHCPv4%5D%20Section%20Options

load more comments (1 replies)
load more comments (1 replies)
[–] nicman24@kbin.social 11 points 2 years ago (1 children)

systemd-nspawn is basically chroot but better

[–] TCB13@lemmy.world 5 points 2 years ago

Way, way better. Nowadays its more "basically" LXC. :P

[–] gkpy@feddit.de 3 points 2 years ago (1 children)

systemd is great, but being disingenious isn't helping anyone:

chrony -> sd-timesyncd [...] one less daemon

just because it ships with systemd doesn't mean it magically runs without it's own process

[–] TCB13@lemmy.world 4 points 2 years ago

chrony -> sd-timesyncd […] one less daemon

Thanks for pointing that out, it was out of place. :)

[–] bitwolf@lemmy.one 2 points 2 years ago

Pretty sure that's how the Steam Deck runs also. At least every custom OS I've seen for it is just a ContainerFile and systemd-boot

load more comments
view more: next ›