systemctl edit problem “Failed to connect to bus”












1















When I attempt to create a new systemd unit (on Ubuntu 16.04)



$ sudo systemctl edit --user --full --force wagoOpenhabBridge.service
Failed to connect to bus: No such file or directory


Apart from this problem my systemd is running fine.

After some internet research, I checked these things:




  • I'm not using docker, Ubuntu is running directly on Intel NUC x64 hardware

  • systemd is running with PID=1


  • XDG variables in env are



    XDGSESSIONID=1790   
    XDGDATADIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
    XDGRUNTIMEDIR=/run/user/1000



Any ideas what is going wrong? What other things can I check?










share|improve this question




















  • 1





    Why are you using sudo to edit a user unit?

    – muru
    Feb 17 '18 at 14:17
















1















When I attempt to create a new systemd unit (on Ubuntu 16.04)



$ sudo systemctl edit --user --full --force wagoOpenhabBridge.service
Failed to connect to bus: No such file or directory


Apart from this problem my systemd is running fine.

After some internet research, I checked these things:




  • I'm not using docker, Ubuntu is running directly on Intel NUC x64 hardware

  • systemd is running with PID=1


  • XDG variables in env are



    XDGSESSIONID=1790   
    XDGDATADIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
    XDGRUNTIMEDIR=/run/user/1000



Any ideas what is going wrong? What other things can I check?










share|improve this question




















  • 1





    Why are you using sudo to edit a user unit?

    – muru
    Feb 17 '18 at 14:17














1












1








1








When I attempt to create a new systemd unit (on Ubuntu 16.04)



$ sudo systemctl edit --user --full --force wagoOpenhabBridge.service
Failed to connect to bus: No such file or directory


Apart from this problem my systemd is running fine.

After some internet research, I checked these things:




  • I'm not using docker, Ubuntu is running directly on Intel NUC x64 hardware

  • systemd is running with PID=1


  • XDG variables in env are



    XDGSESSIONID=1790   
    XDGDATADIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
    XDGRUNTIMEDIR=/run/user/1000



Any ideas what is going wrong? What other things can I check?










share|improve this question
















When I attempt to create a new systemd unit (on Ubuntu 16.04)



$ sudo systemctl edit --user --full --force wagoOpenhabBridge.service
Failed to connect to bus: No such file or directory


Apart from this problem my systemd is running fine.

After some internet research, I checked these things:




  • I'm not using docker, Ubuntu is running directly on Intel NUC x64 hardware

  • systemd is running with PID=1


  • XDG variables in env are



    XDGSESSIONID=1790   
    XDGDATADIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
    XDGRUNTIMEDIR=/run/user/1000



Any ideas what is going wrong? What other things can I check?







systemd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 18 '18 at 18:37









Zanna

51k13138242




51k13138242










asked Feb 17 '18 at 12:50









Stefaan VandeveldeStefaan Vandevelde

612




612








  • 1





    Why are you using sudo to edit a user unit?

    – muru
    Feb 17 '18 at 14:17














  • 1





    Why are you using sudo to edit a user unit?

    – muru
    Feb 17 '18 at 14:17








1




1





Why are you using sudo to edit a user unit?

– muru
Feb 17 '18 at 14:17





Why are you using sudo to edit a user unit?

– muru
Feb 17 '18 at 14:17










2 Answers
2






active

oldest

votes


















0














Is the dbus package installed?



I've noticed a similar issue when running systemctl show $UNIT as a user, with a connection attempted on /var/run/dbus/system_bus_socket which only exists if dbus-daemon --system is running, which itself needs the dbus package to be installed.



You can investigate further by using strace to check what syscalls are performed, and determine which exact issues this Failed to connect to bus: No such file or directory is about. Even if not trying to access the system bus, it's likely to be D-Bus related.



Your systemd package might have dbus in Recommends (that's the case in Debian 9 at least); checking those is usually a good idea when something doesn't work as expected.






share|improve this answer































    0














    I just came across a similar problem, it was caused by trying to run a service as a user I was not logged in with (this user has login disable, and I was using su and sg to fake it).



    Why sudo ?



    You have probably added sudo because the command was not working, you can safely remove it. A user systemd service is a regular file owned by the regular user.



    Fixing Failed to connect to bus: No such file or directory



    I found the solution on stackexchange, the DBUS_SESSION_BUS_ADDRESS seems to be missing from your environment.



    Your command can be run as this:



    export XDG_RUNTIME_DIR="/run/user/$UID"
    export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
    systemctl edit --user --full --force wagoOpenhabBridge.service


    Running the command before login



    If you want the service to be started before the user login, don't forget to run:



    sudo loginctl enable-linger USERNAME





    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007055%2fsystemctl-edit-problem-failed-to-connect-to-bus%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Is the dbus package installed?



      I've noticed a similar issue when running systemctl show $UNIT as a user, with a connection attempted on /var/run/dbus/system_bus_socket which only exists if dbus-daemon --system is running, which itself needs the dbus package to be installed.



      You can investigate further by using strace to check what syscalls are performed, and determine which exact issues this Failed to connect to bus: No such file or directory is about. Even if not trying to access the system bus, it's likely to be D-Bus related.



      Your systemd package might have dbus in Recommends (that's the case in Debian 9 at least); checking those is usually a good idea when something doesn't work as expected.






      share|improve this answer




























        0














        Is the dbus package installed?



        I've noticed a similar issue when running systemctl show $UNIT as a user, with a connection attempted on /var/run/dbus/system_bus_socket which only exists if dbus-daemon --system is running, which itself needs the dbus package to be installed.



        You can investigate further by using strace to check what syscalls are performed, and determine which exact issues this Failed to connect to bus: No such file or directory is about. Even if not trying to access the system bus, it's likely to be D-Bus related.



        Your systemd package might have dbus in Recommends (that's the case in Debian 9 at least); checking those is usually a good idea when something doesn't work as expected.






        share|improve this answer


























          0












          0








          0







          Is the dbus package installed?



          I've noticed a similar issue when running systemctl show $UNIT as a user, with a connection attempted on /var/run/dbus/system_bus_socket which only exists if dbus-daemon --system is running, which itself needs the dbus package to be installed.



          You can investigate further by using strace to check what syscalls are performed, and determine which exact issues this Failed to connect to bus: No such file or directory is about. Even if not trying to access the system bus, it's likely to be D-Bus related.



          Your systemd package might have dbus in Recommends (that's the case in Debian 9 at least); checking those is usually a good idea when something doesn't work as expected.






          share|improve this answer













          Is the dbus package installed?



          I've noticed a similar issue when running systemctl show $UNIT as a user, with a connection attempted on /var/run/dbus/system_bus_socket which only exists if dbus-daemon --system is running, which itself needs the dbus package to be installed.



          You can investigate further by using strace to check what syscalls are performed, and determine which exact issues this Failed to connect to bus: No such file or directory is about. Even if not trying to access the system bus, it's likely to be D-Bus related.



          Your systemd package might have dbus in Recommends (that's the case in Debian 9 at least); checking those is usually a good idea when something doesn't work as expected.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 25 at 7:10









          Cyril BruleboisCyril Brulebois

          1




          1

























              0














              I just came across a similar problem, it was caused by trying to run a service as a user I was not logged in with (this user has login disable, and I was using su and sg to fake it).



              Why sudo ?



              You have probably added sudo because the command was not working, you can safely remove it. A user systemd service is a regular file owned by the regular user.



              Fixing Failed to connect to bus: No such file or directory



              I found the solution on stackexchange, the DBUS_SESSION_BUS_ADDRESS seems to be missing from your environment.



              Your command can be run as this:



              export XDG_RUNTIME_DIR="/run/user/$UID"
              export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
              systemctl edit --user --full --force wagoOpenhabBridge.service


              Running the command before login



              If you want the service to be started before the user login, don't forget to run:



              sudo loginctl enable-linger USERNAME





              share|improve this answer




























                0














                I just came across a similar problem, it was caused by trying to run a service as a user I was not logged in with (this user has login disable, and I was using su and sg to fake it).



                Why sudo ?



                You have probably added sudo because the command was not working, you can safely remove it. A user systemd service is a regular file owned by the regular user.



                Fixing Failed to connect to bus: No such file or directory



                I found the solution on stackexchange, the DBUS_SESSION_BUS_ADDRESS seems to be missing from your environment.



                Your command can be run as this:



                export XDG_RUNTIME_DIR="/run/user/$UID"
                export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
                systemctl edit --user --full --force wagoOpenhabBridge.service


                Running the command before login



                If you want the service to be started before the user login, don't forget to run:



                sudo loginctl enable-linger USERNAME





                share|improve this answer


























                  0












                  0








                  0







                  I just came across a similar problem, it was caused by trying to run a service as a user I was not logged in with (this user has login disable, and I was using su and sg to fake it).



                  Why sudo ?



                  You have probably added sudo because the command was not working, you can safely remove it. A user systemd service is a regular file owned by the regular user.



                  Fixing Failed to connect to bus: No such file or directory



                  I found the solution on stackexchange, the DBUS_SESSION_BUS_ADDRESS seems to be missing from your environment.



                  Your command can be run as this:



                  export XDG_RUNTIME_DIR="/run/user/$UID"
                  export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
                  systemctl edit --user --full --force wagoOpenhabBridge.service


                  Running the command before login



                  If you want the service to be started before the user login, don't forget to run:



                  sudo loginctl enable-linger USERNAME





                  share|improve this answer













                  I just came across a similar problem, it was caused by trying to run a service as a user I was not logged in with (this user has login disable, and I was using su and sg to fake it).



                  Why sudo ?



                  You have probably added sudo because the command was not working, you can safely remove it. A user systemd service is a regular file owned by the regular user.



                  Fixing Failed to connect to bus: No such file or directory



                  I found the solution on stackexchange, the DBUS_SESSION_BUS_ADDRESS seems to be missing from your environment.



                  Your command can be run as this:



                  export XDG_RUNTIME_DIR="/run/user/$UID"
                  export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
                  systemctl edit --user --full --force wagoOpenhabBridge.service


                  Running the command before login



                  If you want the service to be started before the user login, don't forget to run:



                  sudo loginctl enable-linger USERNAME






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 25 at 9:27









                  pimpim

                  1,9291925




                  1,9291925






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007055%2fsystemctl-edit-problem-failed-to-connect-to-bus%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to send String Array data to Server using php in android

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Is anime1.com a legal site for watching anime?