julien040 / gut

A beginner friendly porcelain for git

Home Page:https://gut-cli.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On headless Linux, Gut couldn't save password

julien040 opened this issue Β· comments

Description

On every attempt to save a password on a headless linux (no graphical interface), gut will fail

Sorry, I can't save the password in the keyring πŸ˜“
failed to unlock correct collection '/org/freedesktop/secrets/collection/login'
exit status 1

Possible reasons

Gnome keyring unlock

gnome-keyring expects to open a popup to unlock the keyring. However, it couldn't because there isn't any GUI. So it fails to unlock the collection

Default collection login

Perhaps on some distros, the collection "login" isn't available. So it fails to unlock it

First solution: Unlock the gnome-keyring

As stated here, there is a solution to unlock the keyring without the GUI :

  • Install the GNOME Keyring daemon.
  • Start a D-Bus session, e.g. run dbus-run-session -- sh and run the following commands inside that shell.
  • Run gnome-keyring-daemon with --unlock option.

If it's required to run all these commands before launching gut, it isn't a viable option.
This fits more for testing environnement

Second solution: Use Pass instead where gnome-keyring couldn't be used

Separate logic for saving password

If the user is on Linux, the library used should be 99designs/go-keyring to handle pass backend
For the other platform, zalando/go-keyring.

On Linux, we have to check if the user has a GUI. If yes, we use gnome-keyring (because it requires a GUI to unlock). Otherwise, we use pass

Add dependency

On the APT and YUM repository, I must add gnome-keyring to the dependency

Prompt the user

Gut should explains simply to the user how to install pass or setup it