Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When my Ubuntu freezes, is there a way to force reboot other than to hit the hardware reset button on my computer in order to ensure as best as possible that I don't corrupt any hard drive partition?

EDIT: What do I do if I can't even access the terminal?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

If your local keyboard is working, you can try the "magic keys"

First edit /etc/sysctl.conf

# Graphical
gksu gedit /etc/sysctl.conf

# Command line
sudo -e /etc/sysctl.conf

Add in the line (at the bottom)

kernel.sysrq = 1

"To perform a safe reboot of a Linux computer, use RSEIUB magic SysRq Magic combination key:

Hold Alt+PrtSc then type R+S+E+I+U+B , you need to press each key for 2-3 seconds."

http://www.unixmen.com/use-magic-sysrq-combination-key-to-recover-from-a-frozen-system-in-linux-ubuntu/

If you are not getting a response from the local keyboard or mouse, your only other option would be to try to ssh from another box.

You will need to install openssh-server first

sudo apt-get install openssh-server

You would then ssh in and shut it down. If you can ssh in, it helps to check the logs as well (before you shut down).

ssh user@froxen_box_ip

sudo shutdown -h now
sudo reboot
share|improve this answer
2  
I believe it's safer to do the sequence REISUB (that's reversed BUSIER), since it flushes fs data AFTER killing the user programs. –  elias Jan 23 '12 at 20:09

Yes. It is better to type Ctrl+Alt+F1 to arrive in the terminal (the real frightening one, yes). Then login and launch sudo reboot. That's a better way than just pushing the restart button.

But before rebooting, you may want to kill the problematic process. Type ps -ejH in the terminal to list the current processes. Spot which one is problematic (let's arbitrarily take the example of banshee). Then type killall banshee. Go back into your graphical interface by hitting Ctrl+Alt+F7.

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.