You are not logged in.
Not sure if I should raise this as a bug, but it is something that has been happening since earlier in the year. It was not an issue on previous BL releases and maybe even on early release of Boron.
When I have an active SSH session in an lxterminal window tab
And I disconnect the SSH host by instructing the SSH host to reboot or poweroff
EXPECTED:
Then my terminal window session should drop me back to my local machine with an active CLI
ACTUAL:
But my terminal window tab is frozen/hanging/non-responsive with the current terminal line still indicating I am connected to the SSH host.
Last edited by jimjamz (2024-06-21 03:42:35)
Offline
What happens if you type 'exit' or hit Ctrl+d? Is the SSH connection not closed?
How about if you do that while the remote server is still up?
Could it be an issue with the remote system's setup of SSH?
You have libpam-systemd installed?
You might try this: https://serverfault.com/a/966224
Hanging SSH sessions after a reboot or shutdown seem to be common, eg:
https://bugs.debian.org/cgi-bin/bugrepo … bug=751636
https://serverfault.com/questions/70647 … 494#706494
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
@jimjamz - try prefixing the command with `nohup`
eg:
nohup "sudo shutdown -r now" # for reboot
for info about `nohup` try
man nohup
HTH
#!/bin/sh
echo '#include <stdio.h>\nvoid main() { printf("Hi, bunsenlabs\\n"); return; }' > bunsen.c
gcc bunsen.c -o bunsen
./bunsen
Offline
Thanks
It definitely appears to be the openssh-client issue that others have reported. I'm just not sure why I'm experiencing it only recently. I certainly remember this not being an issue on BL Lithium, so must have been introduced some time after that.
@johnraff - there are some reports of the PAM module solution not working for some, and I would prefer something with a more lighter touch.
The two comments on the same page here and here, suggest this can be resolved by making use of the openssh-client /examples, but in Boron, these don't appear to exist at /usr/share/doc/openssh-client/
Is this specific to Boron or has the openssh-client package removed those examples?
Offline
BunsenLabs do not modify Debian packages - with a single exception of xfce4-power-manager which is patched for an issue with icons in the system tray. So any changes are coming from Debian.
Anyway, openssh-client has never shipped /usr/share/doc/openssh-client/examples/ssh-session-cleanup.service That file comes with openssh-server! That filepath looks wrong, but that's the way the Debian packages are set up.
Check the file lists:
https://packages.debian.org/bookworm/am … r/filelist
https://packages.debian.org/bookworm/am … t/filelist
Hanging ssh sessions after reboot/shutdown of the server are a longstanding annoyance, and not everyone seems to agree that it's even a bug.
Anyway, one thing that occurs to me is that the fix needs to be applied at the server end, not the client. I guess that's why that example .service file is shipped with the server package.
So you could in principle get hold of that file from openssh-server and try that fix, but the developers don't seem to want people to do that.
https://bugs.debian.org/cgi-bin/bugrepo … bug=832155
Also see /usr/share/doc/openssh-client/README.Debian.gz towards the end:
Terminating SSH sessions cleanly on shutdown/reboot with systemd
----------------------------------------------------------------If you have libpam-systemd >= 230 installed (following openssh-server's
Recommends) and "UsePAM yes" in sshd_config (the default configuration
shipped by this package), then SSH sessions will be terminated cleanly when
the server is shut down or rebooted.If either of these conditions does not hold, then you may find that SSH
sessions hang silently when the server is shut down or rebooted. If you do
not want to use PAM or configure it properly for whatever reason, then you
can instead copy
/usr/share/doc/openssh-server/examples/ssh-session-cleanup.service to
/etc/systemd/system/ and run "systemctl enable ssh-session-cleanup.service".Non-systemd users may find /usr/lib/openssh/ssh-session-cleanup helpful if
they have a similar problem, although at present there is no system
integration for this for anything other than systemd.
So the clean way to fix this ought to be to install libpam-systemd on the server, and make sure
UsePAM yes
is set in /etc/ssh/sshd_config on the server, then restart the sshd daemon.
If that still doesn't work, you might consider some client-side action as I suggested above:
https://superuser.com/questions/467398/ … connection
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Oops, yes, the examples are in OpenSSH server and not in the client. It was the use of the term "openssh-client" in the examples directory structure that threw me off.
I tried both approaches, using the ssh-session-cleanup.service as described here and also experimenting with enabling PAM. Both were successful in terminating the session automatically.
Due to the recommendation and the caveats associated with the former, I decided to go with the latter.
Thank you all for the assistance.
Offline
It was the use of the term "openssh-client" in the examples directory structure that threw me off.
Yes, that's totally weird.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline