Ubuntu doesn't want to turn off

I have Ubuntu 12.04 with nmap and metasploit installed on it. My problem is when I try to shutdown, Ubuntu refuses to turn off. When I check the running processes, I see that PostgreSQL 9.1 is still in "stopping process" (I guess). The next time I try to stop PostgreSQL before shutdown, the case is still not solved.

After a frustrated time, I start to think to uninstall the metasploit with command ./uninstall but the result is still the same.

Is there anyone who know how to solve this problem?


If you have already done sudo halt, sudo shutdown -h now, sudo shutdown now or even init 0 and the system still does not actually shutdown, I suggest to first see in the logs which process is not shutting down correctly. I would start with syslog:

cat /var/log/syslog or better yet tail -n50 /var/log/syslog and see if there is anything in there mentioning the problem.

As you mentioned, you have removed several apps that you thought were the issue, even removing postgresql because it was the one that was showing as shutting down too slow.

Another very important part to check is your BIOS. Make sure, in the power management settings has the correct options enabled or set so that an OS can shutdown the computer.

Lastly, you can check some kernel options to see if the problem is power management related. In the terminal type:

sudo gedit /etc/default/grub

and on the line that says:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

Add in the second line one of this options:

  • noapic - Will turn off APIC.

  • acpi=off or noacpi - Will turn off ACPI.

  • acpi=force - Will Force use of ACPI.

It should look like this after editing (Example showing noapic)

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="noapic"

More information about this 2 options in What are the F6 options during installation?

After setting one of those, save the file and type in the terminal sudo update-grub. then reboot and test to see if the system shuts down.

If you still have a system that does not shutdown and has what you commented:

gnome-session[2464]: WARNING: Unable to stop system: Authorization is required

You might be suffering from one of this bug reports

  • https://bugs.launchpad.net/ubuntu/+source/unity-greeter/+bug/861171

  • https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/670289
    (App Related, but might apply to another specific app)

  • https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/880240

  • https://bugs.launchpad.net/ubuntu/+source/netbase/+bug/903825

You will find there suggestions that go from editing /etc/default/halt to changing the order of some services in the rc folders (rc0.d...rc6.d).

What I would suggest, at least until the bug is eliminated is to do a sudo kill -9 PROCESSID or sudo killall PROCESSNAME command on the process that is giving you a problem.