Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My pc with ubuntu server 12.10 installed on it shutdowns itself. How can i find the reason? I think that it is not depend on hardware.

any help will be appreciated

share|improve this question
    
this would be better suited to askubuntu.com, I think –  evilsoup Jan 7 '13 at 17:06

2 Answers 2

The most common reason for this behavior is over-heating. Is this a laptop? Can you feel the machine heating up before it shuts down?

Relevant log files should be in /var/log, specifically, have a look at /var/log/messages and maybe /var/log/pm-powersave.log and /var/log/pm-suspend.log.

share|improve this answer

This answer, with optional (but important in case of overheating) shutdown -r $1 after the echo:

The way I'd track this down is to replace the utilities halt and shutdown with a script.

First create a script such as the following at /bin/fakehalt:

#!/bin/bash
exec >>/tmp/fakehalt.log 2>&1
date
echo "CMD=$0 PID=$$"
ps -ef --forest
echo '========'

Then install it with:

chmod a+x /bin/fakehalt
mv /sbin/halt /sbin/halt.orig
ln -s /bin/fakehalt /sbin/halt
mv /sbin/shutdown /sbin/shutdown.orig
ln -s /bin/fakehalt /sbin/shutdown

This will create a log file at /tmp/fakehalt.log each time it is called. It'll log the name it was called as (halt or shutdown) it's own PID, and then a tree diagram of all processes at the time.

This should give you all the necessary info to track it down. Just look through the ps tree and find what called the script.


/sbin/reboot should be a symlink to /sbin/halt. If it isn't, then replace it as well.


If this still doesn't capture it, replace /sbin/init as well (as it can also be used to reboot the system). But this is dangerous as if the system reboots, it won't come up properly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.