-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
App freezes after entering master password - ssh-agent deadlock #11128
Comments
There is no obvious reason for this to happen only after startup launch. I am at a loss here, same with the other thread you linked. |
Now it is very weird, because since a few days ago, it no longer happens every time, but the version is still exactly the same. |
Do you only have 1 cpu core? |
I use Fedora 40 as well and I also get the freeze only on first start. NixOS and other distros work fine. This may be a Fedora problem. I have a hexa-core AMD CPU, so that shouldn't be a problem. It also doesn't log anything useful, it just freezes. |
Hi, I was starting to write down a bug report but it looks like I'm having this issue! I tracked it down to ssh-agent socket activation. Here is my full bug report. OverviewI recently set up SSH integration in KeepassXC, and since then, after powering on my computer I always need to unlock my keepassxc database twice:
Steps to Reproduce2. Enable SSH agent integration in KeepassXC, and set
Expected Behavior
Actual Behavior
ContextCrash when ssh-agent is waiting for activationThe first time an attempt is made to unlock the database, ssh-agent is not running yet: systemd has prepared a socket but the agent will only start when this socket starts being used: $ systemctl status --user ssh-agent
○ ssh-agent.service - OpenSSH key agent
Loaded: loaded (/usr/lib/systemd/user/ssh-agent.service; indirect; preset: disabled)
Drop-In: /usr/lib/systemd/user/service.d
└─10-timeout-abort.conf
Active: inactive (dead) since Thu 2024-09-19 13:57:54 CEST; 39s ago
Duration: 7.024s
TriggeredBy: ● ssh-agent.socket
Docs: man:ssh-agent(1)
man:ssh-add(1)
man:ssh(1)
$ systemctl status --user ssh-agent.socket
● ssh-agent.socket - OpenSSH key agent
Loaded: loaded (/usr/lib/systemd/user/ssh-agent.socket; enabled; preset: disabled)
Active: active (listening) since Thu 2024-09-19 13:58:31 CEST; 1min 1s ago
Triggers: ● ssh-agent.service
Docs: man:ssh-agent(1)
man:ssh-add(1)
man:ssh(1)
Listen: /run/user/1000/ssh-agent.socket (Stream)
CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/ssh-agent.socket When trying to unlock the database in this situation, the UI hangs. No hang once the agent is runningAfter the first crash, the agent is running: ● ssh-agent.socket - OpenSSH key agent
Loaded: loaded (/usr/lib/systemd/user/ssh-agent.socket; enabled; preset: disabled)
Active: active (running) since Thu 2024-09-19 13:58:31 CEST; 3min 45s ago
Triggers: ● ssh-agent.service
Docs: man:ssh-agent(1)
man:ssh-add(1)
man:ssh(1)
Listen: /run/user/1000/ssh-agent.socket (Stream)
CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/ssh-agent.socket
● ssh-agent.service - OpenSSH key agent
Loaded: loaded (/usr/lib/systemd/user/ssh-agent.service; indirect; preset: disabled)
Drop-In: /usr/lib/systemd/user/service.d
└─10-timeout-abort.conf
Active: active (running) since Thu 2024-09-19 14:02:10 CEST; 6s ago
TriggeredBy: ● ssh-agent.socket
Docs: man:ssh-agent(1)
man:ssh-add(1)
man:ssh(1)
Process: 8285 ExecStartPre=/usr/bin/rm -f $SSH_AUTH_SOCK (code=exited, status=0/SUCCESS)
Main PID: 8286 (ssh-agent)
Tasks: 1 (limit: 19014)
Memory: 856.0K (peak: 1.1M)
CPU: 17ms
CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/ssh-agent.service
└─8286 /usr/bin/ssh-agent -D -a /run/user/1000/ssh-agent.socket ... and now we can unlock database. If I manually start the agent ( BacktraceKeepassXC hangs waiting for a reply from the agent:
When looking at the code in Versions and OSKeePassXC - Version 2.7.9 Qt 5.15.14 Operating system: Fedora Linux 40 (Workstation Edition) Enabled extensions:
Cryptographic libraries:
Operating System: Linux |
Looks like we never set a proper timeout using this function: keepassxc/src/sshagent/BinaryStream.cpp Line 53 in c1a66a8
As evidenced by the -1 in the function call here:
|
Good catch! I found two relevant threads regarding the underlying issue with ssh-agent:
Until (if ever) this PR is merged, ssh-agent is actually ... not compatible with socket activation, so I think I'll try to change the service files on my system to disable that. |
[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
# DISPLAY required for ssh-askpass to work
Environment=DISPLAY=:0
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
[Install]
WantedBy=default.target This custom systemd service appears to work for me. It stopped freezing and connecting over ssh works fine. |
Can anyone here test this PR against the previously broken ssh-agent behavior? #11290 |
I built #11290, I can confirm that the database successfully unlocks after a short wait and shows the error "Agent protocol error". After that, I can also properly use "Add key to SSH agent" without having to lock and unlock the database again. Thanks! |
Excellent, I might lower the timeout to 3 seconds, it's current at 5 |
Overview
After entering the master password, the application freezes. Then I need to kill it and after restarting everything works fine.
Steps to Reproduce
Expected Behavior
Keepassxc should not freeze.
Actual Behavior
See above
Context
When starting keepassxc using the terminal, I do not see any error messages showing up. This always only happens one time after the computer starts up. I also tried launching keepassxc, killing it without entering anything before, but then it will freeze the next time, so I always have to enter my master pw twice right now. At first I thought this might be related to #9181, but the operating is different, the freeze does not happen after hibernating and downgrading to 2.7.7 did not help.
KeePassXC - Version 2.7.9
Revision: 8f6dd13
Qt 5.15.14
Debugging mode is disabled.
Operating system: Fedora Linux 40 (Sway)
CPU architecture: x86_64
Kernel: linux 6.9.10-200.fc40.x86_64
Enabled extensions:
Cryptographic libraries:
Operating System: Linux
Desktop Env: Sway
Windowing System: Wayland
The text was updated successfully, but these errors were encountered: