Opened 3 years ago

Closed 3 years ago

Last modified 18 months ago

#18947 closed defect (fixed)

6.0a5 is not starting on OS X if put into /Applications

Reported by: gk Owned by: mcs
Priority: Very High Milestone:
Component: Applications/Tor Browser Version:
Severity: Critical Keywords: TorBrowserTeam201605R
Cc: mcs, brade, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Nick reported that 6.0a5 on OS X is neither starting after an update nor after being freshly downloaded. The error message is: Tor launcher\n\nTor unexpectedly exited. This might be a bug in Tor itself...

Running "tor.real" from the command line is starting it fine.

After a bit of testing it turned out that putting it on the desktop is working fine, too. Just having it in /Applications produces the bug. I guess this is due to #13252.

Child Tickets

Change History (12)

comment:1 Changed 3 years ago by brade

Status: newneeds_information

I cannot reproduce this with a clean install or an upgrade from 6.0a4 on the Mac OS 10.10.5 computer I have easy access to right now. Maybe something got corrupted in the browser profile during the upgrade (perhaps because of #18928).

Nick, do either or both of the following directories exist? If so, what is in them?

/Applications/TorBrowser.app/TorBrowser/
~/Library/Application Support/TorBrowser-Data/

comment:2 Changed 3 years ago by nickm

[565]$ ls -l /Applications/TorBrowser.app/
total 0
drwxr-x---@ 7 nickm  admin  238 Apr 28 08:53 Contents
[566]$ ls -l ~/Library/Application\ Support/TorBrowser-Data/
total 0
drwx------   5 nickm  staff  170 Apr 29 08:57 Browser
drwx------  11 nickm  admin  374 Apr 29 08:30 Tor
drwxr-xr-x   3 nickm  staff  102 Apr 29 08:57 UpdateInfo

Last edited 3 years ago by nickm (previous) (diff)

comment:3 in reply to:  2 ; Changed 3 years ago by mcs

Replying to nickm:

[565]$ ls -l /Applications/TorBrowser.app/
total 0
drwxr-x---@ 7 nickm  admin  238 Apr 28 08:53 Contents

Thanks for your help. That above looks good (no old TorBrowser directory under the .app).

[566]$ ls -l ~/Library/Application\ Support/TorBrowser-Data/
total 0
drwx------   5 nickm  staff  170 Apr 29 08:57 Browser
drwx------  11 nickm  admin  374 Apr 29 08:30 Tor
drwxr-xr-x   3 nickm  staff  102 Apr 29 08:57 UpdateInfo

Please make a copy of everything under ~/Library/Application\ Support/TorBrowser-Data/ and set it aside for future debugging if you have not already done so.

Then, try renaming or setting aside that directory and see if the browser starts correctly (it should act like a clean start since you are setting aside your migrated browser profile and your Tor data directory).

If that works then the problem must be with your migrated browser profile.

If you are willing to help us some more, at that point quit the browser, throw away the newly created ~/Library/Application\ Support/TorBrowser-Data directory, place a copy of the older TorBrowser-Data directory that is not working back under ~/Library/Application\ Support/, and then edit your prefs.js file to add these two lines:

user_pref("extensions.torlauncher.loglevel", 0);
user_pref("extensions.torlauncher.logmethod", 0);

The path to the prefs.js file is:

~/Library/Application\ Support/TorBrowser-Data/Browser/SOMETHING.default/prefs.js

where SOMETHING is a random string that the browser generated when it migrated your old profile over to ~/Library/Application\ Support.

Finally, start the browser from a shell and see if anything interesting is logged, e.g.,

/Applications/TorBrowser.app/Contents/MacOS/firefox

You should see TorLauncher log output that shows the paths it is using for various little-t-tor things.

comment:4 Changed 3 years ago by mcs

I had an idea that a difference might be that some people are running with a "Standard" account (vs. an "Admin" account). But using a Standard account did not allow me to reproduce the problem.

comment:5 in reply to:  3 ; Changed 3 years ago by nickm

Replying to mcs:

Replying to nickm:

[565]$ ls -l /Applications/TorBrowser.app/
total 0
drwxr-x---@ 7 nickm  admin  238 Apr 28 08:53 Contents

Thanks for your help. That above looks good (no old TorBrowser directory under the .app).

[566]$ ls -l ~/Library/Application\ Support/TorBrowser-Data/
total 0
drwx------   5 nickm  staff  170 Apr 29 08:57 Browser
drwx------  11 nickm  admin  374 Apr 29 08:30 Tor
drwxr-xr-x   3 nickm  staff  102 Apr 29 08:57 UpdateInfo

Please make a copy of everything under ~/Library/Application\ Support/TorBrowser-Data/ and set it aside for future debugging if you have not already done so.

Okay, it all went the way you expected. Moving the TorBrowser-Data directory aside made TB work.

Afterwards, when I tried the steps you recommend, this was logged:

[05-06 03:44:57] TorLauncher INFO: debug output ready
[05-06 03:44:57] TorLauncher DBUG: Starting /Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/tor
[05-06 03:44:57] TorLauncher DBUG:   --defaults-torrc
[05-06 03:44:57] TorLauncher DBUG:   /Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/torrc-defaults
[05-06 03:44:57] TorLauncher DBUG:   -f
[05-06 03:44:57] TorLauncher DBUG:   /Users/nickm/Library/Application Support/TorBrowser-Data/Tor/torrc
[05-06 03:44:57] TorLauncher DBUG:   DataDirectory
[05-06 03:44:57] TorLauncher DBUG:   /Users/nickm/Library/Application Support/TorBrowser-Data/Tor
[05-06 03:44:57] TorLauncher DBUG:   GeoIPFile
[05-06 03:44:57] TorLauncher DBUG:   /Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/geoip
[05-06 03:44:57] TorLauncher DBUG:   GeoIPv6File
[05-06 03:44:57] TorLauncher DBUG:   /Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/geoip6
[05-06 03:44:57] TorLauncher DBUG:   HashedControlPassword
[05-06 03:44:57] TorLauncher DBUG:   16:8e408eb3d34c70fe60fe0364178c9aa68a4af6bb6961ab8844225c0667
[05-06 03:44:57] TorLauncher DBUG:   __OwningControllerProcess
[05-06 03:44:57] TorLauncher DBUG:   66947
[05-06 03:44:58] TorLauncher DBUG: Opening control connection to 127.0.0.1:9151
[05-06 03:44:58] TorLauncher DBUG: Sending Tor command: AUTHENTICATE 414124775d585b586a4e62633f2c3753
[05-06 03:44:58] TorLauncher NOTE: failed to open authenticated connection: [Exception... "Component returned failure code: 0x804b000d (NS_ERROR_CONNECTION_REFUSED) [nsIBinaryOutputStream.writeBytes]"  nsresult: "0x804b000d (NS_ERROR_CONNECTION_REFUSED)"  location: "JS frame :: jar:file:///Users/nickm/Library/Application%20Support/TorBrowser-Data/Browser/fl4i90pd.default/extensions/tor-launcher@torproject.org.xpi!/components/tl-protocol.js :: TorProtocolService.prototype._sendCommand :: line 685"  data: no]
May 05 23:44:58.109 [notice] Tor v0.2.8.2-alpha (git-684babee8491c3e9) running on Darwin with Libevent 2.0.22-stable, OpenSSL 1.0.1s and Zlib 1.2.5.
May 05 23:44:58.111 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
May 05 23:44:58.111 [notice] This version is not a stable Tor release. Expect more bugs than usual.
May 05 23:44:58.111 [notice] Read configuration file "/Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/torrc-defaults".
May 05 23:44:58.112 [notice] Read configuration file "/Users/nickm/Library/Application Support/TorBrowser-Data/Tor/torrc".
May 05 23:44:58.162 [notice] Opening Socks listener on 127.0.0.1:9150
May 05 23:44:58.162 [notice] Opening Control listener on 127.0.0.1:9151
May 05 23:44:58.000 [warn] Couldn't open file for 'Log info file /Applications/TorBrowser.app/TorBrowser/Data/Tor/info.log': No such file or directory
May 05 23:44:58.000 [notice] Closing partially-constructed Socks listener on 127.0.0.1:9150
May 05 23:44:58.000 [notice] Closing partially-constructed Control listener on 127.0.0.1:9151
May 05 23:44:58.000 [warn] Failed to parse/validate config: Failed to init Log options. See logs for details.
May 05 23:44:58.000 [err] Reading config failed--see warnings above.
[05-06 03:44:58] TorLauncher DBUG: Opening control connection to 127.0.0.1:9151
[05-06 03:44:58] TorLauncher DBUG: Sending Tor command: AUTHENTICATE 414124775d585b586a4e62633f2c3753
[05-06 03:44:58] TorLauncher NOTE: failed to open authenticated connection: [Exception... "Component returned failure code: 0x804b000d (NS_ERROR_CONNECTION_REFUSED) [nsIBinaryOutputStream.writeBytes]"  nsresult: "0x804b000d (NS_ERROR_CONNECTION_REFUSED)"  location: "JS frame :: jar:file:///Users/nickm/Library/Application%20Support/TorBrowser-Data/Browser/fl4i90pd.default/extensions/tor-launcher@torproject.org.xpi!/components/tl-protocol.js :: TorProtocolService.prototype._sendCommand :: line 685"  data: no]
[05-06 03:44:58] TorLauncher NOTE: Tor unexpectedly exited. This might be due to a bug in Tor itself, another program on your system, or faulty hardware. Until you restart Tor, the Tor Browser will not able to reach any websites. If the problem persists, please send a copy of your Tor Log to the support team.

Restarting Tor will not close your browser tabs.

It looks like this is the trouble:

May 05 23:44:58.000 [warn] Couldn't open file for 'Log info file /Applications/TorBrowser.app/TorBrowser/Data/Tor/info.log': No such file or directory

comment:6 in reply to:  5 ; Changed 3 years ago by cypherpunks

Replying to nickm:

[snip]
[05-06 03:44:58] TorLauncher DBUG: Sending Tor command: AUTHENTICATE 414124775d585b586a4e62633f2c3753

Hopefully that's just a random password.

[snip]
It looks like this is the trouble:

May 05 23:44:58.000 [warn] Couldn't open file for 'Log info file /Applications/TorBrowser.app/TorBrowser/Data/Tor/info.log': No such file or directory

Your old torrc seems to have a Log option whose path wasn't migrated to the new bundle data location. It should probably point to /Users/nickm/Library/Application Support/TorBrowser-Data/Tor/info.log. Maybe this wasn't a Tor Browser profile problem after all?

comment:7 in reply to:  6 ; Changed 3 years ago by mcs

Replying to cypherpunks:

Your old torrc seems to have a Log option whose path wasn't migrated to the new bundle data location. It should probably point to /Users/nickm/Library/Application Support/TorBrowser-Data/Tor/info.log. Maybe this wasn't a Tor Browser profile problem after all?

It could be argued that this is a migration problem. We could add code to Tor Browser that tries to fix up paths inside torrc during profile migration. But that seems like a bad idea since Tor Browser currently has no knowledge of how to parse a torrc file, including which config file directives accept paths.

In an ideal world we would capture stderr inside Tor Launcher (which would have made the problem obvious at least). This also tells me that fixing #10059 by providing a mechanism to ask for log messages via the control port is perhaps not the best solution; in this case, tor exited to soon for such a solution to be effective.

One thing still confuses me about this ticket though. In the description, gk said:

Running "tor.real" from the command line is starting it fine.

Maybe a different torrc was used for that test?

comment:8 in reply to:  7 Changed 3 years ago by nickm

Replying to mcs:

Replying to cypherpunks:

Your old torrc seems to have a Log option whose path wasn't migrated to the new bundle data location. It should probably point to /Users/nickm/Library/Application Support/TorBrowser-Data/Tor/info.log. Maybe this wasn't a Tor Browser profile problem after all?

It could be argued that this is a migration problem. We could add code to Tor Browser that tries to fix up paths inside torrc during profile migration. But that seems like a bad idea since Tor Browser currently has no knowledge of how to parse a torrc file, including which config file directives accept paths.

In an ideal world we would capture stderr inside Tor Launcher (which would have made the problem obvious at least). This also tells me that fixing #10059 by providing a mechanism to ask for log messages via the control port is perhaps not the best solution; in this case, tor exited to soon for such a solution to be effective.

Getting the stdout/stderr would have been helpful in this case, yeah.

Also I wonder if somewhere down the line we might have some way in particular for Tor to report this kind of error so the Launcher can say something like, "Tor found a problem with your configuration. It said, "[message here]". Retry with a fresh configuration?"

One thing still confuses me about this ticket though. In the description, gk said:

Running "tor.real" from the command line is starting it fine.

Maybe a different torrc was used for that test?

I think that no torrc was used for that test. :)

comment:9 Changed 3 years ago by mcs

As we discussed during the Tor Browser dev meeting this past Monday, it would be good to give users a better idea what went wrong. The real solution is for Tor Launcher to capture stderr, but that is not easy to implement. But it would be easy to display a different error message when it appears that tor never fully started (i.e., when Tor Launcher is unable to establish a control port connection before tor exits). The current message that is displayed by Tor Launcher when it detects that tor has exited looks like this:

Tor unexpectedly exited. This might be due to a bug in Tor itself, another program on your system, or faulty hardware. Until you restart Tor, the Tor Browser will not able to reach any websites. If the problem persists, please send a copy of your Tor Log to the support team.

Restarting Tor will not close your browser tabs.
[OK] [Restart Tor]

Here is a proposal for a message to display in the "could never connect to the control port" case:

Tor exited during startup. This might be due to an error in your torrc file, a bug in Tor or another program on your system, or faulty hardware. Until you fix the underlying problem and restart Tor, Tor Browser will not start.
[OK] [Restart Tor]

Comments? One problem with this is that it does not tell users where to find the torrc that Tor Browser is using (I suppose we could include the full path in the error alert). Another problem is that it is late in the Tor Browser 6.0 cycle and therefore it may be a bad idea to add strings that need to be translated.

comment:10 Changed 3 years ago by gk

Sounds good to me. We can omit it in 6.0 and backport it later to 6.0.x as soon as the translations (or a sufficiently large part of them) are available. Not sure about including the torrc path. I am inclined to omit that by arguing that folks who are able to play with their torrc file should know where it is (and, sure, I am assuming that our default torrc files are not causing this problem or, more precisely, that they are not causing that problem in a way a dev knowing what to do would not have hit it).

comment:11 Changed 3 years ago by mcs

Keywords: TorBrowserTeam201605R added; TorBrowserTeam201605 removed
Status: needs_informationneeds_review

We can detect that the new string is not available for a given language and fall back to the older error message. Here is a patch:
https://gitweb.torproject.org/user/brade/tor-launcher.git/commit/?h=bug18947-01&id=7ee11f5d012773445cc21a86bb1e8d423b15093d

comment:12 Changed 3 years ago by gk

Resolution: fixed
Status: needs_reviewclosed

Looks good. Commit 7ee11f5d012773445cc21a86bb1e8d423b15093d on master has the fix.

Note: See TracTickets for help on using tickets.