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

    What's the return of systemd-detect-virt on your device ?

    Scheduled Pinned Locked Moved Unsolved Support
    8 Posts 4 Posters 80 Views 1 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.
      • G Offline
        gpatel-fr
        last edited by

        Hello

        Following the recent post by @mariogrip enumerating among the problems of UT the impossibility to turn off dev mode, I can repro this problem (I think that I use the same device, a Fairphone 5).

        I have looked at this problem and seen that this is not a new occurence of the solved issue caused by a code problem in Lomiri settings: the setting is done effectively as returned by

        gdbus call --system --dest com.meego.usb_moded --object-path /com/meego/usb_moded --method com.meego.usb_moded.get_config

        clearing the switch the mode in settings set the mode to mtp instead of mtp_adb as intended.
        However, after rebooting, the mode is again mtp_adb.

        There is a systemd service called force-adb that is running at startup and calls the script /usr/libexec/force-adb, in this script there is this line:

        # In the emulator, we always want to first have the ADB on
        elif systemd-detect-virt --quiet --vm; then
            force_adb_to=1
        
        

        calling systemd-detect-virt returns on the FP5 returns:

        vm-other

        In the systemd sources, I have seen that the code is testing /proc/device-tree/hypervisor/compatible and if there is no value at this address it goes on to test other kinds of virtualization and if nothing match return finally VIRTUALIZATION_NONE. Obviously since we are running on a real phone, this is the desired value.
        Other code routes, when no other virtualization is detected, are NOT leading to VIRTUALIZATION_NONE but to VIRTUALIZATION_VM_OTHER.

        That's the reason why the FP5 can't change the Adb mode.

        Now my question: if you have a phone other than a Fairphone 5, can you check on this systemd-detect-virt utility and see if it returns 'vm-other' (bad !) or 'none' (correct) ?

        If the FP5 is the only one suffering from this problem this is a device issue.
        If all Qualcomm devices (the /proc/device-tree/hypervisor/compatible value is qcom,haven-hypervisor-1.0qcom,haven-hypervisorsimple-bus) have this problem, it's a general problem that must be fixed in the /usr/libexec/force-adb script.

        Bonus question: does anyone knows a way to find in which deb package can be found a given file, like this force-adb script ? On normal Ubuntu, apt-file makes it easy, but here we don't have it.

        Thanks for helping to advance the Fairphone cause !

        Vlad NirkyV D messayistoM 3 Replies Last reply Reply Quote 0
        • Vlad NirkyV Offline
          Vlad Nirky @gpatel-fr
          last edited by Vlad Nirky

          @gpatel-fr
          root@ubuntu-phablet:/usr/libexec# apt-file search force-adb
          usb-moded-ubports-config: /lib/systemd/system/force-adb.path
          usb-moded-ubports-config: /lib/systemd/system/force-adb.service
          usb-moded-ubports-config: /usr/libexec/force-adb

          root@ubuntu-phablet:/home/phablet# dpkg -L usb-moded-ubports-config
          /.
          /etc
          /etc/default
          /etc/default/usb-moded.d
          /etc/default/usb-moded.d/device-specific-config.conf
          /etc/usb-moded
          /etc/usb-moded/10-ubports-defaults.ini
          /etc/usb-moded/20-ubports-autodetected.ini.in
          /etc/usb-moded/90-device-specific-config.ini
          /etc/usb-moded/dyn-modes
          /etc/usb-moded/dyn-modes/charging_only_adb.ini.in
          /etc/usb-moded/dyn-modes/developer_mode.ini.in
          /etc/usb-moded/dyn-modes/mtp.ini.in
          /etc/usb-moded/dyn-modes/mtp_adb.ini.in
          /etc/usb-moded/dyn-modes/rndis.ini.in
          /etc/usb-moded/dyn-modes/rndis_adb.ini.in
          /etc/usb-moded/run
          /etc/usb-moded/run/charging_only_adb-adbd.ini
          /etc/usb-moded/run/developer_mode-ssh.ini
          /etc/usb-moded/run/developer_mode-udhcpd.ini
          /etc/usb-moded/run/mtp_adb-adbd.ini
          /etc/usb-moded/run/rndis-tethering.ini
          /etc/usb-moded/run/rndis_adb-adbd.ini
          /etc/usb-moded/run/rndis_adb-tethering.ini
          /lib
          détourné par base-files vers : /lib.usr-is-merged
          /lib/systemd
          /lib/systemd/system
          /lib/systemd/system/force-adb.path
          /lib/systemd/system/force-adb.service
          /lib/systemd/system/ssh.service.d
          /lib/systemd/system/ssh.service.d/usb-moded-ssh.conf
          /lib/systemd/system/usb-moded-ssh.service
          /lib/systemd/system/usb-moded-tethering.service
          /lib/systemd/system/usb-moded-udhcpd.service
          /lib/systemd/system/usb-moded.service.d
          /lib/systemd/system/usb-moded.service.d/ubports-usb-moded-configurator.conf
          /usr
          /usr/libexec
          /usr/libexec/force-adb
          /usr/libexec/ubports-usb-moded-configurator
          /usr/libexec/usb-moded
          /usr/libexec/usb-moded/tethering
          /usr/share
          /usr/share/doc
          /usr/share/doc/usb-moded-ubports-config
          /usr/share/doc/usb-moded-ubports-config/changelog.Debian.gz
          /usr/share/doc/usb-moded-ubports-config/copyright
          /etc/udhcpd.conf
          /etc/usb-moded/20-ubports-autodetected.ini
          /etc/usb-moded/dyn-modes/charging_only_adb.ini
          /etc/usb-moded/dyn-modes/developer_mode.ini
          /etc/usb-moded/dyn-modes/mtp.ini
          /etc/usb-moded/dyn-modes/mtp_adb.ini
          /etc/usb-moded/dyn-modes/rndis.ini
          /etc/usb-moded/dyn-modes/rndis_adb.ini

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

            @Vlad-Nirky said in What's the return of systemd-detect-virt on your device ?:

            root@ubuntu-phablet:/usr/libexec# apt-file search force-adb

            thanks - however it don't quite answer my second question that was more general.
            On my Fairphone 5, I get:

            root@ubuntu-phablet:/home/phablet# apt-file search force-adb
            bash: apt-file: command not found

            I have tried to install apt-file with 'crackle crack' and got nowhere. I even tried to download it and use it by doing manually what 'crackle crack' is supposed to do and got into a morass of Perl packages.

            Vlad NirkyV 1 Reply Last reply Reply Quote 0
            • Vlad NirkyV Offline
              Vlad Nirky @gpatel-fr
              last edited by Vlad Nirky

              @gpatel-en
              When I first started using Noble, the size of the system partition on my phone did not allow for installation.
              So we modified the installer configuration file to exceed this limit.
              I kept this initial size (because I haven't repartitioned since and it leaves me a little space to add one or two apt packages (which I don't think will affect the OS).
              By the way, in the latest 24.04-2.x, rsync is back. 🙂
              PS I think this method can not be applied to every device... It depend on the port.

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

                @gpatel-fr FP4 here. It returns none.

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

                  @gpatel-fr Volla Quintus, 24.04.1, output is "none"

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

                    @Vlad-Nirky said in What's the return of systemd-detect-virt on your device ?:

                    it leaves me a little space to add one or two apt packages (which I don't think will affect the OS).

                    I'm afraid I understand what you did 🙂

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

                      @d4f0 @messayisto

                      thanks for your replies, I'm beginning to think that there is nothing wrong neither in force-adb nor in systemd (!) and the problems comes from the device tree of the FP5, that is, the kernel configuration.
                      Changing force-adb could be an easy work around but mostly wrong.
                      I'll try to explore the FP5 kernel code to see if I can find the problem all by myself (enthusiasm level: 😞 )

                      Edit: created this gitlab issue to make the problem more visible.

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