I'm using Funtoo keychain on Ubuntu 22.04 and I have followed the instructions to add the following to ~/.profile:
eval `keychain --eval --agents ssh id_rsa`
I'm running the i3 window manager, from GDM, and the problem is that GDM seems to run /bin/bash /etc/gdm3/Xsession i3, which invokes my ~/.profile script. This causes it to hang on the eval line because it prompts for a password. Since there's no interactive shell I can't add one and the whole log-in process stops with a blank screen.
To recover I have to edit ~/.profile to remove the keychain line, and manually restart GDM.
Is there an effective way to not have this log-in process blocked, but still have keychain ask me for a passphrase the first time I actually open a shell window in i3?