当前位置: 首页>>技术问答>>正文


Ubuntu 16.04在关机/重启时挂起

, , , ,

问题描述

我的Ubuntu 16.04在关机/重启时挂起,要求我按住电源键关闭机器……我不知道如何将此报告为错误以及运行哪些命令来显示必要的硬件/系统日志信息?任何帮助将非常感谢!

最佳解决办法

我也有这个问题。它似乎是多个发行版中的一个错误。

我的简单修复是编辑/etc/default/grub行:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=force"

运行update-grub

现在每次都有效。我使用联想G50笔记本电脑。我很确定我在这台笔记本电脑上用以前的(其他)Linux发行版改变了Grub中的这一行。

次佳解决办法

完成工作并完成关闭所有应用程序以关闭或重新启动操作系统后,请按照以下步骤缓解挫折感。

  1. 立即尝试使用sudo swapoff -a && systemctl poweroff作为解决方法。

  2. 系统229-4ubuntu5软件包中的Xenial-proposed存在潜在的修复方法。转到系统设置 – >软件和更新 – >开发者选项选项卡,单击Pre-release(xenial-proposed)旁边的框。输入你的root pwd,刷新缓存。更新选项卡使用“显示更新立即下拉”关闭系统设置。启动软件更新程序并立即安装。

  3. 如果您仍有问题,请尝试阅读这些错误:https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1464917以获取有关如何获取日志数据的信息,并按照建议提交新的错误报告。另请阅读错误:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788303

  4. 按照/usr/share/doc/systemd/README.Debian.gz的“调试启动/关闭问题”部分中描述的调试说明检查关闭时是否有挂起作业。您需要在每次关闭或重新启动之前启动调试shell,方法是输入:systemctl start debug-shell在救援shell ctl+alt+F9中捕获journalctl -b的屏幕照片可能具有启发性。此外,systemctl list-jobssystemctl --failed的输出除了屏幕截图,您还可以转储这些命令的输出,并通过在命令末尾添加>>filename.text将每个命令附加到/根目录上的相同”filename.text”中。 journalctl -b >>filename.text journalctl -xe >>filename.text systemctl list-jobs >>filename.text systemctl --failed >>filename.text lsblk >>filename.text所有这些都将在同一文件中附加在一起,供您在下次启动时进行分析,如果您确实提交了错误报告,将文件附加到您的错误报告中会很有帮助。

更新

我有这些Hangs很长一段时间,但最终我知道我的硬盘驱动器开始出现故障扇区等。所以,是时候换新的硬盘并重新安装了。我根据Ubuntu的推荐,在单个启动硬盘上重新安装了操作系统,其中Swap为第一个,Root为第二个,Home为第三个逻辑分区。从技术上讲,sda1是Grub,sda2是Extended,sda5,sda6,sda7分别是swap,root和home; sda3和sda4不存在。从那以后9个月左右,硬盘上新安装的操作系统上没有出现此问题。我此时正在运行16.04.02 LTS而没有任何挂起重启或关机。以前的操作系统是双安装Win7 /Ubuntu,Swap分区位于硬盘的末尾。

我并不是说这个问题与双引导系统,故障硬盘或我放置分区的顺序有关,但在我的情况下,存在一个,两个或所有这些因素。现在,我没有遭受“达到目标关闭”的恶化。

第三种解决办法

挂机时我遇到了问题,这就是我所做的:

开放终端

sudo -H gedit /etc/default/grub

换行:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

GRUB_CMDLINE_LINUX_DEFAULT="acpi=force"

通过删除quietsplash在关机期间允许文本,有助于查看挂起的位置。

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.

保存并关闭Gedit

然后在终端更新Grub:

sudo update-grub

额外:

我注意到我也运行了’STOP JOB’,所以我减少了/etc/systemd/system.conf中的超时:

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

删除#并更改以下行中的时间:

DefaultTimeoutStartSec=5s

DefaultTimeoutStopSec=5s

然后运行:

sudo systemctl daemon-reload

这对我有用。

第四种办法

Tdenham。我有同样的情况。我刚用do-release-upgrade -d将系统从14.04更新到16.04。

如果您无法直接访问系统,并且确实需要重新启动,则可以尝试使用硬重置作为解决方法(如下所述: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

这样做的伎俩。可能你应该在第二个命令之前运行sync

reboot -f可能有所帮助,但我没有尝试,因为如果它再次挂起我无法访问服务器。

您可以检查/var /log /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)

似乎即使在请求重启时dhclient也试图实现ip地址。

如果这是一个hardware-dependent问题,我粘贴了lspci的输出,以帮助解决问题。

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)

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/1229.html,未经允许,请勿转载。