Skip to content

Commit a54156a

Browse files
committed
fix(main/openssh): rm ssh-agent socket file in service script
ssh-agent fails to run if the termux is force-stopped or the device is rebooted, with error: unix_listener: cannot bind to path $PREFIX/var/run/ssh-agent.socket: Address already in use Workaround it by removing the socket file before starting ssh-agent.
1 parent ef71510 commit a54156a

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

packages/openssh/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
33
TERMUX_PKG_LICENSE="BSD"
44
TERMUX_PKG_MAINTAINER="Joshua Kahn @TomJo2000"
55
TERMUX_PKG_VERSION="10.0p2"
6-
TERMUX_PKG_REVISION=7
6+
TERMUX_PKG_REVISION=8
77
TERMUX_PKG_SRCURL=https://github.com/openssh/openssh-portable/archive/refs/tags/V_$(sed 's/\./_/g; s/p/_P/g' <<< $TERMUX_PKG_VERSION).tar.gz
88
TERMUX_PKG_SHA256=a25b32645dc6b474064b9deb07afc9d8e37b127d026a1170b54feb929145140c
99
TERMUX_PKG_AUTO_UPDATE=true

packages/openssh/sv/ssh-agent.run.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
# then make use of the credentials across all terminal sessions
88

99
service_agent() {
10+
# If agent is not turned off before device is rebooted or
11+
# termux force-stopped, then it fails to start with:
12+
# unix_listener: cannot bind to path /data/data/com.termux/files/usr/var/run/ssh-agent.socket: Address already in use
13+
# Therefore unlink socket file before trying to use it
14+
if [ -S "$1" ]; then
15+
unlink "$1"
16+
fi
1017
exec ssh-agent -D -a "$1" 2>&1
1118
}
1219

0 commit comments

Comments
 (0)