Bosse_B
Posts: 981
Joined: Thu Jan 30, 2014 9:53 am

How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 8:26 pm

I am going to upgrade my Raspbian distribution on a P1B so I can then transfer it to a microSD and use on a Pi2B.
But in the process, since I am paranoid, I want to make a backup image. So I need to shut down the Pi.
I entered
sudo shutdown now
via a PuTTY SSH connection and I lost connection a few seconds later.
But how can I know when it is all done so I can power off?
I have been waiting several minutes now but the LED's on the board are still on (yellow-green-green-red) so I assume something is still running.... :(

What is the deal here, is the Pi properly shut down or not?
Bo Berglund
Sweden

User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 8:33 pm

Try a sudo shutdown -h now The -h means "halt". Normally the ACT LED will blink steadily ten times when it is safe to turn off.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 8:39 pm

rpdom wrote:Try a sudo shutdown -h now The -h means "halt". Normally the ACT LED will blink steadily ten times when it is safe to turn off.
sudo poweroff has the same effect and has fewer characters to type, and could be aliased to even less :)

EDIT: sudo init 0 does the same as poweroff

Bosse_B
Posts: 981
Joined: Thu Jan 30, 2014 9:53 am

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 8:59 pm

Thanks,
I will do sudo poweroff when the upgrade is done.
I waited 10 min before pulling power to do the imaging and now it is busy with dist-upgrade.

The original SD is 8GB and the new microSD is 16 GB, will Raspbian expand to use the whole card if I write the 8GB image onto the 16 GB card and then start the Pi2 with it?
Bo Berglund
Sweden

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 9:02 pm

Run 'sudo raspi-config' on the new Pi and use 'expand filesystem'

User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 9:33 pm

asandford wrote:
rpdom wrote:Try a sudo shutdown -h now The -h means "halt". Normally the ACT LED will blink steadily ten times when it is safe to turn off.
sudo poweroff has the same effect and has fewer characters to type, and could be aliased to even less :)

EDIT: sudo init 0 does the same as poweroff
sudo halt does the same as poweroff on wheezy. The difference between "halt" and "poweroff" changed in jessie.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 10:09 pm

rpdom wrote:
asandford wrote:
rpdom wrote:Try a sudo shutdown -h now The -h means "halt". Normally the ACT LED will blink steadily ten times when it is safe to turn off.
sudo poweroff has the same effect and has fewer characters to type, and could be aliased to even less :)

EDIT: sudo init 0 does the same as poweroff
sudo halt does the same as poweroff on wheezy. The difference between "halt" and "poweroff" changed in jessie.
I come from a Sun / AIX (and mainframe) background where these may not have existed (only really used init # to get to the run level I wanted on unix boxes ) .

User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How can I know when the Pi has finished shutdown?

Fri Feb 20, 2015 10:29 pm

asandford wrote:I come from a Sun / AIX (and mainframe) background where these may not have existed (only really used init # to get to the run level I wanted on unix boxes ) .
Same here, but then I moved to Linux some 15 years ago.

Bosse_B
Posts: 981
Joined: Thu Jan 30, 2014 9:53 am

Re: How can I know when the Pi has finished shutdown?

Sat Feb 21, 2015 3:44 pm

I can't start up the Pi2 today because I feel I have to hook it up to the TV to see what is going on and I don't have access to that right now...
But here is a new question:
Does Raspbian sense on startup that the CPU has changed and does it then modify the kernel or otherwise require user confirmations? If that is the case then I also need to hook up the keyboard to the Pi2...

One thing that definitely will have changed is the IP address since the MAC address would be different from the old Pi1 and my router has a reserved address for that MAC.
Once I can see the Pi2 in my router I will change the reservation since there are port forward rules targeting this address.
Could be other things as well..
Bo Berglund
Sweden

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: How can I know when the Pi has finished shutdown?

Sat Feb 21, 2015 3:53 pm

I had one Pi1 to Pi2 conversion that showed a networking problem at first. I noticed that it had created eth1 instead of eth0.
IIRC this is caused by udevd rules and this rule is stored in /etc/udev/rules.d/70-persistent-net.rules
It may or may not be present on your system.
If it is then moving this file out of the way (or deleting it) should prevent the problem.

Can't think of anything else that would get in the way.

Bosse_B
Posts: 981
Joined: Thu Jan 30, 2014 9:53 am

Re: How can I know when the Pi has finished shutdown?

Sat Feb 21, 2015 4:30 pm

DirkS wrote:I had one Pi1 to Pi2 conversion that showed a networking problem at first. I noticed that it had created eth1 instead of eth0.
IIRC this is caused by udevd rules and this rule is stored in /etc/udev/rules.d/70-persistent-net.rules
It may or may not be present on your system.
If it is then moving this file out of the way (or deleting it) should prevent the problem.
On my Pi1 after I did the upgrade and then started it I see this:

Code: Select all

pi@raspbian-pi /etc/udev/rules.d $ ls -l
total 8
-rw-r--r-- 1 root root 114 Jan  7  2014 40-scratch.rules
-rw-r--r-- 1 root root  47 Jan  7  2014 99-input.rules
So there seems to be no 70 file.
Does this mean I am good to go?
(The SD has been imaged to a microSD, which sits in my Pi2, but has not yet been started.)
Bo Berglund
Sweden

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: How can I know when the Pi has finished shutdown?

Sat Feb 21, 2015 4:34 pm

Yes, go for it

Return to “Raspberry Pi OS”