Ubuntu Hangs on Shutdown - Troubleshooting Tips

Ubuntu Hangs on Shutdown - Troubleshooting Tips
Page content

The Problem

You have your shiny new Ubuntu system up and running and everything seems to be working fine. You then go to shut down for the first time and the system hangs, unable to complete the shutdown sequence. Is this fatal to your Ubuntu install? No, it’s not. However, it does mean that one of your system services is having a problem when trying to properly terminate itself. You can simply power your system off and the next time you boot, chances are everything will be fine … until the next time you attempt a full shutdown. You could, in theory, continue to do a hard shutdown of your system for quite some time, but we’re Linux users! Lets investigate and fix the problem instead of ignoring it.

Probable Solution

The first thing you will want to look at when experiencing shutdown problems is ACPI (Advanced Configuration and Power Interface). This, in my experience, is the most common culprit when it comes to Linux shutdown problems. When troubleshooting ACPI, please follow the steps below:

  • Try booting with the “acpi=off” kernel parameter: This will disable ACPI support. If the error is the same with acpi enabled and disabled, you are probably not having an ACPI issue. If that is the case, please see the section of this article titled “Other Possible Solutions”.
  • If “acpi=off” allows the system to boot, you will need to isolate the ACPI issue by trying each of the following boot parameters.
  • Try booting with “acpi=ht”: This disables all of ACPI except just enough to enable Hyper Threading. If acpi=off works and acpi=ht fails, then the issue is in the ACPI table parsing code itself, or perhaps the SMP code.
  • Try booting with “pci=noacpi”: This disables ACPI for IRQ routing and PCI scanning.
  • Try booting with “acpi=noirq”: This disables ACPI for IRQ routing.
  • Try booting with “pnpacpi=off”: This disables the ACPI component of the Linux Plug and Play code.
  • Try booting with “noapic”: This disables the IO-APIC for IRQ routing or PCI scanning.
  • Try booting with “nolapic”: This disables the local APIC.

With any luck one of these extra boot parameters has solved your problem with Ubuntu hanging on shutdown. If not, ACPI was not the problem and we’ll need to look at other possible solutions. Please skip ahead to “Other Possible Solutions”. If one or more of these boot parameters solved your problem with Ubuntu hanging on shutdown consult the next section on how to make the changes permanent.

Making the ACPI Boot Parameters Permanent

If one of the above boot parameters solved your problem with Ubuntu hanging on shutdown you will want to make the changes permanent to avoid having to enter them with each boot. In this section we will look at making the changes permanent assuming you are using Ubuntu’s default boot loader, Grub. In order to permanently change your boot options, you’ll need to edit the /boot/grub/menu.lst file.

Before you begin, open a terminal window and type this command to back up the file:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.old

Type this command to edit the menu.lst file:

sudo nano /boot/grub/menu.lst

You can use any text editor to edit this file, Nano is just my personal favorite. Next you will want to locate the line that starts with “# kopt=” and add whichever boot option(s) fixed your Ubuntu shutdown problems to the end of the boot command, with a space between each one.

The last step will be to update your Grub installation with the following command:

sudo update grub

Other Possible Solutions

If you have tried the solution above to troubleshoot potential ACPI problems and Ubuntu still hangs on shutdown you will need to start going over your log files looking for any error messages.

A couple of things in particular to pay attention to are:

Network interface errors: If a network interface is not terminating properly this can cause long delays in your shutdown, often appearing to make your shutdown hang. Most times the network interface will timeout eventually but even so you will want to troubleshoot this problem to avoid long delays in your Ubuntu shutdown. Pay particular attention to any lines containing eth0, eth1, etc.

Other services not terminating properly: Any number of services may be having problems terminating properly, causing your Ubuntu shutdown to hang. A thorough inspection of your log files may give you a clue as to what service is causing the problem so you can take steps to troubleshoot that specific problem.

Useful Troubleshooting Tip

If you have followed the instructions in this article and still experience problems with your Ubuntu Linux distro hanging on shutdown, you can enable verbose booting and shutdown in your kernel options. I find this to be a very useful option to enable, and tend to leave it enabled at all times so I notice any potential problems with Ubuntu booting and shutting down. To enable verbose booting and shutdown in Ubuntu:

Before you begin, open a terminal window and type this command to back up the file:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.old

Type this command to edit the menu.lst file:

sudo nano /boot/grub/menu.lst

Near the end of this file you will find your kernel listing similar to the above graphic. You will want to remove the “quiet” option from the kernel line of your default kernel. Update Grub:

sudo update-grub

The result of this modification will be a verbose boot and shutdown screen. You will want to look for problems during your Ubuntu boot and shutdown for problems. Modules and services that are loaded will be followed by , if any modules or services are having a problem the line will report a showing you what area of your system to investigate next.

Useful Troubleshooting Tip: Images

Ubuntu Kernel Options

Ubuntu Kernel Options Verbose

Ubuntu Verbose Shutdown

Ubuntu Verbose Boot

If All Else Fails

If none of these troubleshooting tips resolved the problem with Ubuntu hanging on shutdown you still have a couple good places to turn to help you resolve your problem. The first thing I would recommend following these tips would be to visit the Ubuntu Forums and post your problem there. Be sure to include the contents of /var/log/messages and /var/log/dmesg as well as any errors you have seen since turning on verbose booting and shutdown. This will give members the initial information they will need to help you resolve your problem and avoid delays.

Lastly, if you have had no luck with any of these troubleshooting tips there may be a bug in the version of Ubuntu you are running. Your final step should be to visit the Ubuntu bug-tracking system on launchpad and search for similar problems, and failing to find a bug report, file a report yourself. Rarely will it come to this. Good luck and keep it Open Source!

References

  • Author’s own experience.
  • Images provided by article author.