this post was submitted on 09 Jul 2025
132 points (84.7% liked)

Linux

8394 readers
276 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
top 48 comments
sorted by: hot top controversial new old
[–] Quik@infosec.pub 75 points 3 days ago* (last edited 2 days ago) (7 children)

One thing the author probably hasn't done yet or just doesn't mention is that you can configure .container services with systemd-podman units (often called quadlets), e.g. a simple MariaDB container would look like this:

[Unit]
Description=MariaDB container

[Container]
Image=docker.io/mariadb:latest
Environment=MYSQL_ROOT_PASSWORD=rootpassword
Environment=MYSQL_USER=testuser
Environment=MYSQL_PASSWORD=testpassword
Environment=MYSQL_DATABASE=testdb

[Install]
WantedBy=multi-user.target

Short intro Full reference

This is superb, because it means your containers finally feel well-integrated with the rest of the OS and you can use systemctl, journalctl, etc. just like you would with other services.

Personally, I use this as an alternative to Podman/Docker compose and have been very happy with it running rootless containers from Nextcloud, Pufferpanel, Forgejo, Authentik, etc. (ask me for .container files if you need any help, I'm currently working on a small repo with a collection)

[–] Fedegenerate@lemmynsfw.com 15 points 3 days ago (2 children)

Excuse me, peasant crontab enjoyer here, but what?! I could write a (mostly) declarative system without having to learn Nix?! I should probably be learning systemd anyway, it's looking more and more like the present, let alone the future.

I run a bunch of remote reverse proxies that are functionally identical, but for having a different Cloudflare key and calling for a different static IP

Could I write the entire config to a self hosted Git > pull that repo > change those two variables and have a running machine?

Remote updates have been kicking my ass, I either can't wrap my head around Screen or it isn't fit for my need. Being able to pull the new config from Git over Tailscale and then run it would be game changing for me.

[–] Botzo@lemmy.world 12 points 2 days ago (1 children)

If you need a half step on your journey, convert your crontab to systemd timers first.

[–] Fedegenerate@lemmynsfw.com 8 points 2 days ago

In fact, I do need a half step. Legend, thank you.

[–] rutrum@programming.dev 4 points 2 days ago

Most compiled output of NixOS configuration (besides packages, perhaps) is just systemd units anyway. I found out quickly when learning nix that my lack of systemd prowess was going to cap how well I could understand NixOS.

[–] sip@programming.dev 12 points 3 days ago
[–] monomon@programming.dev 5 points 3 days ago (1 children)

It's amazing, the gitea container supports this. Autostarts on machine restart, etc.

[–] Quik@infosec.pub 2 points 2 days ago

Yeah, it's great that Gitea/Forgejo has a copy-paste snippet in the docs, but you can actually use that with pretty much every container.

There is this useful tool to convert containers, podman commands or even compose files to podman-systemd units: https://github.com/containers/podlet

[–] Feyd@programming.dev 4 points 3 days ago

TIL. That's pretty useful!

[–] renegadespork@lemmy.jelliefrontier.net 4 points 3 days ago (1 children)

That’s neat! There’s so many advanced features of systemd I swear I learn something new every time it comes up.

[–] JadedBlueEyes@programming.dev 2 points 2 days ago

This is due to systems generators allowing Podman to plug in to that system

[–] BarbecueCowboy@lemmy.dbzer0.com 2 points 2 days ago (2 children)

That idea feels very useful but I also distrust it and it makes me angry for reasons I can't articulate.

[–] Quik@infosec.pub 3 points 2 days ago

Your distrust is kind of reasonable: I've been using this a lot for the past year and there definitely were two or three moments where it was a bit annoying, too little transparent on what commands will be run, etc.

[–] possiblylinux127@lemmy.zip 0 points 1 day ago

Do the reasons include gate keeping?

[–] dwt@feddit.org 0 points 2 days ago (2 children)

I like this, but even though pod man runs perfect rootless, quadlets can only run as root for now :-(

[–] mholiv@lemmy.world 4 points 2 days ago* (last edited 2 days ago) (2 children)

Not true. I run them rootless on my server as we speak. :)

[–] Quik@infosec.pub 3 points 2 days ago (1 children)

Same here; Rootless Podman Quadlets gang unite (there is two of us in total)

[–] Botzo@lemmy.world 3 points 2 days ago

Make that 3!

[–] dwt@feddit.org 1 points 2 days ago (1 children)

How do you do that? Please link a description. This has been a major stumbling block for me

[–] mholiv@lemmy.world 1 points 2 days ago* (last edited 2 days ago) (1 children)

Are you placing your service files in ~/.config/containers/systemd of the home dir of the user you want them to run as?

Here is a link: https://linuxconfig.org/how-to-run-podman-containers-under-systemd-with-quadlet

[–] dwt@feddit.org 1 points 1 day ago (1 children)

Yeah, that works, but it means the services cannot be managed by systemctl as root anymore. Or am I missing something?

[–] mholiv@lemmy.world 2 points 1 day ago* (last edited 1 day ago)

You can if you want to. But I don’t think that is best practice. The idea of quadlets is the bring Linux norms to containers. You contain and manage all permissions for that container in that user.

I personally have completely separated users and selinux mls contexts for each container group (formerly docker compose file) and I manage them thusly. It’s more annoying but it substantially more secure.

This being said I think you can do it as root. I think this might work but I am not certain sudo systemctl --user -M theuser@ status myunit.service

[–] Quik@infosec.pub 2 points 2 days ago (1 children)

Just place your Quadlets in the $HOME/.config/containers/systemd/ directory for this ;)

The reference I linked to earlier also contains more information on rootless.

[–] dwt@feddit.org 1 points 2 days ago

While that is true, that is not how I would run services normally with SystemD. Those would be defined globally, but run as a user.

Definitiv then in the user home, means that I dint see them with systemctl which is very annoying.

[–] troed@fedia.io 54 points 3 days ago (1 children)

Unix grey beard here.

Yes. Distros with systemd are simply easier to maintain.

[–] SheeEttin@lemmy.zip 2 points 3 days ago (2 children)

Even when DNS resolution isn't working properly?

[–] Balinares@pawb.social 13 points 3 days ago (1 children)

Especially then. Great documentation and support tooling make troubleshooting much easier.

[–] SheeEttin@lemmy.zip 8 points 3 days ago (2 children)

Can you give me a link to that documenation and tooling? Because every time I go to troubleshoot an issue, I end up in a tangled mess of trying to figure out how systemd and NetworkManager have decided to configure themselves on this particular system, and I give up.

I don't know how it happens, but I can set up Ubuntu on a dozen laptops in exactly the same way, and a week later they all have different configurations.

[–] Balinares@pawb.social 8 points 2 days ago

Can you give me a link to that documenation and tooling?

Linux daemons and utilities typically come with manuals that get installed alongside the software. There's a command line tool, aptly called man, that can be used to search and display these manuals. So for instance, man resolvectl displays the manual for the command line utility that you can use to control, configure, monitor and debug the systemd-resolved daemon. (Although I usually look up the man page online because it's more convenient to scroll through than in a terminal.) Man pages for a given daemon will typically mention near the bottom related man pages for e.g. control utilities like resolvectl, so it's not necessary to remember it by heart.

a week later they all have different configurations.

I'm trying to remember any situation where one of the systemd components would change its configuration on its own, but I'm coming up blank. It may be my memory failing me, but possibly that's the wrong tree to bark up?

[–] reddit_sux@lemmy.world 2 points 2 days ago

Arch wiki ftw

[–] troed@fedia.io 4 points 3 days ago (1 children)

Never had a systemd caused DNS issue.

[–] eutampieri@feddit.it 4 points 2 days ago

Then I must be using it wrong. I kept systemd-resolved on my laptop but on my desktop I use plain old /etc/resolv.conf

[–] SaharaMaleikuhm@feddit.org 50 points 3 days ago* (last edited 3 days ago) (2 children)

You won't ever get me to care about what init system I run on my machine. I just need it to work.

[–] veroxii@aussie.zone 12 points 3 days ago (1 children)

Exactly. There are more important holy wars and bigger hills to die on.

[–] silasmariner@programming.dev 11 points 2 days ago

Sounds like something an Emacs user would say

[–] FizzyOrange@programming.dev 4 points 1 day ago

Those two things are related.

[–] db0@lemmy.dbzer0.com 42 points 3 days ago (1 children)

The comments in here are going to be normal

[–] BeardedGingerWonder@feddit.uk 5 points 2 days ago

Upstart was perfect!

[–] Safeguard@beehaw.org 19 points 3 days ago

I agree. For a init system.

I don't like the "takeover" of network and home folders. (It feels like a takeover for me)

[–] Sibbo@sopuli.xyz 15 points 3 days ago (1 children)

When I was starting to use Linux in the late 2010s, I was quite confused by how all the init stuff worked. Now that I use NixOS and systemd, I'm things have become really easy. I could write a simple backup system by chaining a few services together without problems.

[–] dwt@feddit.org 4 points 2 days ago

Might it be, that you have also learned a bit here and there?

[–] Cris_Color@lemmy.world 7 points 2 days ago

Systemd is fine but I am kinda sad that it's ubiquity has resulted in increasing dependence on it.

I really like void linux which uses runit and it seems like its getting harder for things to work without systemd. Gnome made some changes fairly recently that increase dependence, I hope devs can build ways for gnome to still work :/

My only real criticism is that using runit makes me feel like systemd could be a lot smaller and more elegant. But using systemd has never caused me any problems as best I'm aware 🤷‍♂️

[–] ISO@lemmy.zip 7 points 2 days ago

The first thing forcing an option does, is depriving that option the ability to know what it could achieve on pure merit.

[–] Samskara@sh.itjust.works 2 points 2 days ago (1 children)

Where did all the Pöttering hate go?

[–] FizzyOrange@programming.dev 2 points 1 day ago

Difficult to argue with someone who is obviously right when they've actually proven they were right.

[–] possiblylinux127@lemmy.zip 2 points 1 day ago* (last edited 1 day ago)

No one cares about systemd at this point

If you want to use your computer like it is 2005 go for it. Just don't keep bringing up this dead topic.