The Problem
Tor Browser will crash on startup if you have KeePassXC installed and enabled the Tor Browser integration in KeePassXC.
It doesn’t matter if you have the KeePassXC Browser extension installed.
System and Software
Operating System: Ubuntu Desktop 24.04 LTS (Gnome/Wayland)
Tor Browser version: 13.5.2 (based on Mozilla Firefox 115.14.0esr)
KeePassXC version: 2.7.9
How I installed the Tor Browser Desktop
/etc/apt/sources.list.d/torproject.sources
:
Architectures: amd64 arm64
Components: main
Enabled: yes
X-Repolib-Name: torproject
Signed-By: /etc/apt/keyrings/torproject.gpg
Suites: mantic
Types: deb
URIs: https://deb.torproject.org/torproject.org
$ sudo apt install torbrowser-launcher
Step to reproduce
- Install KeePassXC
- Install Tor Browser Desktop
- In KeePassXC go to Tools → Settings → Browser Integration and activate the checkbox to enable integration for Tor Browser.
- Start Tor-Browser from command-line with
torbrowser-launcher
, since you won’t see anything if started from your desktop.
Error
$ torbrowser-launcher
Tor Browser Launcher
By Micah Lee & Tor Project, licensed under MIT
version 0.3.7
https://gitlab.torproject.org/tpo/applications/torbrowser-launcher/
Traceback (most recent call last):
File "/usr/bin/torbrowser-launcher", line 31, in <module>
torbrowser_launcher.main()
File "/usr/lib/python3/dist-packages/torbrowser_launcher/__init__.py", line 81, in main
common = Common(tor_browser_launcher_version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/torbrowser_launcher/common.py", line 53, in __init__
self.torbrowser12_rename_old_tbb()
File "/usr/lib/python3/dist-packages/torbrowser_launcher/common.py", line 176, in torbrowser12_rename_old_tbb
os.rename(abs_filename, self.paths["tbb"]["dir_tbb"])
OSError: [Errno 39] Directory not empty: '/home/wolf/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US' -> '/home/wolf/.local/share/torbrowser/tbb/x86_64/tor-browser'
Workaround
In KeePassXC
- Open Configuration → Browser Integration
- In the General tab, disable Tor Browser integration.
1.In the Advanced tab activate Use a custom browser configuration location checkbox. - Select “Firefox” as Browser type
- Add the following folder path as Config location:
~/.local/share/torbrowser/tbb/x86_64/tor-browser/Browser/TorBrowser/Data/Browser/.mozilla/native-messaging-hosts
In a Terminal Session
Remove the folder causing the error:
$ cd ~/.local/share/torbrowser/tbb/x86_64/
$ rm -rf ./tor-browser_en-US/Browser/TorBrowser/Data/Browser/.mozilla
AppArmor
Add AppArmor rules from the Troubleshooting Guide, by adding the following lines to /etc/apparmor.d/local/torbrowser.Browser.firefox
:
# Native Messaging
owner @{HOME}/.local/share/torbrowser/tbb/x86_64/tor-browser/Browser/TorBrowser/Data/Browser/.mozilla/**/native-messaging-hosts/** ixr,
/usr/bin/keepassxc-proxy ixr,
/run/user/1000/org.keepassxc.KeePassXC.BrowserServer ixr,
/run/user/1000/app/org.keepassxc.KeePassXC/org.keepassxc.KeePassXC.BrowserServer wr,
Apply the new rules (the aa-enforce
command is not available by default):
$ sudo apt install apparmor-utils
$ sudo aa-enforce /etc/apparmor.d/torbrowser.Browser.firefox
Setting /etc/apparmor.d/torbrowser.Browser.firefox to enforce mode.
References
The issue has been already reported on GitHub in both projects:
- for the Tor Browser Launcher
- for KeePassXC
While there is no comment from the Tor Project as of today, KeePassXC is not acknowledging any bug on their side, as of today.
Impact
I assume the combination of using Tor Browser and KeePassXC is pretty common.