UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Trying to revive 'ubtd' (Bluetooth file transfer)

    Scheduled Pinned Locked Moved Unsolved App Development
    18 Posts 3 Posters 364 Views 2 Watching
    Loading More Posts
    • 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.
      • P Offline
        PhAndersson
        last edited by

        Further updates:

        The obex.service systemd unit was in fact disabled by default. I enabled it with systemctl --user enable obex.service and then performed a full power-cycle on the phone.

        After rebooting, obexd was still not running.

        systemd reports the following about the service:

        ● obex.service - Bluetooth OBEX service
             Loaded: loaded (/usr/lib/systemd/user/obex.service; enabled; vendor preset: enabled)
            Drop-In: /usr/lib/systemd/user/obex.service.d
                     └─ubuntu-touch-session.conf
             Active: inactive (dead)
        

        I didn't find anything in 'journal' that could explain why systemd failed to start the unit -- obexd logs its version during startup and even that wasn't present, so I don't believe it's a case of it dying prematurely.

        Of course, I'm still able to start the service manually with systemctl --user start obex.service, and in this case, it keeps running until I power-cycle the phone.

        Xiaomi Mi A2 (16.04 OTA-25/stable) with 2 SIMs
        Daily driver: Google Pixel 3a (20.04 OTA-11/stable) [was: Nokia N900 (Maemo) from 2009].

        G 1 Reply Last reply Reply Quote 0
        • G Offline
          gpatel-fr @PhAndersson
          last edited by gpatel-fr

          @PhAndersson

          I wonder how the obex service runs at all for you. It does not for me.
          On my FP5 running 24.04.1.1, I get:

          phablet@ubuntu-phablet:~$ systemctl --user cat obex
          # /usr/lib/systemd/user/obex.service
          [Unit]
          Description=Bluetooth OBEX service
          
          [Service]
          Type=dbus
          BusName=org.bluez.obex
          ExecStart=/usr/libexec/bluetooth/obexd
          
          [Install]
          Alias=dbus-org.bluez.obex.service
          
          # /usr/lib/systemd/user/obex.service.d/ubuntu-touch-session.conf
          [Service]
          ExecStart=
          ExecStart=/usr/lib/bluetooth/obexd -P ftp,irmc,mas,pcsuite -r $HOME
          

          as /usr/lib/bluetooth/obexd does not exist, the service fails to start.

          EDIT: after some searching, and finding this github issue, I found the trick to add another override and after setting enable-linger for phablet with loginctl, the obex service is running after a restart.

          Not that I can test anything involving Bluetooth for lack of a suitable peripheral 🙂

          P 1 Reply Last reply Reply Quote 0
          • P Offline
            PhAndersson @gpatel-fr
            last edited by

            @gpatel-fr said in Trying to revive 'ubtd' (Bluetooth file transfer):

            @PhAndersson

            I wonder how the obex service runs at all for you. It does not for me.

            @lduboeuf already mentioned that obexd wouldn't start on 24.04. I don't use 24.04 yet myself, so I can't confirm.

            On my FP5 running 24.04.1.1, I get:

            phablet@ubuntu-phablet:~$ systemctl --user cat obex
            # /usr/lib/systemd/user/obex.service
            [Unit]
            Description=Bluetooth OBEX service
            
            [Service]
            Type=dbus
            BusName=org.bluez.obex
            ExecStart=/usr/libexec/bluetooth/obexd
            
            [Install]
            Alias=dbus-org.bluez.obex.service
            
            # /usr/lib/systemd/user/obex.service.d/ubuntu-touch-session.conf
            [Service]
            ExecStart=
            ExecStart=/usr/lib/bluetooth/obexd -P ftp,irmc,mas,pcsuite -r $HOME
            

            That content looks identical to what it is on 20.04.

            as /usr/lib/bluetooth/obexd does not exist, the service fails to start.

            Are you sure /usr/lib/bluetooth/obexd does not exist on 24.04? It is normally provided by the same package as the unit file whose content you just showed (package bluez-obexd).

            EDIT: after some searching, and finding this github issue, I found the trick to add another override and after setting enable-linger for phablet with loginctl, the obex service is running after a restart.

            Thanks a lot for that -- maybe this would the issue on 20.04 as well. I'll try.

            Not that I can test anything involving Bluetooth for lack of a suitable peripheral 🙂

            Xiaomi Mi A2 (16.04 OTA-25/stable) with 2 SIMs
            Daily driver: Google Pixel 3a (20.04 OTA-11/stable) [was: Nokia N900 (Maemo) from 2009].

            G P 2 Replies Last reply Reply Quote 0
            • G Offline
              gpatel-fr @PhAndersson
              last edited by

              @PhAndersson said in Trying to revive 'ubtd' (Bluetooth file transfer):

              Are you sure /usr/lib/bluetooth/obexd does not exist on 24.04

              phablet@ubuntu-phablet:~$ ls /usr/lib/bluetooth/obexd
              ls: cannot access '/usr/lib/bluetooth/obexd': No such file or directory

              Well, that explains it then. When this upgrade from upstart to systemd, UT was still only on focal. When upgrading to 24.04, the path was not upgraded.
              On a standard Ubuntu 24.04 (not UT):
              apt-file list bluez-obexd
              bluez-obexd: /usr/lib/systemd/user/obex.service
              bluez-obexd: /usr/libexec/bluetooth/obexd
              bluez-obexd: /usr/share/dbus-1/services/org.bluez.obex.service
              bluez-obexd: /usr/share/doc/bluez-obexd/changelog.Debian.gz
              bluez-obexd: /usr/share/doc/bluez-obexd/copyright

              yeah, that's a 24.04 thing. Before Ubuntu was putting the executable under /usr/lib.

              I have filed an issue on gitlab.

              P 1 Reply Last reply Reply Quote 0
              • P Offline
                PhAndersson
                last edited by

                There is progress. I'm happy to report that the D-Bus registration issue that manifested itself through the following error message:

                Error registering agent for the default adapter: QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.bluez.obex was not provided by any .service files")

                is resolved. My mistake. I tried to connect to OBEX over the system bus, when it runs on the session bus.

                Still no file transfer, though.

                Xiaomi Mi A2 (16.04 OTA-25/stable) with 2 SIMs
                Daily driver: Google Pixel 3a (20.04 OTA-11/stable) [was: Nokia N900 (Maemo) from 2009].

                1 Reply Last reply Reply Quote 0
                • P Offline
                  PhAndersson @gpatel-fr
                  last edited by

                  @gpatel-fr said in Trying to revive 'ubtd' (Bluetooth file transfer):

                  @PhAndersson said in Trying to revive 'ubtd' (Bluetooth file transfer):
                  yeah, that's a 24.04 thing. Before Ubuntu was putting the executable under /usr/lib.

                  I have filed an issue on gitlab.

                  Splendid! Many thanks.

                  Xiaomi Mi A2 (16.04 OTA-25/stable) with 2 SIMs
                  Daily driver: Google Pixel 3a (20.04 OTA-11/stable) [was: Nokia N900 (Maemo) from 2009].

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    PhAndersson @PhAndersson
                    last edited by

                    @gpatel-fr said in Trying to revive 'ubtd' (Bluetooth file transfer):
                    EDIT: after some searching, and finding this github issue, I found the trick to add another override and after setting enable-linger for phablet with loginctl, the obex service is running after a restart.

                    I just tried the enable-linger trick on 20.04:

                    $ loginctl enable-linger
                    

                    then confirmed that it was set using

                    $ loginctl user-status
                    

                    but after power-cycling the phone, the OBEX daemon still won't start automatically even though its unit file is still enabled.

                    You mentioned "another override": was there something else to do?

                    Xiaomi Mi A2 (16.04 OTA-25/stable) with 2 SIMs
                    Daily driver: Google Pixel 3a (20.04 OTA-11/stable) [was: Nokia N900 (Maemo) from 2009].

                    G 1 Reply Last reply Reply Quote 0
                    • G Offline
                      gpatel-fr @PhAndersson
                      last edited by

                      @PhAndersson

                      the other override is needed because of the specific 24.04 problem, you should not need it.

                      Maybe all that is needed is to enable again the service.

                      What's the result of

                      systemctl --user status obex

                      also, is there a symbolic link to the service under ~/.config/systemd/user/default.target.wants ?
                      if not systemd will not start it.

                      P 1 Reply Last reply Reply Quote 0
                      • P Offline
                        PhAndersson @gpatel-fr
                        last edited by PhAndersson

                        @gpatel-fr said in Trying to revive 'ubtd' (Bluetooth file transfer):

                        @PhAndersson

                        the other override is needed because of the specific 24.04 problem, you should not need it.

                        OK -- thanks.

                        Maybe all that is needed is to enable again the service.

                        What's the result of

                        systemctl --user status obex

                        obex.service is still enabled -- here is the requested output:

                        ● obex.service - Bluetooth OBEX service
                             Loaded: loaded (/usr/lib/systemd/user/obex.service; enabled; vendor preset: enabled)
                            Drop-In: /usr/lib/systemd/user/obex.service.d
                                     └─ubuntu-touch-session.conf
                             Active: inactive (dead)
                        

                        also, is there a symbolic link to the service under ~/.config/systemd/user/default.target.wants ?
                        if not systemd will not start it.

                        Well -- that's a good hint 🙂

                        As it turns out, the folder called ~/.config/systemd/user/default.target.wants does not exist at all. There is a folder called graphical-session.target.wants but the symlink is not there either. The symlink is created one level above, i.e. in ~/.config/systemd/user/. Here is the ls -l output:

                        total 20
                        lrwxrwxrwx 1 phablet phablet   34 Jan 15 10:50 dbus-org.bluez.obex.service -> /usr/lib/systemd/user/obex.service
                        -rw-rw-r-- 1 phablet phablet  768 Oct  4 16:55 dekkod-notify.service
                        -rw-rw-r-- 1 phablet phablet  716 Oct  4 16:55 dekkod.service
                        drwxr-xr-x 2 phablet phablet 4096 Mar 27  2025 graphical-session.target.wants
                        -rw-rw-r-- 1 phablet phablet  332 Mar 27  2025 osmscout-server.service
                        -rw-rw-r-- 1 phablet phablet  174 Mar 27  2025 osmscout-server.socket
                        

                        By way of comparison, on my laptop running openSUSE Leap 15.6, the OBEX symlink is created in the exact same place (and obexd successfully starts when I log in), so I don't know whether or not it's enough to explain why the service fails to start on the phone.

                        This being said, my app is now able to start obexd by itself if not running already, so that aspect has become less critical.

                        Xiaomi Mi A2 (16.04 OTA-25/stable) with 2 SIMs
                        Daily driver: Google Pixel 3a (20.04 OTA-11/stable) [was: Nokia N900 (Maemo) from 2009].

                        G 1 Reply Last reply Reply Quote 0
                        • G Offline
                          gpatel-fr @PhAndersson
                          last edited by

                          @PhAndersson said in Trying to revive 'ubtd' (Bluetooth file transfer):

                          lrwxrwxrwx 1 phablet phablet 34 Jan 15 10:50 dbus-org.bluez.obex.service -

                          I have it too; it's a different thing, it's for the dbus part I think.

                          @PhAndersson said in Trying to revive 'ubtd' (Bluetooth file transfer):

                          my app is now able to start obexd by itself if not running already,

                          It may be possible to activate on demand, but I have no idea how.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post