Ubuntu 16.04 hangs on shutdown/restart

305,725

Solution 1

I too had this issue. It appears to be a bug in multiple distributions.

My simple fix was to edit /etc/default/grub line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=force"

Run update-grub.

Works every time now. I use a Lenovo G50 laptop. I'm pretty sure I changed this line in Grub with previous (other) linux distros on this laptop too.

Solution 2

Once you have finished your work and completed closing all your applications in order to shutdown or reboot your OS please follow these steps to alleviate frustrations.

  1. Try sudo swapoff -a && systemctl poweroffas a workaround for now.
  2. There is a potential fix in Xenial-proposed in the systemd 229-4ubuntu5 package. Go to your System Settings->Software and Updates->Developer Options tab click the box next to Pre-release (xenial-proposed). enter your root pwd, Refresh the cache. Updates tab use "display updates immediately drop down" close System Settings. Start software updater and install now.
  3. If you still have the issue try reading these bugs: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1464917 for information on how to get log data and as suggested there file a new bug report. Also read bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788303.
  4. Follow the debugging instructions described in the "Debugging boot/shutdown problems" section of /usr/share/doc/systemd/README.Debian.gz to check if there are any hanging jobs at shutdown. You will need to start the debug shell prior to each shutdown or reboot by entering: systemctl start debug-shell Capturing a screen photo of journalctl -b in the rescue shell ctl+alt+F9 might be enlightening. Also the output of systemctl list-jobs and systemctl --failed Besides a screen shot you can dump the output of these commands and appended each into the same "filename.text" on / root by adding >>filename.text at the end of the commands e.g. journalctl -b >>filename.text journalctl -xe >>filename.text systemctl list-jobs >>filename.text systemctl --failed >>filename.text lsblk >>filename.text All of these will be in the same file appended together for you to analyze upon your next boot and if you do file a bug report it can be helpful to attach the file into your bug report.

Update

I had these Hangs for quite a while but was eventually at a point where I learned my HDD was beginning to fail sectors etc. So, it was time for a new HDD and reinstall. I reinstalled the OS on a single boot HDD with Swap as the 1st, Root as 2nd, and Home as 3rd logical partitions as per recommendations from Ubuntu. Technically, sda1 is Grub, sda2 is Extended, sda5, sda6, sda7 are swap, root, and home respectively; sda3 and sda4 are not present. This problem has not been present on the newly installed OS on the HDD since then, 9+ months approximately. I am running 16.04.02 LTS at this point without any of the Hangs on restart or shutdown. The previous OS was a dual install Win7/Ubuntu and the Swap partition was at the end of the HDD.

I am not stating that this problem is tied to a dual boot system, a failing HDD, or the order in which I placed the partitions but, in my case one, two, or all of these factors existed. Now, I do not suffer the aggravation of the "Reached Target Shutdown" hang.

Solution 3

I had an issue with hanging on shutdown, this is what I did:

OPEN TERMINAL

sudo -H gedit /etc/default/grub

Change the line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="acpi=force"

By removing quiet and splash allows text during shutdown, helps to see where the hang may be.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" Removing "quiet" out here will display a text output during the boot, whereas removing "splash" will display a black screen instead of the splash image.

Save and close Gedit

Then update Grub in terminal:

sudo update-grub

ADDITIONAL:

I noticed I had a 'STOP JOB' running too, so I reduce the timeout in /etc/systemd/system.conf:

sudo -H gedit /etc/systemd/system.conf

remove # and change timings in the following lines:

DefaultTimeoutStartSec=5s

DefaultTimeoutStopSec=5s

Then run:

sudo systemctl daemon-reload

This worked for me.

Solution 4

I've tried almost all suggestions here. The only action that solved my same problem of shutdown/reset was changing DefaultTimeoutStartSec & DefaultTimeoutStopSec in /etc/systemd/system.conf to '10':

sudo -H gedit /etc/systemd/system.conf

and then edit to

DefaultTimeoutStartSec=10s
DefaultTimeoutStoptSec=10s

Solution 5

I was just experiencing somewhat the same issue, restarting would take me to a black screen or sometimes a black screen with blinking cursor and it would never accomplish, I have to note I didn't have a problem with shut down.

So what I did was, I opened Drive Manager, and I installed Intel-Microcode firmware for the CPU, I shutdown the computer, and then I tired restarting the OS, and it finally worked.

Changing from Do not update the CPU microcode to intel-microcode

I'm on Linux Mint Cinnamon 18.3 which is based on Ubuntu Xenial Xerus 16.04 LTS.

Adding the comment of user ssasa in the answer since it could help others and might get purged with the "no longer needed" flag:

Tried every Answer here and none help. But this was the closest. Changing from open source driver nouveau to Nvidia proprietary driver helped in my case.

Share:
305,725

Related videos on Youtube

Tdenham
Author by

Tdenham

Updated on September 18, 2022

Comments

  • Tdenham
    Tdenham over 1 year

    My Ubuntu 16.04 hangs on shutdown/restart requiring me to press and hold the power key to turn the machine off... I don't know how to report this as a bug and what commands to run to show the necessary hardware/sys log info? Any help would be hugely appreciated!

    • Jos
      Jos about 8 years
      When it appears to hang, press ESC and note the last few lines on the display. Add them to your question.
    • user300458
      user300458 about 8 years
      <joke> Does it show you this message: "It is now safe to turn off your computer"? </joke>
    • Admin
      Admin almost 8 years
      Same problems here. > Blockquote Turning off USB 3.0 legacy mode in the BIOS worked for me. > Blockquote How can I turn off USB 3.0 legacy mode?
    • ROMANIA_engineer
      ROMANIA_engineer almost 8 years
      Seeing this problem in action, I would be ashamed to recommend Ubuntu anymore to a Windows user ...
    • Gosha U.
      Gosha U. over 7 years
      The only thing has helped me was the BIOS update. How to know, you need it: if you cannot exit BIOS setup as well, you're completely need it. I had this problem with MSI H170A PC Mate and Skylake. Earler, I had added acpi=force to grub and updated kernel to 4.6.7.
    • Delorean
      Delorean almost 7 years
      This is embarrassing! Why did this simple task stop working??? All fixes I've found do not work, including adding to the grub line, disabling swap, and even changing graphics drivers and going back to older kernels. NOTHING WORKS. This is such an amateur mistake. An OS should be able to turn off!!
    • Owl
      Owl almost 5 years
      ROMANIA_engineer: I don't call it n00buntu for no reason. Apparently though the halt hanging is expected behaviour.
  • Frank Nocke
    Frank Nocke over 7 years
    This just saves you from pressing <kbd>ESC</kbd> to see the shutdown logging information. No other effect. (Perhaps updating aka regenerating grub files fixed something else).
  • ROMANIA_engineer
    ROMANIA_engineer over 7 years
    I went to Advanced > USB Configuration > disabled Legacy USB Support, but it didn't solve the problem.
  • ROMANIA_engineer
    ROMANIA_engineer over 7 years
    The 2nd step worked for me, but the result was visible only after another forced restart. Now I can Shut Down / reboot the PC. Steps: 1. Search your computer > Software & Updates > Developer Options tab > check Pre-released updates (xenial-proposed) > Close. 2. Go to Search your computer > Software Updater.
  • RedPixel
    RedPixel about 7 years
    I have tried update-grub first, which did not work. Then I changed it to GRUB_CMDLINE_LINUX_DEFAULT="acpi=force", and that fixed my problem.
  • thewebjackal
    thewebjackal about 7 years
    well, this guy has something else to say regarding DefaultTimeoutStartSec being set to a value so low. ubuntu-mate.community/t/…
  • horaceT
    horaceT almost 7 years
    @xtrchessreal Your step 2 doesn't work for me. After reached target shutdown it keeps pumping out revalidation failed
  • horaceT
    horaceT almost 7 years
    @xtrchessreal Neither does step 1.
  • Saurav Kumar
    Saurav Kumar almost 7 years
    @Ernesto: This worked for me.. To confirm I did 2-3 times restart/shutdown and all time it was booted without any problem. Thanks!
  • Sdra
    Sdra almost 7 years
    Works for me! tnx ;)
  • David Foerster
    David Foerster over 6 years
    To the anonymous user who keeps suggesting the same destructive edits to this answer: Please don't do that! If you disagree with a post create an account and once you have 15 reputation you can down-vote it to show you disagreement. That's what down-votes are for. With 50 reputation you can also leave a comment to elaborate on it.
  • Eliah Kagan
    Eliah Kagan over 6 years
    @DavidFoerster Downvoting requires 125 reputation.
  • Manish Kumar Bisht
    Manish Kumar Bisht over 6 years
    acpi=force turns off the display but power button still remain on. 😂
  • xji
    xji over 6 years
    This worked. Maybe it has something to do with a newer kernel version after running dist-upgrade?
  • Eric FD
    Eric FD about 6 years
  • dotz
    dotz about 6 years
    Mods locked adding new answers, but what worked for me was your solution and this: forum.level1techs.com/t/ubuntu-16-04-hanging-on-reboot/11241‌​3 - setting GRUB_CMDLINE_LINUX_DEFAULT="quiet splash reboot=warm,cold,bios,smp,triple,kbd,acpi,efi,pci,force" did the job. I had problems with HP ProLiant server with Xeon E5620 and Ubuntu 16.04.02.
  • MrJman006
    MrJman006 about 6 years
    I don't fully understand why this would work, but it ended up working in my case. I'm using XUbuntu 16.04 on Razer Blade 2016 laptop.
  • Matjaž
    Matjaž about 6 years
    Works on Ubuntu 16.04.4 LTS
  • yugantar kumar
    yugantar kumar about 6 years
    @Ernesto: I tried the same solution on my ubuntu 16.04 but it didn't work. My config in grub file is: GRUB_DEFAULT=0 #GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=force" GRUB_CMDLINE_LINUX="" Should I change something else as well to make it work?
  • Jeremy Cook
    Jeremy Cook over 5 years
    The combination of disabling legacy mode in the BIOS and adding "acpi=force" to grub seems to be working.
  • ssasa
    ssasa almost 5 years
    Tried every Answer here and none help. But this was the closest. Changing from open source driver nouveau to Nvidia proprietary driver helped in my case.
  • Tobias Feil
    Tobias Feil almost 4 years
    thank you so much, this saved me from reinstalling the OS
  • Shunjid Rahman
    Shunjid Rahman about 3 years
    Thanks, It worked. But why?
  • Jan Johansson
    Jan Johansson over 2 years
    I have the same problem on Peach OSI TW 16.04 LTS which now run on 4.4.0-217-generic kernel , but it started with 4.4.0-216-generic.
  • Jan Johansson
    Jan Johansson over 2 years
    Editing grub with grub customizer and adding the noefi after quiet splash seems to work , but not always. Looking at Launchpad this seems to be a confirmed bug, and also seem nothing is being done to change it because 16.04 is out of support. link to launchpad bug bugs.launchpad.net/ubuntu/+source/linux/+bug/1594023
  • Jan Johansson
    Jan Johansson over 2 years
    My laptop is Lenovo Thinkpad X300 with intel 160GB SSD and Core2Duo, it has the newest and last bios and ran fine before 4.4.0-216-generic kernel.