Raspberry Pi not terminating SSH connection on reboot - ssh

This has happened to me on multiple occasions and I can't seem to pinpoint the cause of it.
Whenever I try to shutdown or reboot the Raspberry Pi via an SSH connection, the system broadcasts it's halting, but doesn't close the SSH connection. Instead it's left hanging until I type something after a minute and it notes a "Broken Pipe" error.
The weird thing about this is that it's random across installs.
On my Pi B, Rev 1, the connection closes. Initially this was the case on my Pi 3, but after a reinstall of Raspbian it stopped closing it. Another reinstall fixed it, but yesterday I reinstalled again and the problem came back.
It's seems that I'm the only one who has this problem (or at least has queried other about in online) so I thought I'd pick the brains of whoever stumbled upon this question. Anyone have any idea why this happens?
P.S. it's doesn't happen to my other servers, only to the Pi's.

This probably happens as a result of the order of the steps performed during system shutdown.
The recommended solution is installing libpam-systemd and dbus and making sure that UsePAM is enabled in sshd_config:
apt-get install libpam-systemd dbus
See the following links for a more detailed explanation:
https://serverfault.com/questions/706475/ssh-sessions-hang-on-shutdown-reboot
https://unix.stackexchange.com/questions/216950/after-sending-shutdown-command-ssh-session-doesnt-terminate

Related

Pycharm cannot finish updating skeletons

I'm newly moving from a Linux working environment to Windows, and I'm mainly using local port forwarding+Pycharm to run my python code on a server that is double-hop from my laptop.
I am able to establish the ssh tunnel through Windows cmd or MobaXterm local terminal or MobaXterm tunneling tool. I works fine on my Pycharm, when I check it from tools/deployment/configuration/test connection, and I can also see the files in remote server. But every time I start my Pycharm, it shows two background process, "updating python interpreter" and "updating pycharm helper", and the precess bar simply do not show any moving on! And I cannot run python on remote server, because Pycharm says I lack python helper.
And most wired, when it is running these two precess, my terminal for local port forwarding freezes, and I cannot type in commands in the jump server. And when I try to recheck the connection, it turns out that connection fails.
My ssh tunneling+pycharm deployment used to work fine in my Ubuntu. Thanks anybody who can shed light on my confusion!
Well, thanks everyone, I have solved this problem.
The reason is simple, but I did not notice that the ~/.pycharm_helper 's size is actually changing in the process, while the GUI bar may be not moving.
So it is due to my double-hop inconvenience, and the low Internet speed. I left it in dorm for a whole night out, and it comes out just fine.

Can't always access my Raspberry Pi through PuTTY

I recently bought a Raspberry Pi 3 Model B and started to set it up. I followed some tutorials and finally was able to access it remotely without having to plug it to a monitor, a keyboard, a mouse...
Everything is okay but it just bothers me a little bit that whenever I reboot it or I don't use it for some time I have to ping it on the computer before being able to control it remotely. If I don't ping it, connection fails.
It's not a big problem but is something I'd like to be solved. Thank you for your attention!
UPDATE: Just did a clean installation and now it works fine and can be accessed remotely at any time. Thanks to anybody that tried to help!

jupyter kernel disconnects when away from seat

So I am using GPU server with remote connection through SSH, 'screen' command to keep the jupyter running even when the SSH console window is closed.
By right it should keep running even when I'm away. Nonetheless I'm failing to keep the script running on jupyter when I leave my seat. Some of these scripts require hours and hours to produce end results but I can't have them finished.
Apparently the GPU server has NOT turned off. So I can't think memory is the issue.
Has anyone got a better understanding of this matter and a way to fix it?
Kindly respond. Thank you.

Cannot remote into raspberry pi via hostname

Let me start by saying that I have no experience with Linux and this is my first attempt at getting into the IoT with a raspberry pi3. My question is why can I connect via ssh to my pi when I use the ip address but not the hostname?
After getting everything set up at home, I tried to remote in via PuTTY from my laptop. (The laptop is less than 6 months old and if I need to provide the specs on it, I can. It is running windows 10 if that matters). It worked when I entered the ip address of the pi, but when I tried again with the host name (which is clearly defined in the raspberry pi configuration) it said host does not exist. I used hostname.local and still failed.
Today, I brought the whole setup to work to try a few more scenarios. From my work desktop, which is running windows 7 and not wireless, I could remote in via hostname.local. I then tried again on a different laptop running windows 7 and it worked too. Next attempt was on another new (less than 3 months old) laptop running windows 10 and it failed to remote in via the hostname.
This would tell me that there is nothing wrong with my home network or the network at work, and it also makes me think that this has nothing to do with the pi, since other computers can resolve the hostname to the ip address and successfully login. What the hell am I doing wrong or missing?
I spent 2 nights googling and browsing forums trying to find an answer for this but cant, so instead of bashing this post, please poke me for more information you think might be helpful for a solution.
EDIT I gave my computer and PI to my cousin to fix. He installed Samba, though I don't know what it does differently. After doing more research, it sounds like the problem I was having was a DNS issue. I don't know how it was resolved by downloading samba on the pi, but I can now connect via the hostname.
So if I understand correctly it would appear that there is some particular settings on that laptop preventing you from using SSH if that is the only thing you are changing? I think this is likely to be something to do with the security settings on the laptop but Windows isn't my thing sorry.

run gnu-screen/tmux/byobu from client

I need to understand a fundamental concept about terminal multiplexers yet I can't seem to find the answer.
As I understand these programs need to be installed on server but not necessarily on clients. It's not a problem with gnu-screen as it is already installed on most systems but it's not the case for tmux and byobu. The problem is that I don't have permission to install software on the server. Is there a way I can run byobu from my client to show statistics about the server I connect?
Also what exactly is the effect of 'byobu-enable' option?
I think there is a misunderstanding here. When you connect to the server and run a command (byobu in this case), you are running the command on the server. Statistics reported are for the server. It's possible to open a byobu session on your own desktop of course, but if you're ssh'd into a machine, you're very likely to be executing commands on that machine.
byobu-enable sets byobu to launch automatically when you open a terminal. I don't do this since you can have confusion if you have byobu running locally and on the remote end you have connected to, which causes problems when you try to interact with byobu itself.