Login Keyring did not get unlocked - Hyprland

I’m struggling with this exact same thing. I have both Gnome and Hyprland installed. I have set up ssh-agent, and on Gnome, the ssh key is stored in the Seahorse keyring. On Gnome everything works smoothly: when I try to commit or pull, the GUI authentication dialog pops up, I enter my passphrase, and then I am free to use the key.

On Hyprland, I have to manually re-add the keys using ssh-add ~/.ssh/my-key. After I authorise that, it works fine, but I can’t get it to automatically raise the Gnome authentication dialog.

On Hyprland:

  • gnome authentication and polkit are both running
  • the login keychain is unlocked automatically when I login to Hyprland via gdm
  • ssh-agent is running
  • in my ~/.ssh/config, I have set AddKeysToAgent yes, and also pointed IdentityFile to the right key for good measure.

The only difference I can see between Gnome and Hyprland is that the SSH_AUTH_SOCK is set to /run/user/1000/ssh-agent on Hyprland and /run/user/1000/keyring/ssh on Gnome.

I suspect that this is where the problem lies, and that this socket prompts for the password which is then passed to ssh-agent, but I don’t know how to set this up on Hyprland.

Can anyone help, it is driving me slightly crazy…

Thanks!

Any logs with journalctl | grep gnome-keyring?

You might be able to override that env variable for hyprland in wayland.windowManager.hyprland.env = [] (assuming these are not set / called when using gnome).

1 Like

Thanks for the suggestion. This is what I get for gnome-keyring with journalctl:

Apr 19 17:59:06 morse gnome-keyring-daemon[3043]: couldn't access control socket: /run/user/132/keyring/control: No such file or directory
Apr 19 17:59:06 morse gnome-keyring-daemon[3043]: discover_other_daemon: 0
Apr 19 17:59:06 morse .gnome-keyring-[3043]: couldn't access control socket: /run/user/132/keyring/control: No such file or directory
Apr 19 17:59:11 morse gdm-password][3220]: gkr-pam: gnome-keyring-daemon started properly and unlocked keyring
Apr 19 17:59:12 morse gnome-keyring-daemon[3654]: gnome-keyring-daemon: no process capabilities, insecure memory might get used
Apr 19 17:59:12 morse gnome-keyring-daemon[3654]: discover_other_daemon: 1
Apr 19 17:59:12 morse gnome-keyring-daemon[3654]: discover_other_daemon: 1SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

Interesting that it is finding the keyring/ssh socket, but echo $SSH_AUTH_SOCK returns /run/user/1000/ssh-agent. I’m not (knowingly) setting that env variable anywhere, but I’ll try your suggestion of overriding it in hyprland only.

Thanks!

Yeeessss!

That worked: setting the env var to the keyring/ssh socket worked, and now the GUI password prompt dialog pops up just like in Gnome.

Thanks so much for suggesting that :tada:

2 Likes

Thanks to this kind stranger on the internet, I was able to fix it once and for all.

Here’s what my fixing commit looks like on Hyprland (using Cosmic-greeter).

2 Likes

In your latest config you no longer set SSH_AUTH_SOCK. When I configure my system according to your gnome-keyring.nix alone I’m still being asked about SSH keyring password. How are you dealing with it right now?

I’m on mobile right now, but I’m currently developing GitHub - bashfulrobot/hyprflake and it’s working there. Just posting so you can have a look.

The only issue I’m currently working on, is intermittently the key doesn’t unlock on login. But it’s not every single time. That’s a different issue, but it might give you some hints around getting the SSH keys working. That parts been pretty flawless for me. But I do have a helper script for adding them into the keyring.