sh:echo:pm-suspend Ubuntu 14.04 上出现 I/O 错误

sh:echo:pm-suspend Ubuntu 14.04 上出现 I/O 错误

在长期未使用 Opensuse 后,我刚刚在富士通 Lifebook U772 上安装了 Ubuntu 14.04,安装后,似乎pm-suspend开箱即用。然而,经过几天的设置,挂起功能停止工作,菜单选项“挂起”只会导致屏幕短暂变黑,然后返回锁定屏幕。

我尝试使用终端手动暂停机器sudo pm-suspend,但仍然无济于事。我开始查看日志pm-suspend/var/log/pm-suspend.log发现有些奇怪:

Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend:
Linux deathbook 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Module                  Size  Used by
vboxpci                23194  0 
vboxnetflt             27613  0 
vboxnetadp             25670  0 
vboxdrv               339502  3 vboxnetadp,vboxnetflt,vboxpci
pci_stub               12622  1 
ctr                    13049  1 
ccm                    17773  1 
bnep                   19624  2 
rfcomm                 69160  0 
bluetooth             395423  10 bnep,rfcomm
binfmt_misc            17468  1 
nls_iso8859_1          12713  1 
arc4                   12608  2 
iwldvm                232285  0 
intel_rapl             18773  0 
uvcvideo               80885  0 
hid_generic            12548  0 
x86_pkg_temp_thermal    14205  0 
videobuf2_vmalloc      13216  1 uvcvideo
intel_powerclamp       14705  0 
videobuf2_memops       13362  1 videobuf2_vmalloc
coretemp               13435  0 
videobuf2_core         40664  1 uvcvideo
videodev              134688  2 uvcvideo,videobuf2_core
kvm_intel             143060  0 
mac80211              626557  1 iwldvm
usbhid                 52570  0 
kvm                   451511  1 kvm_intel
i2400m_usb             36521  0 
hid                   106148  2 hid_generic,usbhid
i2400m                107913  1 i2400m_usb
wimax                  34704  1 i2400m
crct10dif_pclmul       14289  0 
snd_hda_codec_hdmi     46207  1 
crc32_pclmul           13113  0 
ghash_clmulni_intel    13216  0 
aesni_intel            55624  2 
snd_hda_codec_realtek    61438  1 
aes_x86_64             17131  1 aesni_intel
i915                  783703  4 
snd_hda_intel          52355  3 
snd_hda_codec         192906  3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
lrw                    13286  1 aesni_intel
iwlwifi               169932  1 iwldvm
snd_hwdep              13602  1 snd_hda_codec
snd_pcm               102099  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
gf128mul               14951  1 lrw
drm_kms_helper         53081  1 i915
snd_page_alloc         18710  2 snd_pcm,snd_hda_intel
snd_seq_midi           13324  0 
glue_helper            13990  1 aesni_intel
drm                   303102  5 i915,drm_kms_helper
cfg80211              484040  3 iwlwifi,mac80211,iwldvm
ablk_helper            13597  1 aesni_intel
snd_seq_midi_event     14899  1 snd_seq_midi
cryptd                 20359  3 ghash_clmulni_intel,aesni_intel,ablk_helper
snd_rawmidi            30144  1 snd_seq_midi
i2c_algo_bit           13413  1 i915
snd_seq                61560  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              29482  2 snd_pcm,snd_seq
mei_me                 18627  0 
mei                    82276  1 mei_me
snd                    69238  17 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_seq_device,snd_seq_midi
rtsx_pci_ms            18151  0 
soundcore              12680  1 snd
memstick               16966  1 rtsx_pci_ms
joydev                 17381  0 
mac_hid                13205  0 
lpc_ich                21080  0 
fujitsu_laptop         18947  0 
video                  19476  1 i915
serio_raw              13462  0 
parport_pc             32701  0 
ppdev                  17671  0 
lp                     17759  0 
parport                42348  3 lp,ppdev,parport_pc
rtsx_pci_sdmmc         23274  0 
e1000e                254433  0 
psmouse               102222  0 
ahci                   25819  5 
libahci                32168  1 ahci
rtsx_pci               45956  2 rtsx_pci_ms,rtsx_pci_sdmmc
ptp                    18933  1 e1000e
pps_core               19382  1 ptp
             total       used       free     shared    buffers     cached
Mem:       3905144    2586540    1318604     356556       6452     531508
-/+ buffers/cache:    2048580    1856564
Swap:      8190472          0    8190472
/usr/lib/pm-utils/sleep.d/00logging suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave suspend suspend:
/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.

Running hook /etc/pm/sleep.d/10_grub-common suspend suspend:
/etc/pm/sleep.d/10_grub-common suspend suspend: success.

Running hook /etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend:
/etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/50unload_alx suspend suspend:
/usr/lib/pm-utils/sleep.d/50unload_alx suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant suspend suspend:
Selected interface 'wlan0'
OK
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:
Unloading kernel module vboxdrv...Done.
/usr/lib/pm-utils/sleep.d/75modules suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/90clock suspend suspend:
/usr/lib/pm-utils/sleep.d/90clock suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend:
/usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95anacron suspend suspend:
stop: Unknown instance: 
/usr/lib/pm-utils/sleep.d/95anacron suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm suspend suspend:
/usr/lib/pm-utils/sleep.d/95hdparm-apm suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/95led suspend suspend:
/usr/lib/pm-utils/sleep.d/95led suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:
Kernel modesetting video driver detected, not using quirks.
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/99video suspend suspend:
kernel.acpi_video_flags = 0
/usr/lib/pm-utils/sleep.d/99video suspend suspend: success.

Running hook /etc/pm/sleep.d/novatel_3g_suspend suspend suspend:
/etc/pm/sleep.d/novatel_3g_suspend suspend suspend: success.

Fri Jul 11 07:17:01 PHT 2014: performing suspend
sh: echo: I/O error
Fri Jul 11 07:17:03 PHT 2014: Awake.
Fri Jul 11 07:17:03 PHT 2014: Running hooks for resume
Running hook /etc/pm/sleep.d/novatel_3g_suspend resume suspend:
/etc/pm/sleep.d/novatel_3g_suspend resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/99video resume suspend:
/usr/lib/pm-utils/sleep.d/99video resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler resume suspend:
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95led resume suspend:
/usr/lib/pm-utils/sleep.d/95led resume suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend:

/dev/sda:
 setting Advanced Power Management level to 0xfe (254)
 APM_level  = 254

/dev/sdb:
 setting Advanced Power Management level to 0xfe (254)
 APM_level  = 254
/usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95anacron resume suspend:
/usr/lib/pm-utils/sleep.d/95anacron resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq resume suspend:
/usr/lib/pm-utils/sleep.d/94cpufreq resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/90clock resume suspend:
/usr/lib/pm-utils/sleep.d/90clock resume suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/75modules resume suspend:
Reloaded unloaded modules.
/usr/lib/pm-utils/sleep.d/75modules resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant resume suspend:
Selected interface 'wlan0'
OK
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/50unload_alx resume suspend:
/usr/lib/pm-utils/sleep.d/50unload_alx resume suspend: success.

Running hook /etc/pm/sleep.d/10_unattended-upgrades-hibernate resume suspend:
/etc/pm/sleep.d/10_unattended-upgrades-hibernate resume suspend: success.

Running hook /etc/pm/sleep.d/10_grub-common resume suspend:
/etc/pm/sleep.d/10_grub-common resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave resume suspend:
/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00logging resume suspend:
/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/000record-status resume suspend:
/usr/lib/pm-utils/sleep.d/000record-status resume suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/000kernel-change resume suspend:
/usr/lib/pm-utils/sleep.d/000kernel-change resume suspend: success.

Fri Jul 11 07:17:04 PHT 2014: Finished.

更具体地说,它是沿着这些路线的(这是系统实际执行暂停的部分):

Fri Jul 11 07:17:01 PHT 2014: performing suspend
sh: echo: I/O error
Fri Jul 11 07:17:03 PHT 2014: Awake.
Fri Jul 11 07:17:03 PHT 2014: Running hooks for resume
Running hook /etc/pm/sleep.d/novatel_3g_suspend resume suspend:
/etc/pm/sleep.d/novatel_3g_suspend resume suspend: success.

我认为这里奇怪的部分是sh: echo: I/O error每次系统挂起时都会出现的内容,如您所见,系统在错误发生后立即唤醒。

我尝试了很多解决方法,包括以下内容:

  • 禁用 Virtualbox 的vboxdrv模块,因为我读到它们有时会干扰主机暂停的能力
  • 禁用所有可以唤醒系统的设备/proc/acpi/wakeup
  • errors=remount ro将选项 for /in替换/etc/fstaberrors=continue

尽管如此,问题仍然存在。这可能是内核的问题吗?当我还在使用 Opensuse 12.3 时,我被困在内核 3.7 中,而现在在 Ubuntu 14.04 中,我使用的是内核 3.13。不过我有点怀疑内核可能是问题所在,因为 3.13 是出厂时就有的,而且当时暂停功能仍然有效。

更新

我发现导致 I/O 失败的回显的原因在 的第 321 行/usr/lib/pm-utils/pm-functions。我通过打开 的详细日志记录和调试pm-suspend并禁用所有钩子(通过将它们临时移动到另一个目录)来获得此信息。

这是有问题的行:

 do_suspend() { echo -n "mem" >/sys/power/state; }

据我所知,这echo至关重要,因为它是处理挂起的内核低级函数之间的接口pm-suspend。现在的问题是为什么会在那一刻发生 I/O 错误。我将尝试在终端上手动执行该命令,看看是否仍会发生 I/O 错误。

答案1

好吧,我终于找到了这个问题的罪魁祸首,但首先,我要介绍一下背景:我忘了说我的笔记本电脑默认有一块混合硬盘。它是一块普通的 500GB 机械硬盘,辅以一块 24GB 的固态硬盘,Windows 8 以前用它来休眠,可能还用它来缓存东西。我以前在 OpenSUSE 中使用固态硬盘来存储我的根分区,直到它最终坏了(一路都是 I/O 错误),促使我将分区移动到硬盘上,同时安装 Ubuntu 14.04。

长话短说:我在待机时遇到的 I/O 错误是不知何故由于我的 SSD 故障导致的。

我修复这个问题的方法是删除 SSD 的块设备/dev。在我的例子中,我的 SSD 总是显示为/dev/sdb,所以我以 root 身份在终端中输入了以下内容(解决方案来自这篇有用的文章):

# echo 1 > /sys/block/sdb/device/delete

确保将“sdb”替换为您认为有故障的设备。我之所以有它,是/dev/sdb因为正如我之前提到的,我的 SSD 总是先得到它。

每次全新启动时,“删除”都会重置,因此我所做的就是将这一行添加到我的 中/etc/rc.local,以确保/dev/sdb在启动时将其删除。这可能影响机器上插入可移动驱动器的启动,但对我来说,SSD 无论如何都是 HDD 的物理组成部分,因此/dev/sdb在 HDD 获得后它会自动获得块设备/dev/sda

答案2

这里也有同样的问题: sh: echo: I/O error/var/log/pm-suspend.log14.04 (或者更确切地说是 Mint 17) 中。

不同的答案。我改用“su pm-hibernate”,它也会失败,并出现类似“任务冻结失败后……”的警告。然后执行“dmesg | less”并使用“/Freezing”搜索,会显示涉及“fuse”的堆栈跟踪。原因:Files/Nautilus/Nemo 中打开了网络安装。解决方法:在 GUI 中卸载。然后,改用 /etc/fstab 条目来安装网络驱动器。这样更可靠。


[122274.535148] Freezing user space processes ... 
[122294.540137] Freezing of tasks failed after 20.009 seconds (1 tasks refusing to freeze, wq_busy=0):
[122294.540167] bash            D ffff88022ec74480     0  6868   6825 0x00000004
[122294.540178]  ffff88021e6ddb50 0000000000000082 ffff8800c8a9e000 ffff88021e6ddfd8
[122294.540180]  0000000000014480 0000000000014480 ffff8800c8a9e000 ffff88021f7c8660
[122294.540181]  ffff880034813800 ffff88021e6ddb78 ffff88021f7c8740 ffff88021f7c8660
[122294.540183] Call Trace:
[122294.540188]  [<ffffffff81723129>] schedule+0x29/0x70
[122294.540192]  [<ffffffff812aaa95>] __fuse_request_send+0x115/0x280
[122294.540195]  [<ffffffff810aafd0>] ? prepare_to_wait_event+0x100/0x100
[122294.540197]  [<ffffffff812aac12>] fuse_request_send+0x12/0x20

答案3

导致此问题的最可能原因(对于阅读本文的人来说)是将 USB 记忆棒或 SD 卡连接到笔记本电脑(不一定已安装)。如果已安装,请卸载(I/O 错误意味着不太可能)。一旦您确定它没有安装,请将其移除并重试pm-suspend

非常感谢@rey-balgs 分享他的研究(并为我省去了很多麻烦)。

答案4

我遇到了类似的问题,它是关于:swapoff

尝试运行:

sudo swapon -a

相关内容