Posts: 9
Joined: Sat Oct 20, 2012 3:37 pm

Can't login cause shutdown command

Sun Dec 02, 2012 10:10 am

Hi all,
I got a trouble, i've just entered

Code: Select all

 sudo shutdown -1 
the response
the system will going down in 1 minute
I wait long enough but the shutdown process is never run, then in deppression i wrote

Code: Select all

 sudo pkill shutdown 
but after that i can't use shutdown command anymore
the error said shutdown process is already running
i turn off the pi with unplug the power source.
when i turn on again i can't login cause everytime i entered my username ('pi') there are a error said
the system is going down on Sun Dec 2 09:46:23 2012
the problem is i don't know what time i set in raspberry, now almost two hours since that message showed.
Please help me by telling what should i do.
can i change the time without loading it? i mean change something in sd card?
or how i can login and change the time?

Posts: 9
Joined: Sat Oct 20, 2012 3:37 pm

Re: Can't login cause shutdown command

Mon Dec 03, 2012 10:27 am

Nobody knows? please help

User avatar
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Can't login cause shutdown command

Mon Dec 03, 2012 10:36 am

what happens with just a

sudo shutdown -h now

I can't say I have ever tried the time limit shutdown.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

User avatar
Posts: 114
Joined: Thu Sep 20, 2012 4:52 pm
Location: Williamsburg, VA, USA
Contact: Website

Re: Can't login cause shutdown command

Mon Dec 03, 2012 1:48 pm

When a time delay or specific time is used in the shutdown command, the file /etc/nologin is created.
The existence of this file causes the login process to give you that error.

I see two options. The hard one is to mount the sdcard on another linux system and delete the /etc/nologin file.

The easier way is to put the sdcard into a Windows system. The drive that you will see is the /boot directory.
Now edit the cmdline.txt file and add " init=/bin/sh" to the end of the line.

This will cause the system to boot straight into a shell instead of running the init process.
You may get an error, something like "can't access tty"
Just press enter or Control-C and you should get a prompt.
then just "rm /etc/nologin"

Remember to edit /boot/cmdline.txt to remove the stuff you added so that it will reboot normally.

Hope this works for you.
- Ted B. Hale

Posts: 359
Joined: Mon Dec 03, 2012 2:47 am
Location: Elgin, IL USA

Re: Can't login cause shutdown command

Mon Dec 03, 2012 8:49 pm

If you type "man " (without quotes) and a command, you can read more information about that command. You are missing the -h (halt) or -r (reboot) flag. From "man shutdown":

"... runlevel 1 is used to put to system into a state where administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown."

Also pay attention to "-t sec" (sec is time in seconds from now) or "time" which is explained farther down in man shutdown. It does not mention a negative time, so maybe that means never.

In the future it would be best to use:
sudo shutdown -h now (to halt)
sudo shutdown -r now (to reboot)

Although, if connected by ssh it may be better to give it time and fork it into the background with "&" to give you time to disconnect gracefully:
sudo shutdown -h +1 &
(or -r instead of -h, and give it a couple of minutes before reconnecting)

(long time Linux user for more than 15 years)

User avatar
Posts: 606
Joined: Fri Aug 17, 2012 3:35 am
Location: Mesa, AZ
Contact: Website

Re: Can't login cause shutdown command

Mon Dec 03, 2012 9:06 pm

I access my RPi via ssh only....

Best description I've seen of Shutdown is:
Shutdown allows for a time factor and a warning message to other users on the system. Halt is LIGHTS OUT with no warning.
Since I am normally the only one on the RPI, I just use either halt or reboot to do those functions.

If you have console setup (Serial for example) you can see the system go through the shutdown process when you use either.

When halting, if you watch the ACK light (If you can see it), just before it shuts down the OS the ACK light will blink rapidly 8-9 times. When you see that, you can safely remove power from the unit as the OS is now down.
Dweeber A.K.A. Kevin...
My RPI Info Pages including Current Setup - http://rpi.tnet.com

Posts: 9
Joined: Sat Oct 20, 2012 3:37 pm

Re: Can't login cause shutdown command

Tue Dec 04, 2012 2:19 pm

Thanks for the helps, i'll try tedhale suggest cause i realize my clock is not ticking since then... so i"ll try to remove that file, hope that helps.
I don't try the rest of suggestion cause what i can only do at raspberry pi when booting is just insert the username. i can't write command in linux anymore, the pi is always show error message and then ask for user again. infinite looping happen.

Posts: 1
Joined: Fri Dec 07, 2012 2:40 pm

Re: Can't login cause shutdown command

Fri Dec 07, 2012 2:53 pm

Thank you Ted B. Hale for your suggestion. I had created the same problem by using the shutdown command incorrectly. I used your windows suggestion to fix it.The only thing I had a problem with was editing the cmdline.txt file. I initially copied and pasted your suggestion into the file using notepad but this did not work. I then opened the file in Notepad and typed the command in and that worked fine. I can only assume that using copy and paste must have put some hidden charcter into the file.

Thanks again for your help.

Return to “Troubleshooting”