Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Linux
  3. Systemd help

Systemd help

Scheduled Pinned Locked Moved Linux
linux
13 Posts 10 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X [email protected]

    https://askubuntu.com/a/859583

    paequ2@lemmy.todayP This user is from outside of this forum
    paequ2@lemmy.todayP This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #4

    TIL about user lingering. Interesting.

    1 Reply Last reply
    0
    • X [email protected]

      https://askubuntu.com/a/859583

      K This user is from outside of this forum
      K This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #5

      Add to that need to use machinectl to establish normal user session with DBus in it.

      1 Reply Last reply
      0
      • ? Guest

        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!

        K This user is from outside of this forum
        K This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #6

        You don’t specify.

        Do you use containers or not. It sounds like you are trying to start a rootless container.

        Otherwise, you are over complicating things.

        1 Reply Last reply
        0
        • L [email protected]

          I think that error is related to a missing dbus session but don't quote me on that.

          You will probably find it easier to use a system level service, but run it as your unprivileged user with User= and Group= directives. Once you get that working, there are various other parameters you can add to harden the service if you like.

          This is a good reference for hardening: https://docs.arbitrary.ch/security/systemd.html

          The arch wiki has a good general reference for all things systemd: https://wiki.archlinux.org/title/Systemd

          K This user is from outside of this forum
          K This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #7

          I recommend that route as well.

          Since you don’t know much, stick to native services. In most cases those are already preconfigured if native service package is available.

          1 Reply Last reply
          0
          • ? Guest

            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!

            I This user is from outside of this forum
            I This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #8

            Instead of using systemd user services you can just use a normal systemd service and tell it to run the command as a specific user, put something like this in a file at /etc/systemd/system/<unit Name>.service

            [Unit]
            Description=Run service as user test
            After=network.target
            
            [Service]
            Type=simple
            User=test
            Group=test
            ExecStart=/opt/teamspoke
            
            [Install]
            WantedBy=default.target
            

            Then set it to start at boot

            systemctl enable <unit Name>.service
            

            And to start it now

            systemctl start <unit Name>.service
            
            D 1 Reply Last reply
            0
            • ? Guest

              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!

              ? Offline
              ? Offline
              Guest
              wrote on last edited by
              #9

              Thanks to all who commented. You all helped. The problem was not listed here, but you helped me to find it. The issue is this: https://superuser.com/questions/1561076/systemctl-user-failed-to-connect-to-bus-no-such-file-or-directory-debian-9

              1 Reply Last reply
              0
              • ? Guest

                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!

                H This user is from outside of this forum
                H This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #10

                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.

                1 Reply Last reply
                0
                • I [email protected]

                  Instead of using systemd user services you can just use a normal systemd service and tell it to run the command as a specific user, put something like this in a file at /etc/systemd/system/<unit Name>.service

                  [Unit]
                  Description=Run service as user test
                  After=network.target
                  
                  [Service]
                  Type=simple
                  User=test
                  Group=test
                  ExecStart=/opt/teamspoke
                  
                  [Install]
                  WantedBy=default.target
                  

                  Then set it to start at boot

                  systemctl enable <unit Name>.service
                  

                  And to start it now

                  systemctl start <unit Name>.service
                  
                  D This user is from outside of this forum
                  D This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #11

                  Best answer.

                  Extra tip: You can combine the two last commands with: systemctl enable --now <unit name>.service

                  1 Reply Last reply
                  0
                  • ? Guest

                    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!

                    M This user is from outside of this forum
                    M This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #12

                    Systemd help?

                    Run!

                    1 Reply Last reply
                    0
                    • ? Guest

                      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!

                      drwho@beehaw.orgD This user is from outside of this forum
                      drwho@beehaw.orgD This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #13

                      I've run into this before. It's poorly documented but it usually means that you don't have the environment variable XDG_RUNTIME_DIR set in your shell. I fixed it by adding this to my ~/.bashrc file and making sure it gets loaded every time I fire one up: export XDG_RUNTIME_DIR=/run/user/$UID

                      Also, try running that command right before running systemctl --user...

                      1 Reply Last reply
                      0
                      • System shared this topic on
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups