Opened 6 months ago

Closed 5 months ago

#30284 closed defect (fixed)

start fails with "Control port file not created"

Reported by: belm0 Owned by: tbb-team
Priority: High Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-8.5-must, TorBrowserTeam201905R, user-feedback, google-play-store, blog
Cc: sisbell, sysrqb, echaskaris Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Start log observed on Android 4.4.4, Tor Browser 60.6.1, 100% failure rate:

- Set background service to FOREGROUND
- updating settings in Tor service
- updating torrc custom configuration...
- success.
- checking binary version: 0.3.5.8-rc-openssl1.0.2p
- Orbot is starting…
- Tor control port file not created
- Unable to start Tor: java.io.IOException: Control port file not created: /data/data/org.torproject.torbrowser_alpha/app_torservice/lib/tor/control.txt, len = 0

I've seen two mentions of this by Google search, but couldn't find an existing ticket.

Child Tickets

Attachments (5)

2019-05-07-12-51-48.txt (14.1 KB) - added by echaskaris 6 months ago.
Logcat filtered by tor
logcat.txt (679.0 KB) - added by echaskaris 6 months ago.
logcat unfiltered
logcat (1).txt (722.7 KB) - added by echaskaris 5 months ago.
Logcat from nightly build
Screenshot_2019-05-09-20-00-11.png (54.9 KB) - added by echaskaris 5 months ago.
contents of torrc file
Screenshot_2019-05-11-11-45-50.png (65.6 KB) - added by echaskaris 5 months ago.
torrc file contents new

Download all attachments as: .zip

Change History (40)

comment:1 Changed 6 months ago by gk

Cc: sisbell sysrqb added
Keywords: tbb-8.5-must TorBrowserTeam201904 added
Status: newneeds_information

That's just using the 8.5a11 alpha on your device without any modifications?

comment:2 Changed 6 months ago by sisbell

Do we see any other error logs in logcat? Startup will print the error stream to logcat.

comment:3 Changed 6 months ago by gk

Cc: echaskaris added

#30401 is a duplicate. echaskaris: can you help us out with debugging if we give you instructions? We would need some logcat output...

comment:4 in reply to:  3 Changed 6 months ago by echaskaris

Replying to gk:

#30401 is a duplicate. echaskaris: can you help us out with debugging if we give you instructions? We would need some logcat output...

Yes, I can help, what do you want me to do?

Changed 6 months ago by echaskaris

Attachment: 2019-05-07-12-51-48.txt added

Logcat filtered by tor

Changed 6 months ago by echaskaris

Attachment: logcat.txt added

logcat unfiltered

comment:5 Changed 6 months ago by gk

Hm, we could use more log output I guess. We fail somewhere here

            LOG.info("Waiting for control port");
            boolean isCreated = controlPortFile.exists() || controlPortFile.createNewFile();
            WriteObserver controlPortFileObserver = onionProxyContext.createControlPortFileObserver();
            if (!isCreated || (controlPortFile.length() == 0 && !controlPortFileObserver.poll(config.getFileCreationTimeout(), SECONDS))) {
                LOG.warn("Control port file not created");

sisbell: any ideas apart from creating a debug build with more logging enabled? (if not, could you create that build and make it available for echaskaris?)

Changed 5 months ago by echaskaris

Attachment: logcat (1).txt added

Logcat from nightly build

comment:7 Changed 5 months ago by echaskaris

Thank you! I'm doing this correctly right?

comment:8 in reply to:  7 Changed 5 months ago by sysrqb

Replying to echaskaris:

Thank you! I'm doing this correctly right?

Thanks! Yes, that is exactly what we requested!

Unfortunately, this is still a mystery. The file is successfully created, but tor never writes to it. I wonder if tor is dying, or it is starting slowly and doesn't create the cookie before the timeout?

5331	05-08 18:13:35.919 I/OnionProxyManager(13091): Waiting for control port
5332	05-08 18:13:35.919 I/OnionProxyManager(13091): Control port file existence: true
5333	05-08 18:13:35.919 I/OnionProxyManager(13091): isCreated is: true
[snip]
5903	05-08 18:13:50.929 W/OnionProxyManager(13091): Control port file not created
5904	05-08 18:13:50.929 W/OnionProxyManager(13091): Control port file length is: 0
5905	05-08 18:13:50.929 I/FileUtilities(13091): /data/data/org.torproject.torbrowser_nightly/app_torservice/lib/tor/control.txt
5906	05-08 18:13:50.939 I/System.out(13091): Sending status: STOPPING
5907	05-08 18:13:50.959 I/System.out(13091): Sending status: OFF

comment:9 Changed 5 months ago by gk

Hm. What about

	05-07 13:09:22.958 E/cutils  (216): Failed to mkdirat(/storage/extSdCard/Android): Read-only file system
5454	05-07 13:09:22.958 W/ContextImpl(23487): Failed to ensure directory: /storage/extSdCard/Android/data/org.torproject.torbrowser_alpha/files/Download
5455	05-07 13:09:22.958 W/Vold    (216): Returning OperationFailed - no handler for errno 30

?

comment:10 Changed 5 months ago by echaskaris

I think extSDcard is for the SD card, but I don't have one. Internal storage is at /storage/sdcard0.

comment:11 Changed 5 months ago by echaskaris

I put in an SD card and I can see the directories(/storage/extSdCard/Android/data/org.torproject.torbrowser_alpha/files/Download) in file manager. Tor still doesn't connect.

Last edited 5 months ago by echaskaris (previous) (diff)

comment:12 Changed 5 months ago by gk

Keywords: TorBrowserTeam201905 added; TorBrowserTeam201904 removed

Moving tickets to May

comment:13 Changed 5 months ago by echaskaris

Tested on a non-samsung jellybean phone, it worked fine. I have samsung with Kitkat btw.

comment:14 Changed 5 months ago by sisbell

Tor bootstrap won't use the files/Download directory. This is something related to the firefox code. Of all the Android versions, KitKat has the most problematic network stack when trying to create internal ports and use proxies and VPN. In some cases, its completely broken.

On startup, the app prints out the error stream of the Tor process. If you aren't seeing that then it may be something to do with being unable to read or process the torrc file. I'll add this configuration check in the next version (I'll get an earlier version for you to test so we can see if that is the problem).

Can you try and see if Orbot works on your version of KitKat? That would help narrow down what the problem is. If startup works with Orbot, then our issue is unlikely a network issue and would likely be an issue with installation and configuration.

comment:15 Changed 5 months ago by echaskaris

Orbot works, no errors, bootstrapped 100%, no settings changed.

comment:16 Changed 5 months ago by echaskaris

Btw Tor Browser worked fine before changing to the tor onion library or sth (when orbot was integrated).

Last edited 5 months ago by echaskaris (previous) (diff)

comment:17 in reply to:  15 Changed 5 months ago by sisbell

Replying to echaskaris:

Orbot works, no errors, bootstrapped 100%, no settings changed.

The next step is to check torrc file. If you don't have a rooted device, I'll need to provide you with a debuggable version of the build (or if you are really bored you can decompile apk and add debug field, recompile and resign with any key). On the debuggable version, you can run

adb shell run-as org.torproject.torbrowser_nightly 

This will give you permissions to pull the data directory to see what's in the torrc config file.

comment:18 Changed 5 months ago by echaskaris

I root and then? Check whether the file is there and what is in it after I get the error?

comment:19 in reply to:  18 Changed 5 months ago by sisbell

Replying to echaskaris:

I root and then? Check whether the file is there and what is in it after I get the error?

If your device is rooted, then yes. If its not already rooted, then I thinks its easier to get you a debug version of the build. I'll also document the steps for creating a debuggable build, in case other people want to do it themselves.

With the debuggable version, you can pull the config file or modify the config. You can also turn on the debug flag by modifying preferences to see more output.

Changed 5 months ago by echaskaris

contents of torrc file

comment:20 Changed 5 months ago by Pure

I am having the same issue, also running Android 4.4. The problem has been present for me on all updates after 60.5.1

comment:21 Changed 5 months ago by torlove

After the whole "addon signing fiasco" I decided to update to the latest. Knowing that it MUST also have the fix for the bug I reported over a month ago.

I have this same problem. Kitkat 4.4.2

"- Orbot is starting…

  • Tor control port file not created
  • Unable to start Tor: java.io.IOException: Control port file not created: /data/data/org.torproject.torbrowser_alpha/app_torservice/lib/tor/control.txt, len = 0

Still have Orbot working with Orfox.

In no position to install debug versions at this stage.

comment:22 Changed 5 months ago by gk

Huh, I wonder where this torrc file is coming from. Looks like it could need some clean-up. echaskaris: what are the paths that got clipped on the screenshot?

comment:23 Changed 5 months ago by echaskaris

The screenshot shows the contents of torrc file located in /data/data/org.torproject.torbrowser.alpha/app_torservice. I'll upload a new one since some lines are cut off in the old one.

Last edited 5 months ago by echaskaris (previous) (diff)

Changed 5 months ago by echaskaris

torrc file contents new

comment:24 Changed 5 months ago by sisbell

This problem occurs around the environmental variable ${user.home}. When this is set, we use it to tell tor where to place the DataDirectory. This is intended to be used for the desktop, as its an unsupported property on Android. If it is not set, then we pick a default location on the device that the user has access to. This is expected on an Android device.

On KitKat devices the system property ${user.home} is set to system root "/". Since the user doesn't have permission to access the root directory, startup fails. On other Android platforms the ${user.home} property value is null and tor starts up correctly.

I'll get in a fix for testing.

comment:25 Changed 5 months ago by gk

echaskaris: could you test whether https://github.com/sisbell/tor-files/blob/master/orbot-topl-debug.apk is working for you?

comment:26 Changed 5 months ago by gk

Keywords: TorBrowserTeam201905R added; TorBrowserTeam201905 removed
Status: needs_informationneeds_review

comment:27 in reply to:  26 Changed 5 months ago by gk

Replying to gk:

Okay, I backported the patch by sisbell and added it to tor-browser-build. See: https://gitweb.torproject.org/user/gk/tor-browser-build.git/commit/?h=bug_30284_v2&id=3d15fd5126abc6cc5166f38e2f936ab87b8a5a76

Pushed to maint-8.5 (commit 3d15fd5126abc6cc5166f38e2f936ab87b8a5a76) after ack by sysrqb.

comment:28 Changed 5 months ago by sysrqb

This looks good to me

The Pull Request says:

On Android 4.4, ${user.home} is "/", which the app does not have permission to access. This causes tor to fail to start. Other versions of Android are not affected.

comment:29 Changed 5 months ago by gk

Status: needs_reviewnew

Cherry-picked to master (commit 7caff7a3f547ca251ebea67e7a7d738185463388) as well. Setting the state to new for the real fix.

comment:30 in reply to:  25 ; Changed 5 months ago by echaskaris

Replying to gk:

echaskaris: could you test whether https://github.com/sisbell/tor-files/blob/master/orbot-topl-debug.apk is working for you?

It works, but orbot always worked.

comment:31 in reply to:  30 Changed 5 months ago by sysrqb

Replying to echaskaris:

Replying to gk:

echaskaris: could you test whether https://github.com/sisbell/tor-files/blob/master/orbot-topl-debug.apk is working for you?

It works, but orbot always worked.

Great! Yes, Orbot always worked, but this is a modified version of Orbot and this version uses the same piece of code that caused the bug originally in Tor Browser. So, if this version of orbot works, then the new version of Tor Browser should work.

Thanks for testing it.

comment:32 Changed 5 months ago by echaskaris

It's fixed

comment:33 Changed 5 months ago by gaba

Keywords: user-feedback google-play-store added

comment:34 Changed 5 months ago by gaba

Keywords: blog added

There is a comment about this bug in google play store and here: https://blog.torproject.org/comment/280897#comment-280897

comment:35 in reply to:  29 Changed 5 months ago by gk

Resolution: fixed
Status: newclosed

Replying to gk:

Cherry-picked to master (commit 7caff7a3f547ca251ebea67e7a7d738185463388) as well. Setting the state to new for the real fix.

I guess we can do that later, once we bump the topl commit.

Note: See TracTickets for help on using tickets.