24

I started using Linux lite 5.0 on my laptop last month. (I am fairly new to the Linux enviroment, just migrated from Windows 10).

So I installed Visual studio Code using snap and everytime I start it up, it asks to authenticate 'Default Keyring' until next reboot.

Is there anyway I can authorize it so I don't have to authenticate it everytime i reboot my pc?

(p.s the reason i moved from windows to linux is because my pc got hacked some weeks prior, so please consider security a major concern here)

Thanks in advance :)

Munish-Soni
  • 241
  • 1
  • 2
  • 6

5 Answers5

19

In GDM+GNOME, when you login, GNOME Keyring is automatically unlocked. However, it doesn't do so in SDDM+KDE. When you start some GNOME or Electron application like VS Code, they ask you to type the login password again.

The solution is to edit /etc/pam.d/sddm and add pam_gnome_keyring.so like this (the second line and last line):

#%PAM-1.0
auth     include        common-auth
auth     optional       pam_gnome_keyring.so
account  include        common-account
password include        common-password
session  required       pam_loginuid.so
session  include        common-session
session  optional       pam_gnome_keyring.so auto_start

This is a solution that I found here that should work for you. For me, the lines were already there, but I simply had to remove the - at the beginning of the lines.

EDIT: To edit the file, you'll need root privileges, so I did sudo -e /etc/pam.d/sddm in terminal, edited the lines, hit CTRL+X, and Y to save.

Leonivek
  • 190
  • 1
  • 5
  • It worked for me. Note : I had to restart my session / computer. The file did not exist on my computer so I only added lines: #%PAM-1.0 auth optional pam_gnome_keyring.so session optional pam_gnome_keyring.so auto_start – utopman Dec 09 '21 at 06:02
  • 3
    I use LXDE, despite of /etc/pam.d/sddm, I modify /etc/pam.d/lightdm – dwi kristianto Jan 06 '22 at 04:02
  • Happens on WSL too. No gnome, no /etc/pam.d folder.. – nsimeonov Apr 14 '22 at 19:36
9

For anyone using VSCode on Windows / WSL - this is the solution https://github.com/MicrosoftDocs/live-share/issues/1782#issuecomment-1053563079

Go to your wsl terminal and install seahorse if you don't have it.

sudo apt-get update && sudo apt-get install seahorse

Run seahorse

seahorse

You should see a popup for GnuPG keys. Click on the back button, then right-click on default keyring, and click delete. After entering your keyring password, your default keyring should be gone.

But now vscode asks you to create one every time. To fix this remove gnome-keyring:

sudo apt-get remove gnome-keyring

Credits go to Austin Jerry (upsurge0)

nsimeonov
  • 704
  • 8
  • 18
5

This has nothing to do with visual studio, keyrings is a package in your system used to store your passwords read more about keyrings here

to solve your problem open gnome-shell and search: "seahorse"

open it and you will find all your keyrings setup, the default one is what you want, select it right-click to edit or delete it if you are not remembering the password

But NOTE before you delete it any configurations with this keyring "default keyring" will be deleted with it too

Fathy
  • 377
  • 5
  • 13
  • 1
    Did you forget your punctuation and capitalization? If you spoke this answer into a cell phone, consider using a real computer to clean it up. – Robert Harvey Oct 10 '20 at 23:09
  • 1
    Cell phones are nothing short of a "real computer", Robert. – Michael Fulton Aug 14 '21 at 05:43
  • Yet this happens on WSL (Windows 11) and it happens ONLY when I launch VS Code from WSL... so it has to do something with it. also I don't have gnome-shell (I think) – nsimeonov Apr 14 '22 at 19:36
  • @nsimeonov may I ask why you're running vscode from WSL? – Fathy Apr 15 '22 at 20:44
  • @Fathy because I'm also .net developer and prefer to use VS 2019 on Windows. Using a Mac for the react projects with KVM is an option, but a good KVM to switch the three 4k monitors costs almost as much as a MacBook. Rebooting takes too long and of course the couple of react projects I work on have issues to run on windows directly, but are just fine on WSL. – nsimeonov Apr 16 '22 at 22:58
  • Noone asked about Visual Studio. This has everything to do with Visual Studio Code, as it attempts to open the Default Keyring when started, even if all extensions are disabled. – larsch Mar 24 '23 at 18:48
5

I was using Chrome OS. The Linux Terminal (AKA. crostini).

The "keep asking keyring" problem was caused by the keyring directory does not exist. So VS Code cannot save the keyring there.

The solution is simply create the directory. You may use the following command.

mkdir ~/.local/share/keyrings
Haifeng Jin
  • 71
  • 1
  • 5
  • 1
    this solved for me! thank you so much! took me ages to find a solution and turns out it was that simple! much love – kroe Jan 08 '23 at 01:51
  • 2
    That directory exists for me but I still get the prompt when launching VS Code on CrOS. – Weston Ruter Feb 20 '23 at 21:31
2

Asking to unlock the [default] keyring on startup for no reason really sucks, yepp. However, modifying the pam stack or removing keyring just because of a single misbehaving application is IMHO nothing what one should do. Instead the app should be fixed.

For code 1.80 one may use the option --password-store=basic on startup to get rid off it. Another option is to rename the app which gets invoked to ask for the passphrase, e.g. on Ubuntu 20.04 in a GNOME env sudo mv /usr/libexec/gcr-prompter /usr/libexec/gcr-prompter.disabled (package gcr) would do that. However, this is a system modification and thus other apps would be affected, too - therefore not really a good idea.

jelmd
  • 119
  • 3
  • this is the solution. then hit Ctrl+Shift+P and run Preferences: Configure Runtime Arguments command. This would open argv.json and add "password-store": "basic" – Nadir Aug 14 '23 at 10:34