Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to run qtdbus application as systemd?

How to run qtdbus application as systemd?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 681 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.
  • T Offline
    T Offline
    Tyler_J
    wrote on last edited by
    #1

    Nice to meet you.

    I made an application (car<-> controller) that communicates using qtdbus provided by Qt. see. https://doc.qt.io/qt-5/qtdbus-remotecontrolledcar-example.html

    Fortunately, I was able to verify that the application's communication was working fine.

    But when I use systemd to run the application automatically at system boot, I have a problem with no communication.

    Below are the services I wrote.

    Controller systemd service

    [Unit]
    Description=Controller App execution
    ConditionPathExists=/var/run/user/root/wayland-0

    [Service]
    Type=dbus
    BusName=org.example.CarExample.service
    EnvironmentFile=/etc/sysconfig/weston
    ExecStart=/home/root/controller_app
    WorkingDirectory=/home/root/

    [Install]
    WantedBy=multi-user.target
    Car systemd service
    [Unit]
    Description=Car app execution
    ConditionPathExists=/var/run/user/root/wayland-0

    Car systemd service

    [Service]
    Type=dbus
    BusName=org.example.CarExample.service
    EnvironmentFile=/etc/sysconfig/weston
    ExecStart=/home/root/car_app
    WorkingDirectory=/home/root/qt_demo

    [Install]
    WantedBy=multi-user.target
    my qdbus service

    my dbus service

    [D-BUS Service]
    Name=org.example.CarExample.service
    Exec=/usr/bin/dsw_camera_demo
    My purpose is to make the two applications using qdbus work fine when the system boots through systemd.

    It seems you are approaching the wrong way now.

    What more should I look for?

    jsulmJ 1 Reply Last reply
    0
    • T Tyler_J

      Nice to meet you.

      I made an application (car<-> controller) that communicates using qtdbus provided by Qt. see. https://doc.qt.io/qt-5/qtdbus-remotecontrolledcar-example.html

      Fortunately, I was able to verify that the application's communication was working fine.

      But when I use systemd to run the application automatically at system boot, I have a problem with no communication.

      Below are the services I wrote.

      Controller systemd service

      [Unit]
      Description=Controller App execution
      ConditionPathExists=/var/run/user/root/wayland-0

      [Service]
      Type=dbus
      BusName=org.example.CarExample.service
      EnvironmentFile=/etc/sysconfig/weston
      ExecStart=/home/root/controller_app
      WorkingDirectory=/home/root/

      [Install]
      WantedBy=multi-user.target
      Car systemd service
      [Unit]
      Description=Car app execution
      ConditionPathExists=/var/run/user/root/wayland-0

      Car systemd service

      [Service]
      Type=dbus
      BusName=org.example.CarExample.service
      EnvironmentFile=/etc/sysconfig/weston
      ExecStart=/home/root/car_app
      WorkingDirectory=/home/root/qt_demo

      [Install]
      WantedBy=multi-user.target
      my qdbus service

      my dbus service

      [D-BUS Service]
      Name=org.example.CarExample.service
      Exec=/usr/bin/dsw_camera_demo
      My purpose is to make the two applications using qdbus work fine when the system boots through systemd.

      It seems you are approaching the wrong way now.

      What more should I look for?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @Tyler_J said in How to run qtdbus application as systemd?:

      What more should I look for?

      What is the status of the services? Are they running (see "systemctl status SERVICE")?
      Also you should not keep your executable in root home directory.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • T Offline
        T Offline
        Tyler_J
        wrote on last edited by
        #3

        Thanks, guy.

        I found the answer.

        I think, problem was to implement the service in the system area.

        It has been found that qtbus communicates in the user area.

        Therefore, if a service is created in the user area of systemd, it can be confirmed that it operates normally without connection to the dbus service.

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved