5

I always shut down the system with halt, which is the equivalent of shutdown -h now. On every linux system I've ever used, including up until recently the pi, this halts the system and turns off the power if the hardware is capable.

On the pi -- again, up until recently -- it just shuts the system down so that the power can be unplugged. I generally leave it on 24/7, but occasionally I want to disconnect it from power to tinker or whatever. Sometime in the past few months, I noticed that it was rebooting immediately, and I kind of shrugged it off; I have an 8x8 LED attached as a system monitor, so I'd wait until it signaled runlevel 0 had run then yank the cord.

That's not really ideal IMO, and I am absolutely completely totally positive it was not doing this until recently; I've had the pi for the better part of a year. I just spent some time using shutdown with various switches (-h, -f, -P, -n) and combinations of switches, and none of them will halt the system without triggering an immediate reboot.1

My first thought is that something is causing a quick voltage drop and that triggers the reboot, but that's just a thought. So my questions are:

  1. Has anyone else noticed this?

  2. Does anyone have any idea about why it would happen? A recent firmware update? [As it turns out, I hadn't been updating the firmware -- see my answer].


1 Correction : shutdown -fn now will halt it, although this means skipping the init scripts intended to stop services correctly (BTW I don't see anything in /etc/rc0.d that would cause the reboot) and mysteriously leaves the board's ethernet lights on, presumably because the networking service was not properly stopped.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
  • 2
    I did some testing with my Raspberry Pi, and it did not experience the behavior your are describing, odd. – syb0rg Dec 10 '13 at 05:01
  • @syb0rg : Yeah, this is for sure a fairly recent change in behavior. – goldilocks Dec 11 '13 at 10:35
  • 1
    Any chance, Wake-On-LAN is causing this? Is it an immediate reboot? – Linus Kleen Dec 11 '13 at 12:43
  • 1
    I can't find anyone claiming to have actually gotten WOL to work on the pi, so if it is I guess I am lucky, ;). Anyway, it's an immediate reboot, yeah. – goldilocks Dec 11 '13 at 12:54
  • Does it also happen if you disconnect all USB, GPIO, and network cables? – Gerben Dec 11 '13 at 14:33
  • @Gerben : The only thing I've tried disconnecting is the audio jack, since I recently started using a different amp with it. Everything else is the same as before the problem started, except one 3.3V I2C device -- but I haven't tried detaching the GPIO leads yet because I have to dissemble the case first; I should get around to that soon. – goldilocks Dec 11 '13 at 14:44
  • I've also noticed this happening on one of my two Raspberry Pis just recently. I've updated both to the latest software and firmware but this has not changed the situation. The one that reboots after halting is a later version model B with the 512K ram. The old one with 256K ram still halt properly. Is it possible that some minor HW difference interacting with a recent software upgrade is causing this ?? –  Dec 14 '13 at 02:00
  • I was having the identical issue. sudo shutdown -h now resultes in a reboot. However, sudo shutdown -P now works. Weird, but there you go. – user78978 Jan 07 '18 at 10:17

2 Answers2

3

I installed and ran rpi-update. This replaced a lot of files in /boot, and, I noticed, installed a lot of modules for a 3.10.24+ kernel, which I wasn't aware existed (my git clone of the archive was fixed on 3.6.11, and that's the latest one I had on the pi).

So I built 3.10.24+ (the current stable for the pi) using /proc/config.gz from my 3.6.11 kernel -- i.e., I did not change the configuration at all. This potentially overwrote the stuff in /lib/modules/3.10.24+ installed by rpi-update, so I ran that again (first removing /boot/.firmware_revision to make it do everything over). Unfortunately, the modules from rpi-update did not jibe ("disagrees about version of symbol module_layout"). I couldn't resolve that,1 so I went back to my vanilla modules directory from the build.

Rebooting at this point solved the problem. It is worth noting that it persists with the old kernel, so it was not simply a matter of the firmware in /boot; also I rebooted after the firmware revision, before building the new kernel. However, the rpi-update README does note "some firmware updates might depend on a kernel update" (although AFAICT, rpi-update doesn't provide a kernel update!). To summarize:

  • Running rpi-update with 3.6.11 kernel did not fix the problem.

  • Installing a 3.10.24+ kernel after rpi-update did fix the problem. This kernel was built starting with the same .config as the 3.6.11 kernel. I did not use the /lib/modules stuff installe by rpi-update as the kernel rejected them.

  • Reverting to the old kernel causes the problem to return.

I'm perplexed as to why this would have happened in the first place, but it could be that it did start with my last build of 3.6.11; the only difference between that and the previous one was making i2c-dev a built-in.


1 Perhaps they are intended for a pre-built kernel available from...somewhere.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
0

I really don't know the cause of that behaviour, but to shutdown my RPIs, I usually use poweroff, which, I think is equivalent to shutdown -h now:

$ sudo poweroff

Hope it will help.

Ghanima
  • 15,578
  • 15
  • 58
  • 113