106

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!

7
  • 1
    When it appears to hang, press ESC and note the last few lines on the display. Add them to your question.
    – Jos
    Apr 28, 2016 at 21:17
  • 10
    <joke> Does it show you this message: "It is now safe to turn off your computer"? </joke>
    – user300458
    Apr 28, 2016 at 21:57
  • 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?
    – user576136
    Aug 3, 2016 at 10:02
  • 7
    Seeing this problem in action, I would be ashamed to recommend Ubuntu anymore to a Windows user ... Aug 4, 2016 at 16:27
  • 4
    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!!
    – Delorean
    Jun 10, 2017 at 21:00

9 Answers 9

56

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.

11
  • 1
    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).
    – Frank N
    Oct 27, 2016 at 2:56
  • 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.
    – RedPixel
    Feb 18, 2017 at 10:29
  • @Ernesto: This worked for me.. To confirm I did 2-3 times restart/shutdown and all time it was booted without any problem. Thanks! Jul 4, 2017 at 9:12
  • Works for me! tnx ;)
    – Sdra
    Jul 18, 2017 at 15:13
  • This worked. Maybe it has something to do with a newer kernel version after running dist-upgrade?
    – xji
    Jan 26, 2018 at 14:59
16

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.

5
  • 1
    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. Dec 19, 2016 at 23:01
  • @xtrchessreal Your step 2 doesn't work for me. After reached target shutdown it keeps pumping out revalidation failed
    – horaceT
    May 11, 2017 at 1:10
  • @xtrchessreal Neither does step 1.
    – horaceT
    May 11, 2017 at 3:06
  • 3
    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. Sep 17, 2017 at 17:33
  • 2
    @DavidFoerster Downvoting requires 125 reputation. Sep 18, 2017 at 19:05
15

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.

3
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
4

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.

1
  • 1
    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.
    – ssasa
    Jun 13, 2019 at 13:26
3

Tdenham. I have the same situation. I just updated the system from 14.04 to 16.04 with do-release-upgrade -d.

If you don't have direct access to the system, and you really need to reboot, you might try hard reset as a workaround (as described here: https://major.io/2009/01/29/linux-emergency-reboot-or-shutdown-with-magic-commands/)

echo 1 > /proc/sys/kernel/sysrq 
echo b > /proc/sysrq-trigger

which does the trick. Probably you should run sync right before second command.

reboot -f may help but I didn't try it as I can't access server if it hangs again.

You may check /var/log/syslog file. Find the place where you turn on the computer and check lines right before that. You may paste it here.

My syslog:

Apr 29 11:21:48 bow NetworkManager[875]: <warn>  [1461907308.0752] dhcp4 (em0): request timed out
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.0753] dhcp4 (em0): state changed unknown -> timeout
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.0918] dhcp4 (em0): canceled DHCP transaction, DHCP client pid 2437
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.0918] dhcp4 (em0): state changed timeout -> done
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.0929] device (em0): state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]
Apr 29 11:21:48 bow NetworkManager[875]: <warn>  [1461907308.0943] device (em0): Activation: failed for connection 'Wired connection 1'
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.0970] device (em0): state change: failed -> disconnected (reason 'none') [120 30 0]
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1062] policy: auto-activating connection 'Wired connection 1'
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1101] device (em0): Activation: starting connection 'Wired connection 1' (df58434d-16fc-4036-b1d2-2cae515dbf19)
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1108] device (em0): state change: disconnected -> prepare (reason 'none') [30 40 0]
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1133] device (em0): state change: prepare -> config (reason 'none') [40 50 0]
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1152] device (em0): state change: config -> ip-config (reason 'none') [50 70 0]
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1167] dhcp4 (em0): activation: beginning transaction (timeout in 45 seconds)
Apr 29 11:21:48 bow NetworkManager[875]: <info>  [1461907308.1221] dhcp4 (em0): dhclient started with pid 2444
Apr 29 11:21:48 bow dhclient[2444]: DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 3 (xid=0x6cc9f4a)
Apr 29 11:21:51 bow dhclient[2444]: DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 4 (xid=0x6cc9f4a)
Apr 29 11:21:55 bow dhclient[2444]: DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 11 (xid=0x6cc9f4a)
Apr 29 11:22:01 bow CRON[2453]: (root) CMD (/usr/local/lib/wifictl)
Apr 29 11:22:01 bow CRON[2450]: (CRON) info (No MTA installed, discarding output)
Apr 29 11:22:06 bow dhclient[2444]: DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 20 (xid=0x6cc9f4a)
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Apr 29 11:23:34 bow rsyslogd: [origin software="rsyslogd" swVersion="8.16.0" x-pid="860" x-info="http://www.rsyslog.com"] start
Apr 29 11:23:34 bow rsyslogd-2222: command 'KLogPermitNonKernelFacility' is currently not permitted - did you already set it via a RainerScript command (v6+ config)? [v8.16.0 try http://www.rsyslog.com/e/2222 ]
Apr 29 11:23:34 bow rsyslogd: rsyslogd's groupid changed to 104
Apr 29 11:23:34 bow rsyslogd: rsyslogd's userid changed to 101
Apr 29 11:23:34 bow kernel: [    0.000000] Initializing cgroup subsys cpuset
Apr 29 11:23:34 bow kernel: [    0.000000] Initializing cgroup subsys cpu
Apr 29 11:23:34 bow kernel: [    0.000000] Initializing cgroup subsys cpuacct
Apr 29 11:23:34 bow kernel: [    0.000000] Linux version 4.4.0-21-generic (buildd@lgw01-21) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 (Ubuntu 4.4.0-21.37-generic 4.4.6)

It seems that dhclient tries to achieve ip address even when reboot is requested.

In case this is a hardware-dependent issue I pasted output of lspci, to help troubleshut it.

00:00.0 Host bridge: Intel Corporation Atom Processor D2xxx/N2xxx DRAM Controller (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Atom Processor D2xxx/N2xxx Integrated Graphics Controller (rev 09)
00:1c.0 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 2 (rev 02)
00:1d.0 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #1 (rev 02)
00:1d.1 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #2 (rev 02)
00:1d.2 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #3 (rev 02)
00:1d.3 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #4 (rev 02)
00:1d.7 USB controller: Intel Corporation NM10/ICH7 Family USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation NM10 Family LPC Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA Controller [AHCI mode] (rev 02)
00:1f.3 SMBus: Intel Corporation NM10/ICH7 Family SMBus Controller (rev 02)
01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
02:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
03:00.0 Network controller: Qualcomm Atheros AR9227 Wireless Network Adapter (rev 01)
3

I tried several methods including: editing /etc/default/grub, run sudo swapoff -a before shutdown, etc... But none of those worked for me.

Turning off USB 3.0 legacy mode in the BIOS worked for me.

2
  • I went to Advanced > USB Configuration > disabled Legacy USB Support, but it didn't solve the problem. Dec 19, 2016 at 22:42
  • 1
    The combination of disabling legacy mode in the BIOS and adding "acpi=force" to grub seems to be working. Jan 6, 2019 at 4:34
2

My solution is here

But in simple words:
sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="noefi"

3
  • 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. Oct 19, 2021 at 2:56
  • 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 Oct 19, 2021 at 3:02
  • 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. Oct 19, 2021 at 3:10
1

I had this problem on my ASUS Zenbook UX433FN and the solution I used was to update the BIOS. The BIOS version I had was 301 and updated it to 305. All these issues disappeared right after this updated.

I then reinstalled Ubuntu 18.04 and then installed NVIDIA drivers without any issues.

Note: I suggest installing the NVIDIA drivers BEFORE any other updates to verify if NVIDIA drivers can be successfully installed without interference of anything else.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .