I could use some help. I’m a pretty noobish linux user and have a linux server (running headless ubuntu). I use it for basic provisions of computer services, and to learn.

For the most part I’ve been able to stumble through the tasks I want to take on. One of the programs my server runs is Teamspeak, and it is always running. When i reboot the server, it’s the first thing I fire back up. I’ve been aware of systemd for some time now and this has been a prime candidate, but I’ve been putting off setting up any services. I figured the time has come. Holy crap, what a vortex systemd has proven to be.

When I built my server I read that it’s good practice to run the software that users will be connecting to through a non-admin account, so I did that. I have a non-admin account that I tmux my various server software on manually.

Reading some systemd tutorials, I’ve built a service file and I’m trying to register it on my non-admin account, but I get an error when I try to run systemctl --user daemon-reload: “Failed to connect to bus: No medium found”. I do not get this error when I run it on the admin account.

All the documentation I can find has got my head spinning. I’m pretty sure you need a doctorate in comp sci to understand the various man pages and webpages.

I mean hi there: https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Options

Like holy fsck: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html

I think the real question that I’m looking for is if I should be configuring services to run through my admin account, configuring services with my admin account to run as a specific user, or configuring services through my specific user account?

Also, something like Teamspeak, which just needs to run when the server is up and running, does it need before and after definitions, or if I omit them will that work fine?

Any tips, tricks or tutorials are appreciated!

  • hendrik@palaver.p3x.de
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    1
    ·
    edit-2
    2 days ago

    Nice that you were able to fix it. I think writing systemd unit files is a super useful skill. And systemd is a powerful tool. With the dozens of different things it can do and monitor for you.

    I usually give each separate service its own user account. So teamspeak would get a teamspeak user and group and I’d write a system unit file to start it as User=teamspeak and Group=teamspeak. That’s also what you’ll find in most tutorials. But you can do it your way (as a user service), too. Whichever makes it easier to maintain and administer the stuff. I guess with the user sessions, you’d have to log in with that user(?) and the way I do it, everything runs completely unattended at system start and I never log in with those user accounts.

    You don’t need to write any Before= or After= directives, unless you want to set up or tear down some environment for these services. Maybe have a look at an example for a service file for teamspeak, the arch wiki says there is some example out there. I don’t use it myself, as it’s not Free Software, but good luck convincing your friends to switch to Mumble😅