Navigating (enabling developer mode) with broken screen (oneplus 3t)



  • After breaking the screen on my OnePlus 3T, I wanted to use it as a Syncthing device as well as just a basic Linux server. I decided that Ubuntu Touch with adb would work for this (and that from there it should be simple to setup the network and ssh and all that). So far, I've successfully installed Ubuntu Touch.

    Since the screen is completely broken (no touchscreen, nothing displays on the screen), I was wondering how I could enable developer mode. I have a USB keyboard and USB-OTG adapter I could use to control the phone with a keyboard. I just need guidance on what keypresses to use to get me to the right spot.

    What sequence would I use to navigate and enable the option? Are there other sequences I must use if there's a first-time setup screen?

    Thanks.

    EDIT: also how would i set up a password in order to enable developer mode?



  • I'm not sure about UBports recovery, but with TWRP you can adb shell when in recovery mode.

    That will give you access to the filesystem to a certain extent:
    /data/system-data/etc/NetworkManager/system-connections

    Create a wifi profile there (a text file which is the name of the SSID with no extension). You might have to push a file to the device because there doesn't seem to be an editor. Unless you want to cat every line into there.

    [connection]
    id=
    uuid=
    type=wifi
    permissions=
    secondaries=
    
    [wifi]
    mac-address=
    mac-address-blacklist=
    mac-address-randomization=
    mode=
    seen-bssids=
    ssid=
    
    [wifi-security]
    auth-alg=
    group=
    key-mgmt=
    pairwise=
    proto=
    psk=
    
    [ipv4]
    dns-search=
    method=auto
    
    [ipv6]
    addr-gen-mode=stable-privacy
    dns-search=
    method=auto
    

    If that works somehow. Then you would have to find a way for the device to start the ssh service automatically once booted into ubuntu touch.

    http://docs.ubports.com/en/latest/userguide/advanceduse/ssh.html?highlight=ssh

    Not sure where the developer mode config is hidden...



  • @joe Thanks for the help. After flashing TWRP, I got my home wi-fi profile onto the phone (the one on my PC had a .nmconnection extension, so I kept that).

    In order to turn on SSH, it seems, I need to do some stuff in the terminal on the phone, or through adb. ADB can be enabled from Settings - About - Developer Mode - check the box to turn it on according to this: http://docs.ubports.com/en/latest/userguide/advanceduse/adb.html Could I get help with that, possibly? Like I said previously, I could navigate with a keyboard, but I'll need help with that. Thanks again.



  • @Toadtoad
    Wow. I think this is it. Even with the screen not awake this works.

    1. Hold the superkey (windows key) for about a second.
      While holding press 4. which is the default location of settings.
    2. This gets you to the login, where you type your password and press enter.
    3. Now phone is in settings. Press TAB 24 times. Then Press space.
    4. Now you are in About. Press TAB 7 times. Then press space.
    5. Now you are in Developer Mode. Press TAB 3 times. Then press space. This enables/disables developer mode.


  • @joe Thank you so much. The only thing is that I don't have a password, which is supposedly required for enabling the mode. Also, how would I accept my computer's keys for adb? Sorry for all of the complications.



  • for the password, I think you should be able to boot twrp, connect with adb, mount the system, chroot into it and then passwd phablet.

    for ssh, maybe some of this stuff helps: https://gitlab.com/ubports/community-ports/pinephone/-/issues/104#note_360710771



  • @Toadtoad

    To accept adb, I don't recall that dialog, but generally pressing "space" does things. Good luck! Let us know how it goes.



  • Hi, The default password should be 0000 if unset.



  • @Toadtoad ADB not working yet on OP3(T)



  • I've tried all of the suggestions so far. I don't know if a password is on my default, and 0000 didn't work (also is there an initial setup I have to complete before being able to perform this action). I chrooted in TWRP, but passwd was not in the /system/bin directory. So, I'm making progress, but am not there yet.



  • @Toadtoad said in Navigating (enabling developer mode) with broken screen (oneplus 3t):

    I chrooted in TWRP, but passwd was not in the /system/bin directory.

    Can you paste exact steps you took and output? passwd should be there. If you are looking at a folder called '/system/bin' then you are looking at the wrong place. I don't think such a folder exists INSIDE the UBports system image/partition (not sure which one the OP3t has.., so again, please post steps verbatim!). It should be in a "normal" Linux location, something like /bin /sbin /usr/bin /usr/sbin don't have a device in front of me.

    And while I'm sure you should be able to get passwd working, I'm not sure UBports is the best system for a "headless" (broken screen) system. It is designed for touch input. With Halium it should be possible to put other systems on it as well ... I'm a bit out of the loop, but at some point there was a debian version and for sure there is plasma mobile, which may or may not work easier in headless style.



  • @Lakotaubp said in Navigating (enabling developer mode) with broken screen (oneplus 3t):

    @Toadtoad ADB not working yet on OP3(T)

    Oof. Good point!
    SSH is the way.



  • @doniks I booted into TWRP. Opened up the adb shell and did the following:

    twrp mount system
    chroot system
    PATH=$PATH:PATH
    passwd phablet
    

    And I got /bin/sh: 3: passwd: not found

    Since it doesn't seem like I'll set up adb or ssh, any suggestions to run headlessly on my phone? Thanks.



  • @Toadtoad said in Navigating (enabling developer mode) with broken screen (oneplus 3t):

    @doniks I booted into TWRP. Opened up the adb shell and did the following:

    yeah that doesn't sound right. up front please add pwd and ls -l before you mount, otherwise it's kinda hard to know from the distance what actually gets mounted where

    twrp mount system
    chroot system

    the more I think about it, I think ALL halium ports use an image file and not the system partition. it looks like you are mounting the partition.

    please show ls -l / inside the chroot, then we can be sure

    PATH=$PATH:PATH

    not sure, what you are trying to achieve here ... I don't think it does what you think it does ... I think you are adding the literal string ":PATH" to the end of the $PATH environment variable which doesn't make much sense.

    However, since you are not using export I also think it does not affect the lines following, so it is (luckily/unluckily) immaterial

    passwd phablet

    And I got /bin/sh: 3: passwd: not found

    Since it doesn't seem like I'll set up adb or ssh, any suggestions to run headlessly on my phone? Thanks.

    You're jumping to conclusions.

    Please do (I'm just typing from memory, so be careful when copy/pasting and give us relevant output to help you)

    ls -l / 
    cat /etc/fstab
    mount 
    mount /data 
    ls -l /data 
    

    then please see here how to chroot into a halium rootfs http://docs.halium.org/en/latest/porting/debug-build/logging-in.html?highlight=chroot#logging-in

    and again, just to make sure we are on the same page, please ls -l / once inside the rootfs



  • @doniks Okay, I'll try it out. The PATH thing was a typo on my part; I did PATH=$PATH:/bin, but it seems like I didn't have the right idea from the start, so I'll try your instructions. Thanks

    Edit:
    ls -l /

    total 3372
    dr-xr-xr-x   4 root root         0 1970-01-04 02:12 acct
    lrwxrwxrwx   1 root root        11 1970-01-01 00:00 bin -> /system/bin
    lrwxrwxrwx   1 root root        50 1970-01-01 00:00 bugreports -> /data/user_de/0/com.android.shell/files/bugreports
    drwxr-xr-x   3 root root        60 2017-01-12 13:56 cache
    lrwxrwxrwx   1 root root        13 1970-01-01 00:00 charger -> /sbin/charger
    dr-xr-xr-x   2 root root        40 1970-01-01 00:00 config
    lrwxrwxrwx   1 root root        17 1970-01-01 00:00 d -> /sys/kernel/debug
    drwxr-xr-x   8 root root      4096 2017-01-09 11:51 data
    lrwxrwxrwx   1 root root        12 1970-01-01 00:00 default.prop -> prop.default
    drwxr-xr-x  10 root root      3760 1970-01-04 02:12 dev
    drwxr-xr-x   2 root root       140 2017-01-12 13:56 etc
    -rw-r--r--   1 root root     33643 1970-01-01 00:00 file_contexts
    -rw-r--r--   1 root root    674825 1970-01-01 00:00 file_contexts.bin
    -rwxr-x---   1 root root   2212400 1970-01-01 00:00 init
    -rwxr-x---   1 root root      3114 1970-01-01 00:00 init.rc
    -rwxr-x---   1 root root       103 1970-01-01 00:00 init.recovery.hlthchrg.rc
    -rwxr-x---   1 root root        52 1970-01-01 00:00 init.recovery.ldconfig.rc
    -rwxr-x---   1 root root        35 1970-01-01 00:00 init.recovery.mksh.rc
    -rwxr-x---   1 root root      5727 1970-01-01 00:00 init.recovery.qcom.rc
    -rwxr-x---   1 root root       111 1970-01-01 00:00 init.recovery.service.rc
    -rwxr-x---   1 root root      1323 1970-01-01 00:00 init.recovery.usb.rc
    drwxr-xr-x   3 root root        60 1970-01-01 00:00 license
    drwxr-xr-x   3 root system      60 1970-01-04 02:12 mnt
    drwxr-xr-x   2 root root       200 1970-01-01 00:00 odm
    drwxr-xr-x   2 root root        40 1970-01-01 00:00 oem
    drwxrwxrwx   2 root root        40 1970-01-04 02:12 persist
    -rw-r--r--   1 root root     23786 1970-01-01 00:00 plat_file_contexts
    -rw-r--r--   1 root root      7212 1970-01-01 00:00 plat_hwservice_contexts
    -rw-r--r--   1 root root      6687 1970-01-01 00:00 plat_property_contexts
    -rw-r--r--   1 root root      1315 1970-01-01 00:00 plat_seapp_contexts
    -rw-r--r--   1 root root     14057 1970-01-01 00:00 plat_service_contexts
    dr-xr-xr-x 384 root root         0 1970-01-01 00:00 proc
    lrwxrwxrwx   1 root root        15 1970-01-01 00:00 product -> /system/product
    -rw-r--r--   1 root root      3042 1970-01-01 00:00 prop.default
    drwxr-xr-x   3 root root        80 1970-01-01 00:00 res
    drwx------   2 root root        40 2019-04-15 10:55 root
    drwxr-x---   2 root root      6700 2017-01-12 13:59 sbin
    drwxrwx---   3 root root      4096 2017-01-09 11:51 sdcard
    -rw-r--r--   1 root root    387957 1970-01-01 00:00 sepolicy
    drwxr-xr-x   2 root root        40 1970-01-04 02:12 sideload
    drwxr-x--x   2 root root        40 1970-01-01 00:00 storage
    dr-xr-xr-x  12 root root         0 1970-01-04 02:12 sys
    drwxr-xr-x  24 109  113       4096 2017-01-10 21:47 system
    drwxrwxr-x   2 root shell       80 2017-01-12 14:01 tmp
    drwxr-xr-x   5 root root       180 1970-01-01 00:00 twres
    -rw-r--r--   1 root root      5272 1970-01-01 00:00 ueventd.rc
    drwxrwxrwx   2 root root        40 2017-01-12 13:56 usb_otg
    drwxr-xr-x   3 root root        60 1970-01-01 00:00 vendor
    -rw-r--r--   1 root root      6178 1970-01-01 00:00 vendor_file_contexts
    -rw-r--r--   1 root root         0 1970-01-01 00:00 vendor_hwservice_contexts
    -rw-r--r--   1 root root       218 1970-01-01 00:00 vendor_property_contexts
    -rw-r--r--   1 root root         0 1970-01-01 00:00 vendor_seapp_contexts
    -rw-r--r--   1 root root         0 1970-01-01 00:00 vendor_service_contexts
    -rw-r--r--   1 root root        65 1970-01-01 00:00 vndservice_contexts
    

    cat /etc/fstab

    /dev/block/sda3 /cache ext4 rw 0 0
    /dev/block/sda15 /data ext4 rw 0 0
    /dev/block/sda2 /persist ext4 rw 0 0
    /dev/block/sde20 /system ext4 rw 0 0
     /usb_otg vfat rw 0 0
    

    mount

    'rootfs on / type rootfs (rw,seclabel,size=2834740k,nr_inodes=708685)
    tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=2918948k,nr_inodes=729737,mode=755)
    devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
    proc on /proc type proc (rw,relatime,gid=3009,hidepid=2)
    sysfs on /sys type sysfs (rw,seclabel,relatime)
    selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
    tmpfs on /mnt type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=2918948k,nr_inodes=729737,mode=755,gid=1000)
    none on /acct type cgroup (rw,relatime,cpuacct)
    tmpfs on /tmp type tmpfs (rw,seclabel,relatime,size=2918948k,nr_inodes=729737)
    pstore on /sys/fs/pstore type pstore (rw,seclabel,relatime)
    adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
    /dev/block/sda15 on /data type ext4 (rw,seclabel,relatime,data=ordered)
    /dev/block/sda15 on /sdcard type ext4 (rw,seclabel,relatime,data=ordered)
    /dev/block/sde20 on /system type ext4 (rw,seclabel,relatime,data=ordered)
    

    mount /data

    mount: '/dev/block/sda15'->'/data': Device or resource busy
    

    ls -l /data

    1|OnePlus3:/ # ls -l /data
    total 32792
    -rw-------  1 root   root   33554432 1973-06-18 14:57 SWAP.img
    drwxrwx--x 44 system system     4096 1973-06-18 14:58 android-data
    drwxr-xr-x  3 root   root       4096 1973-06-18 14:57 cache
    drwx------  2 root   root       4096 1970-01-01 00:02 lost+found
    drwxrwx---  3 root   root       4096 2017-01-09 11:51 media
    drwxr-xr-x  5 root   root       4096 1973-06-18 14:58 system-data
    drwxr-xr-x  3 root   root       4096 2020-06-26 05:32 user-data
    

    The first step of the guide you linked involves the following the command: mount /data/rootfs.img /a, which outputs that rootfs.img does not exist.



  • @Toadtoad thanks for the clear post!

    The first step of the guide you linked involves the following the command: mount /data/rootfs.img /a, which outputs that rootfs.img does not exist.

    oh. uhh. I am really surprised. You are positive that UT is installed right? Maybe things are not working as I thought they are 🤷♂ Can you show ls -l /system?

    There is a thread about the oneplus 3t in the porting - devices section. People there should know how to chroot in



  • https://forums.ubports.com/topic/3253/oneplus-3-3t/538 Just to help speed things along if needed.



  • @doniks
    ls -l /system

    total 88
    drwxr-xr-x   2 root root 4096 2020-06-26 06:53 android
    drwxr-xr-x   2 root root 4096 2017-01-10 21:46 bin
    drwxr-xr-x   2 root root 4096 2016-04-12 20:14 boot
    lrwxrwxrwx   1 root root   14 2020-06-26 06:53 cache -> /android/cache
    lrwxrwxrwx   1 root root   13 2020-06-26 06:53 data -> /android/data
    drwxr-xr-x   3 root root 4096 2020-06-26 05:28 debian
    drwxr-xr-x   4 root root 4096 2020-06-26 05:24 dev
    drwxr-xr-x 110 root root 4096 1973-06-18 14:58 etc
    lrwxrwxrwx   1 root root   16 2020-06-26 06:53 factory -> /android/factory
    lrwxrwxrwx   1 root root   17 2020-06-26 06:53 firmware -> /android/firmware
    drwxr-xr-x   3 root root 4096 2020-06-26 05:32 home
    drwxr-xr-x  19 root root 4096 2020-06-26 05:28 lib
    drwx------   2 root root 4096 1970-01-01 00:00 lost+found
    drwxr-xr-x   2 root root 4096 2020-06-26 05:23 media
    drwxr-xr-x   2 root root 4096 2020-06-26 05:23 mnt
    lrwxrwxrwx   1 root root   12 2020-06-26 06:53 odm -> /android/odm
    drwxr-xr-x   3 root root 4096 2020-06-26 05:31 opt
    lrwxrwxrwx   1 root root   16 2020-06-26 06:53 persist -> /android/persist
    drwxr-xr-x   2 root root 4096 2016-04-12 20:14 proc
    drwx------   2 root root 4096 2020-06-26 05:32 root
    drwxr-xr-x   8 root root 4096 2020-06-26 05:31 run
    drwxr-xr-x   2 root root 4096 2020-06-26 05:32 sbin
    drwxr-xr-x   2 root root 4096 2020-06-26 05:23 srv
    drwxr-xr-x   2 root root 4096 2016-02-05 09:48 sys
    lrwxrwxrwx   1 root root   15 2020-06-26 06:53 system -> /android/system
    drwxrwxrwt   2 root root 4096 2020-06-26 05:32 tmp
    drwxr-xr-x   2 root root 4096 2020-06-26 06:53 userdata
    drwxr-xr-x  10 root root 4096 2020-06-26 05:23 usr
    drwxr-xr-x  11 109  113  4096 2020-06-25 12:57 var
    lrwxrwxrwx   1 root root   22 2020-06-26 06:53 vendor -> /android/system/vendor
    

    Should I reinstall UBPorts?



  • @Toadtoad said in Navigating (enabling developer mode) with broken screen (oneplus 3t):

    @doniks
    ls -l /system

    total 88
    drwxr-xr-x   2 root root 4096 2020-06-26 06:53 android
    drwxr-xr-x   2 root root 4096 2017-01-10 21:46 bin
    drwxr-xr-x   2 root root 4096 2016-04-12 20:14 boot
    lrwxrwxrwx   1 root root   14 2020-06-26 06:53 cache -> /android/cache
    lrwxrwxrwx   1 root root   13 2020-06-26 06:53 data -> /android/data
    drwxr-xr-x   3 root root 4096 2020-06-26 05:28 debian
    drwxr-xr-x   4 root root 4096 2020-06-26 05:24 dev
    drwxr-xr-x 110 root root 4096 1973-06-18 14:58 etc
    lrwxrwxrwx   1 root root   16 2020-06-26 06:53 factory -> /android/factory
    lrwxrwxrwx   1 root root   17 2020-06-26 06:53 firmware -> /android/firmware
    drwxr-xr-x   3 root root 4096 2020-06-26 05:32 home
    drwxr-xr-x  19 root root 4096 2020-06-26 05:28 lib
    drwx------   2 root root 4096 1970-01-01 00:00 lost+found
    drwxr-xr-x   2 root root 4096 2020-06-26 05:23 media
    drwxr-xr-x   2 root root 4096 2020-06-26 05:23 mnt
    lrwxrwxrwx   1 root root   12 2020-06-26 06:53 odm -> /android/odm
    drwxr-xr-x   3 root root 4096 2020-06-26 05:31 opt
    lrwxrwxrwx   1 root root   16 2020-06-26 06:53 persist -> /android/persist
    drwxr-xr-x   2 root root 4096 2016-04-12 20:14 proc
    drwx------   2 root root 4096 2020-06-26 05:32 root
    drwxr-xr-x   8 root root 4096 2020-06-26 05:31 run
    drwxr-xr-x   2 root root 4096 2020-06-26 05:32 sbin
    drwxr-xr-x   2 root root 4096 2020-06-26 05:23 srv
    drwxr-xr-x   2 root root 4096 2016-02-05 09:48 sys
    lrwxrwxrwx   1 root root   15 2020-06-26 06:53 system -> /android/system
    drwxrwxrwt   2 root root 4096 2020-06-26 05:32 tmp
    drwxr-xr-x   2 root root 4096 2020-06-26 06:53 userdata
    drwxr-xr-x  10 root root 4096 2020-06-26 05:23 usr
    drwxr-xr-x  11 109  113  4096 2020-06-25 12:57 var
    lrwxrwxrwx   1 root root   22 2020-06-26 06:53 vendor -> /android/system/vendor
    

    Now, this looks like UT! I am so surprised.

    Should I reinstall UBPorts?

    No, no need. Seems you were correct earlier! Just double check that there is a home/phablet folder in there then it is 100% that this is UT. Then find the passwd executable. It has to be in any of bin sbin usr/bin usr/sbin I'm sure. Then chroot /system and change phablet's password using that passwd that you just found.

    PS: Could you do me a favor? It's not really relevant for your passwd/ssh question, but it would help me understand how this halium port is put together. Can you paste ls -l /system/var/lib/lxc/android (or without the leading /system if you are inside the chroot)



  • Also try "phablet" as the default password. That's what it was on my OP3.



  • @doniks
    Ah, I didn't add sbin, /usr/bin, and /usr/sbin to PATH. passwd was in /usr/bin. I changed the password, so I think I'm able to get in. But, it seems like adb isn't even supported on the OP3T, so it seems like a moot point. @joe since you were able to help me navigate to developer mode, do you think you can tell me how to open the terminal with a keyboard, so I could try to setup SSH?


Log in to reply