Jump to content

Shutdown/Poweroff Fix


ovof
 Share

81 posts in this topic

Recommended Posts

CycloneFR,

 

Did you do some more experiments with the RESTART thing / script? Shutdown seems to work when chud is installed...

 

did you paste from the ovov/cobranailscript:

 

FN=`date`

touch "/var/tmp/$FN"

/sbin/poweroff_fix

 

or only the last? line?

Link to comment
Share on other sites

  • 4 weeks later...
1) compile the file onecore.c with CHUD framework

 

 

Thanks a lot for this. I know it will work for me since when I boot with cpus=1 I am able to shut down.

 

I installed CHUD framework but I don't know how to compile this file.

 

I RTFMed the documentation that came with it but none of these appears to be a compiler.

 

Could somebody please point me in the right direction?

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

OK, so many thanks to everyone getting this workaround out. It's a sweet little hack. I had to sit down and figure out JUST WHAT WAS GOING ON, so maybe my experience can help shed some light on it:

 

(I guess this is kind of pedantic, so don't take it the wrong way that I'm trying to explicate the work of others. :( )

 

Edit: This package only works on Shutdown, not Restart, for some reason. There's a difference between the system-level "halt" (success) and "reboot" (failure) commands. I'll update this post if I find a solution.

Edit: Yeah, so I've given up on getting Restart working with a native kernel. Going to try Netkas's latest.

 

Technical Description

 

Problem:

Multi-core systems with a vanilla kernel refuse to fully shut down when instructed because, for some reason, the presence of more than one core is unanticipated.

Solution:

Write a script that manually kills the extra cores, so that when you shut down, only one core is still "alive," and the system goes down peacefully.

 

Note: technically, at this point, all you need to do is run ovof's binary--yourself, in Terminal--before you shut down, and everything will work correctly. But some prefer the convenience of not having a "shutdown checklist", so our friend cobranail at http://cobranail.blogspot.com/2008/01/laun...tartupitem.html compiled ovof's script, put it in a package, and wrote a StartupItem framework around it so it's "set and forget."

 

The way cobranail's package works is this:

  • A dummy "service" is created a startup and run by root called "shutdownfix"
  • This service, by sitting in the /Library/StartupItems directory, is run by the system automatically
  • But it doesn't do anything, until it is told to quit . . .
  • . . . which it is told to do when the system is shutting down . . .
  • . . . at which point it calls ovof's binary at /sbin/poweroff_fix and kills the extra cores.
  • Right after that, BAM. Shutdown.

Technically, in Leopard, we're all supposed to be using the launchd framework for this kind of stuff, and not StartupItems, but there's no real way to use launchd to listen for system shutdown, which is exactly what we want. So keep an eye on system updates in the future: given that scripts run in this fashion have fallen out of Apple's favor, their functionality might be overwritten at some point. If the problem reappears after an update, you know where to look.

 

Functional Description

 

If you're less concerned with the nuts and bolts of the solution, here's what you need to do:

 

Step 1: Download cobranail's package and install it. I did; it's safe and awesome.

Step 2: Restart.

Step 3: After you have restarted, the script will be in place. Try shutting down. Did it work? If yes, you're done; have a beer and enjoy the silence. If not, continue.

Step 4: OK, maybe the pre-compiled binary that is included in the package isn't working for your installation. Try compiling your own "poweroff_fix" binary.

Step 5: To do this, you need the CHUD framework from Apple. Follow the instructions in this thread to get it. You only need it to compile the binary--once you have done that and put your solution in place, you can get rid of it if you want.

Step 6: After you've installed the Dev tools and CHUD, compile ovof's binary with the OTHER instructions in this thread.

Step 7: Test your binary MANUALLY. Open /Applications/Utilities/Activity Monitor, tell the Dock icon to "Show CPU History" (so you can see what all the cores are doing), and get all your cores working--I don't know, go open a YouTube video or something--and run your binary in Terminal. Do all but one of the graphs in the Dock icon cut out? I.e., did the binary kill all the cores but one? Did you get some helpful text in the Terminal after running it, or did it give you an error?

Step 8: If it worked, great. Your binary belongs in the place cobranail's script calls it, /sbin/poweroff_fix -- so replace the one that's there with your custom-baked version. IF YOUR BINARY DID NOT WORK, I AM SORRY--I DON'T KNOW WHAT ELSE TO SAY. TRY NETKAS' HACKED KERNEL, I GUESS.

 

Conclusion

 

So, hey! Hope this helped. I learned a little bit about StartupItems in figuring this out, and since it wasn't covered in intense detail above, I thought I'd share what I learned. I think my favorite part about running an OSX86 Macintosh day in and day out is learning about all of the sweet internals behind OS X--even more than I enjor the the thousands of dollars I saved building my own quad-core behemoth. :)

Link to comment
Share on other sites

  • 2 weeks later...
for everyone that needs CHUD/Xcode check out this link:

http://developer.apple.com/tools/download/

you need an apple developer account (which is free)

you can get a working account at bugmenot.com:

http://www.bugmenot.com/view/developer.apple.com

First of all THANK YOU !

XCODE is on the green demon too :thumbsup_anim: if you don't wanna register

 

by the way is it legal to upload it to rapidshare , cose it's only 33.6 MB compressed ....

Link to comment
Share on other sites

A couple of posts up I said this worked for me - Well it worked the first time I tried to shut down after installing the script but it's not worked since.

 

So I've carried on with the instructions, I've got the .c file mentioned and have downloaded and installed the xcode package including CHUD.

 

But I really have no idea how to compile the onecore.c file. I just don't know what to do, I've not had to do anything like this before, can someone help me please?

 

Thanks..

Link to comment
Share on other sites

  • 4 weeks later...
Q6600 on GAP35DS3R -> No poweroff/shutdown (hang @ black screen)

 

In fact, this is a bug with more than 2 cores and ACPI.

 

Here's the fix

 

Short tuto :

1) compile the file onecore.c with CHUD framework

 

It will give you an executable which disable all cores but one. After this, shutdown/poweroff works well on vanilla and Q6600

 

2) manually launch this executable at shutdown, or make a startupitem to make this automatic (like i have)

 

It's great because you don't need any special binaries

 

Bye

 

 

My PC shut down perfect, but!!!! after ca. 2 - 4 sec. my PC starts automatically!!!!!

 

And now? :blink:

Link to comment
Share on other sites

My PC shut down perfect, but!!!! after ca. 2 - 4 sec. my PC starts automatically!!!!!

 

I've exactly the same problem with a GA-EP35-DS3P and Q6600 with a retail install.

 

Did you find the solution ?

Link to comment
Share on other sites

  • 2 weeks later...
I've exactly the same problem with a GA-EP35-DS3P and Q6600 with a retail install.

 

Did you find the solution ?

I don't know what the solution for you is probably some BIOS setting but just to confirm that I too have a GA-EP35-DS3P and Q6600 with a retail install & this fix enables me to shutdown cleanly & completely.
Link to comment
Share on other sites

HI,

 

I,ve tried single core solution and it didn't work. But I have realised that the shutdown/poweroff problem is related somehow to display sleep function.

I've set display to sleep for 1 minute.

On console I've used following:

# sleep 70;shutdown -h now

and I didn't touch the computer after the command. After 60 seconds display went to sleep and after 10 sec. computer shuted down completely without any problem.

 

Anybody that know something more about this?

Link to comment
Share on other sites

  • 2 weeks later...

Hey, Guy.

After install ShutdownFix and CHUD.pkg, I have random success shutdown.

Last week I have add Processor pane in to System preference.

 

 

Aha after that I have 100% success shutdown.

 

I don't know why but let's try.

Link to comment
Share on other sites

Hey, Guy.

After install ShutdownFix and CHUD.pkg, I have random success shutdown.

Last week I have add Processor pane in to System preference.

 

 

Aha after that I have 100% success shutdown.

 

I don't know why but let's try.

 

Wow, you're great!

Processor.prefPane (/Developer/Extras/PrefereancePanes/Processor.prefPane) from Xcode 3.0 installed and it works!!!

Link to comment
Share on other sites

works for me! But now i lost restart. I also have restart, not sure what i did to fix it as i added some fixes for getting ich9-R to show up in system profiler. I have a p5k premium running a q6600 on a vanilla kernel. Does anyone know of a restart fix for the vanilla install?

Link to comment
Share on other sites

 Share

×
×
  • Create New...