O.S.I.R - 'Nothin' gonna, nothin' gonna , stop us now, stop us now...'

Today I tackled a constant, but annoying problem: the laptop won't shutdown.
That is not the same as turning off - if I hold down the power button for a few seconds, it will do a hard shutdown, and then complain on restart about not being cleanly shutdown.

Menu shutdown just reboots, only this time without my eth0 being active, or even noticed.
Okay, 2nd try:

         sh-4.1#   shutdown -now

         sh: shutdown: command not found

Okay...isn't shutdown a standard command, like ls or grep?
Checking the forums, I find this is a common problem, not
well understood, and attacked with a variety of magical incantations, such as:

          sh-4.1#   poweroff
The screen instantly went back, all hdd and network actvity stopped, but the laptop was still running.
Had to restart by pressing the power button, but on reboot, the network interface was down. Weird.
Back to the forums but all they could tell me is that the problem is subtle, and takes many forms.
Good results are reported with:

         sh-4.1#   rxvt -e wmpoweroff
Tried it, and success! But  why? rxvt is just a console, and -e is a switch, and the command is  wmpoweroff, which is a batch file, er, excuse me, a 'script'.
So why, when I re-start the computer, and just run
         sh-4.1#   wmpoweroff
all that happens is a warm reboot, and the network stops working.  
eth0 can't be found by any means at my command, until I do a hard reset, listen to the machine whine about being hard reset, and ta-da! I can reconnect to the network.
Now, when I try wmpoweroff, it just warm reboots. Great. Just great. So what was packaged as a shutdown script that should do something like:
log what needs logged
unspool whats spooled up
log everyone off
stop everything running
turn the power off
actually does something like:

If number of times run > 0, then {Fuck Shit Up
lose eth0 
log everyone off
restart everything but eth0}
else shutdown
The 'Fuck-shit-up-and-reboot' batch file. I know that polymorphic and self-modifying code is damn sexy, but is self-modifying scripts anything but an exercise in abuse?
One forum posted advises running halt and then doing a hard poweroff. This may work for him, but its about seven keystrokes longer than I'm prepared to type. Not to mention this little note in the halt man page:

"If halt or reboot is called when the system is not in runlevel 0 or 6, in other words when it's running normally, shutdown will be invoked instead (with the -h or -r flag)."

BUT IF I DON'T HAVE SHUTDOWN....what happens? It reboots, I suspect. The next person who tells me that Linux is a mature OS that my grandmother* could use as a M$ replacement is going to get a earful.

Permit me to quote from a smelloftheice  parody:**

Hitler (impatiently): "Well? What?"
Fegelein(in disguise): "Mein Fuhrer, we're here to turn this bunker into a total mess."

*Metaphorically speaking.

**Contains nazis.

No comments:

Post a Comment