Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode requests bluetooth access on startup #134461

Open
zjeffer opened this issue Oct 5, 2021 · 15 comments
Open

VSCode requests bluetooth access on startup #134461

zjeffer opened this issue Oct 5, 2021 · 15 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron good first issue Issues identified as good for first-time contributors linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@zjeffer
Copy link

zjeffer commented Oct 5, 2021

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Disable and stop bluetooth.service: sudo systemctl disable bluetooth.service, sudo systemctl stop bluetooth.service
  2. Open Visual Studio Code
  3. Watch journalctl -f to see the output:
Oct 05 20:24:00 zjeffer dbus-daemon[497]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.235' (uid=1000 pid=1745936 comm="/opt/visual-studio-code/code --disable-extensions ")
Oct 05 20:24:00 zjeffer dbus-daemon[497]: [system] Activation via systemd failed for unit 'dbus-org.bluez.service': Unit dbus-org.bluez.service not found.

As you can see, after opening visual studio code, it requests access to the bluez service. This seems unnecessary, I guess it's Electron's doing it by default.

This is the same issue as #59162, but the OP closed it because it was fixed for him (in 2019). The issue seems to have reappeared.

@zjeffer zjeffer changed the title VSCode wants to enable bluetooth on startup VSCode requests bluetooth access on startup Oct 5, 2021
@deepak1556
Copy link
Contributor

Yes the connection with bluez service is performed by the runtime https://github.com/electron/electron/blob/22ae945311a96080b83566f40c8576b700ee339a/shell/browser/electron_browser_main_parts.cc#L482-L484, it is good to make this configurable.

@deepak1556 deepak1556 added electron Issues and items related to Electron good first issue Issues identified as good for first-time contributors linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Oct 12, 2021
@zzeebbii
Copy link

@deepak1556 if you can provide me some direction then I can try it as my first issue.

@raghavthind2005
Copy link

@deepak1556 , is this issue fixed as I am not able to reproduce it .
If not then can you please guide me on a starting point to solving it.

@zjeffer
Copy link
Author

zjeffer commented Nov 6, 2021

@raghavthind2005 The issue is still present. I don't know much about Electron so I can't really help.

@klaasg
Copy link

klaasg commented Dec 30, 2021

I experience the same issue, same OS.

@alirezaalavi87
Copy link

Yes the connection with bluez service is performed by the runtime https://github.com/electron/electron/blob/22ae945311a96080b83566f40c8576b700ee339a/shell/browser/electron_browser_main_parts.cc#L482-L484, it is good to make this configurable.

can't we just remove this from the code? I don't see the reason why it's there in the first place

@zjeffer
Copy link
Author

zjeffer commented Jan 2, 2022

@alirezaalavi87 That code is upstream, is there a way to configure it from within vscode's code, or should I open an issue in electron's repo? @deepak1556

@MananTaneja
Copy link

Can't seem to reproduce this on my system (Pop Os 22.04) is this still a valid issue. Would love to dig deeper and fix if so

cc: @zjeffer @deepak1556

@zjeffer
Copy link
Author

zjeffer commented Oct 8, 2022

@MananTaneja Looks like this is still happening on my system. Arch 5.19.13 and the visual-studio-code-bin package, version 1.72.0-1 . Disabling and stopping the bluetooth services produces the output in journalctl, enabling and starting bluetooth doesn't produce that output.

@deepak1556 deepak1556 added the bug Issue identified by VS Code Team member as probable bug label Dec 13, 2022
@joshuataylor
Copy link

joshuataylor commented Jan 7, 2023

Yes, it is still an issue as of 2023-01-07 on ArchLinux with the following:

Version: 1.74.2
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Date: 2022-12-20T10:27:19.253Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 6.1.3-1
Sandboxed: Yes

I have done the following to disable bluetooth, which is probably why it's showing this error for some and not others:

WARNING!! This command will disable and prevent bluetooth from loading!

To do undo this, run the same command, changing mask to unmask.

systemctl --user mask bluetooth.target 
systemctl --user mask blueman-manager.service 
systemctl --user mask blueman-applet.service 

However, given it's an upstream issue, figuring out why Electron wants bluetooth might be a good question to ask.

@ajaykusum
Copy link

it may be due to an extension that requires Bluetooth permissions

  • Check Extensions: Some VSCode extensions might require Bluetooth access to provide specific functionality. Check the list of installed extensions and review their permissions.

  • Solution- Disable Extensions: Temporarily disable extensions one by one and restart VSCode to identify the extension causing the Bluetooth access request.

  • Review Workspace Settings: If the request for Bluetooth access is related to a specific project or workspace, check the workspace settings for any configuration that may require Bluetooth permissions.

or

  • Open VSCode settings (File > Preferences > Settings) and search for "bluetooth" to see if there are any settings related to Bluetooth. Review and modify them if needed.

it may be related to the Electron framework that powers VSCode. Electron is a platform used to build cross-platform desktop applications, including VSCode. The request for Bluetooth access might be coming from Electron itself or from a dependency used by Electron. @joshuataylor
following the above can help you gain a better understanding of the situation.

@zjeffer
Copy link
Author

zjeffer commented Jul 23, 2023

Tested on code-insiders version 1.79.0-insider (b380da4)

  • Disabling all extensions does not fix the problem.
  • The problem is not related to a specific project or workspace settings: an empty window also triggers the issue.
  • Opening with a new profile code-insiders --profile test does not fix the problem.

@ajaykusum
Copy link

If you are experiencing the issue of VSCode requesting Bluetooth access on startup even after disabling all extensions and trying with a new profile, it's possible that this behavior is caused by a bug in the specific version of VSCode you are using.

And now a new version of vs code is available 1.80.1 from june 2023
you should try this may be in this version your problem is resolved but before that completely remove old vs code files from cache memory also,

To remove cache files of Visual Studio Code and uninstall the application, follow these steps:

Clear VS Code Cache:

Close Visual Studio Code if it's currently running.
On Windows: Press Win + R, type %APPDATA% in the Run dialog, and press Enter.
On macOS: Press Cmd + Shift + G, type ~/Library/Application Support/, and press Enter.
On Linux: Press Ctrl + H in your home directory to show hidden files, and navigate to ~/.config/Code.
Note: The exact path may vary based on your operating system and installation method.

Look for a folder named Cache and delete it.

Uninstall VS Code:

  • On Windows:

Open the Control Panel.
Go to "Programs" or "Programs and Features."
Find "Visual Studio Code" in the list of installed programs.
Right-click on "Visual Studio Code" and select "Uninstall."

- On macOS:

Drag the "Visual Studio Code" application from the Applications folder to the Trash.

  • On Linux:

The method to uninstall VS Code depends on how it was installed.
If installed via Snap, run: sudo snap remove code
If installed via apt, run: sudo apt remove code
If installed via a different package manager, refer to the appropriate uninstallation method for that package manager.

Please note that uninstalling Visual Studio Code will remove all your settings, preferences, and extensions. If you plan to reinstall VS Code later, you may want to back up any important settings or configurations before uninstalling.

@zjeffer
Copy link
Author

zjeffer commented Jul 24, 2023

The same behaviour happens with 1.80. I also tried it on a clean ubuntu VM and the same issue occured, so it isn't related to my extensions, settings or cache.

Even happens on the snap version of code (tested on Ubuntu 23.04, version 1.80)

@github0013
Copy link

Environments

  • OSX 14.3 (23D56)
  • VSCode 1.85.2
  • Playwright 1.40.1
  • Playwright plugin 1.0.22
  • Chromium 120.0.6099.28

Screenshot 2024-02-10 at 10 41 41

Screenshot 2024-02-10 at 10 42 00

Screenshot 2024-02-10 at 10 41 07

Screenshot 2024-02-10 at 10 40 43

How it happened

I had a link on my site that I was testing, which leads to a Google Drive folder. When I clicked on it, it redirected me to the Google login page. That's when I received the 'Would like to use Bluetooth' message.

Screenshot 2024-02-10 at 10 39 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron good first issue Issues identified as good for first-time contributors linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

10 participants