3

I have observed that if I use any of the following commands to reboot my RPi 2B:

$ sudo reboot
$ sudo shutdown -r now
$ sudo shutdown -Hr now

and then try to SSH into the Pi, I get a Connection Refused error. It pings normally, though. Then I have to go to the Pi, restart the power supply. Then I can SSH into it normally, after it boots up again.

How do I remotely restart the pi, while maintaining SSH access after it boots?

I didn't have this problem before. I have touched the /etc/fstab, the firewall, keep USB drives plugged in it and am running HAP-NodeJS on it currently. This loads up on startup (with cron). pkilling it (node, not cron) before reboot doesn't work.

Thanks in advance

P.S. Earlier, even restarting the power wasn't working. It turned out to that a drive in /etc/fstab that was set to auto was unplugged.

Now, every time I have to reboot it, I have to restart the power supply to use SSH, or start any program.

  • This is unanswerable. Rebooting a Pi (I have 6) with sudo reboot results in nomal operation. I don't doubt that you have a problem, but it is more likely due to your client, not the Pi. – Milliways Oct 24 '17 at 6:48
  • By the client, do you mean HAP? – Abilops Oct 24 '17 at 7:52
  • I don't know what HAP is. I suggest you reboot whatever you are using to ssh (the ssh client) into the Pi - only if you have problems worry about the Pi. – Milliways Oct 24 '17 at 10:15
  • When I reboot the pi, I can't ssh into it – Abilops Oct 24 '17 at 12:14
  • During startup you can get connection refused before ssh is started. This should be visible easily in the syslog. – MatsK Oct 24 '17 at 12:28
1

It turned out to be a problem in the /etc/fstab file. It had an entry for /dev/sda1 (vfat). I ran blkid and found that the device I wanted to mount was sdb1 and sda1 was formatted as ntfs. So I changed fstab and now everything is back to normal. I can reboot to my heart's content!

Thanks to Glenn for the last nudge to look at the fstab file.

0

My guess is the touch command you typed in is causing the problem. If you used the backstroke '\' in your touch command instead of the forwardstroke '/', you created an empty file in the main directory called 'etcfstab'. I'm not sure why this stops ssh'ing into the pi but it does. To fix this problem, power cycle the Pi. Then you should be able to ssh into the Pi. Use the 'ls' command to list the files and you should see 'etcfstab' in the list of files. To remove this file use the command 'rm etcfstab'. Then reboot and your ssh session should work. Hopes this helps.

  • Thanks for your pointing out, and your help. It made me investigate and I found the source of the problem. – Abilops Oct 25 '17 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.