Unable to ssh-connect to host Raspberry after remote shutdown command
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Unable to ssh-connect to host Raspberry after remote shutdown command
Hello everbody!
As a newbee on this forum, I thought I will post this question here. And I am pretty new with Linux anyway.
I have been running a Raspberry Pi with Raspbian as server for my music system at home for a while with pretty good results.
Because of a power outage the HDD's had to be reconnected and the system had to be reset.
The Pi itself was still running and accessible via ssh.
I wanted to shutdown the Pi using the shutdown -n command, to disconnect and reconnect some external storage.
It shutdown accordingly and now, when I want to connect remotely via ssh, I get the following message:
ssh pi@192.168.178.22
pi@192.168.178.22's password:
The system is going down on Sun Oct 28 14:15:36 2018
Connection to 192.168.178.22 closed by remote host.
Connection to 192.168.178.22 closed.
I restarted the Pi by reconnecting the power already, with the same results.
How can I remote connect to the Pi again without having to access the Pi locally?
I don't have a monitor to connect to the Pi, so I have to operate it via ssh.
I don't see a -n option for shutdown. I'm not sure what it would do as it might be interpreted as a time option.
I do find this in the man page
Code:
If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that further logins shall not be allowed.
so that's probably the cause of your message.
Were you able to connect after Sun Oct 28 14:15:36 2018 ?
Please clarify.
You ran the shutdown command...yes?
The machine turned off by itself...yes?
You performed your maintenance.
You turned the machine back on and waited for it to boot up.
Then, you got the stated response.
Is that accurate. Or did you kill power manually before the 'puter turned itself off?
Sorry, must have been -h, I think, including the time argument 5. Not sure of the actual command I have given. I am not a newbie for nothing.
I actually thought the time was specified in seconds instead of minutes.
So after the shutdown I leisurely walked to the Pi and pulled the power.
Must have been within 1 minute.
The time and date mentioned was when it was supposed to shut down.
I guess I will have to drag this big lug of computer to a monitor to get it fixed, am I?
That would have been the easy solution.
I just wanted to see if there was another solution.
Or do you think it will still be possible to fix it remotely?
I don't think so. If you can not login via ssh then your only choice is connecting the Pi to a monitor.
Depends on version of Raspbian you running but I suspect the nologin file is in /etc/ and not /run. Which might mean you can not even login locally. You might need to mount the SD card on another machine to delete the file.
Quote:
If shutdown is called with a delay, it will create the advisory file
/etc/nologin which causes programs such as login(1) to not allow new
user logins.
My oldest Pi is still running Raspbian based on debian 7.
Sorry, must have been -h, I think, including the time argument 5. Not sure of the actual command I have given. I am not a newbie for nothing.
I actually thought the time was specified in seconds instead of minutes.
So after the shutdown I leisurely walked to the Pi and pulled the power.
Must have been within 1 minute.
The time and date mentioned was when it was supposed to shut down.
I guess I will have to drag this big lug of computer to a monitor to get it fixed, am I?
That would have been the easy solution.
I just wanted to see if there was another solution.
Or do you think it will still be possible to fix it remotely?
As has been said. Probably not (unless you do have a root user and ssh by root is allowed...)
Is the 'puter near your TV? Can the TV be connected as a monitor? Would it be easier to lug a monitor to it rather than it to a monitor. Just ideas.
-n [DEPRECATED] Don't call init(8) to do the shutdown but do it ourself. The use of this option is discouraged, and its results are not always what you'd
expect.
Thank you all for giving me some advise.
I think I will be able to fix it with your tips.
Connecting to the TV is possible. I don have space to put a monitor where it sits now. And I don't have a monitor anyway.
Main reason for asking the question was to learn, and that I did.
There is still soo much to learn, and at the pace I am going it will take a while.
I will let y'all know how I fared.
Here a follow up on this problem.
I have connected the Pi to the TV.
Results: Does not compute...
It attempts to boot but fails. It mentions something about lack of space.
Checking the internal SD card on the laptop showed a problem I encountered before, I believe it was also after a power out:
The SD card was full.
Reason: I have one HD with data and a second HD with weekly backup of this data connected to the Pi.
Somehow, when the backup disk is not mounted, it starts writing the backup to the internal SD card. Of course this does not fit.
This causes the Pi to brick.
I tried wiping the backup data from the SD but this does not work. The pi still doesn't boot.
Simplest way to recover from this problem is to put a recent backup of the SD card back.
I still have to check the harddisks to see if they are not corrupt. Happened to me before.
Luckily, back then I could recover most of the data.
Hopefully this time the hdisks are ok.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.