sh: echo: I/O error on pm-suspend Ubuntu 14.04

14,620

Solution 1

Okay, I managed to finally find the culprit for this issue, but first, a little background: I neglected to mention that my laptop has a hybrid HDD by default. It's a regular 500GB mechanical HDD supplemented by a 24GB SSD, which used to be used by Windows 8 for hibernation and probably cache stuff. I used the SSD to stash my root partition before in OpenSUSE until it eventually died (I/O errors all the way down), prompting me to move the partition to the HDD whilst also installing Ubuntu 14.04.

Long story short: The I/O errors I'm getting at standby were somehow caused by my faulty SSD.

What I did to fix this was to remove the block device of the SSD from /dev. In my case, my SSD is always shown as /dev/sdb, so I entered the following in a terminal as root (solution courtesy of this helpful article):

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

Be sure to replace 'sdb' with the device you think is faulty. I only have it as /dev/sdb because as I've mentioned before, my SSD always gets that first.

The "deletion" gets reset on every fresh boot, so what I did was add that line to my /etc/rc.local, which ensures that /dev/sdb will get deleted at boot. This might affect booting with removable drives inserted on your machine, but in my case the SSD is physically part of the HDD anyway so it automatically gets the /dev/sdb block device after the HDD gets /dev/sda.

Solution 2

The most likely cause of this issue (for people reading this) is leaving a USB stick or SD card connected in the laptop (not necessarily mounted). Unmount if it's mounted (the I/O error means that is unlikely). Once you're happy it's not mounted, remove it and try pm-suspend again.

A big thank-you to @rey-balgs for sharing his research (and saving me a lot of grief).

Solution 3

Same problem here: sh: echo: I/O error in /var/log/pm-suspend.log in 14.04 (or rather Mint 17).

Different answer. I played with 'su pm-hibernate' instead, it also fails with nice in-your-face warnings like "Freezing of tasks failed after...". Then doing "dmesg | less" and searching with "/Freezing" reveal a stack trace involving "fuse". The reason: a open network mount in Files/Nautilus/Nemo. The fix: unmount in the GUI. Then, use /etc/fstab entry instead to mount network drive. That's far more robust.


[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
Share:
14,620

Related videos on Youtube

rey_balgs
Author by

rey_balgs

Updated on September 18, 2022

Comments

  • rey_balgs
    rey_balgs over 1 year

    I just installed Ubuntu 14.04 on my Fujitsu Lifebook U772 after a long hiatus with Opensuse and after the install, it appears that pm-suspend works out of the box. A few days of setting up later, however, suspend stopped working, with the menu option of Suspend only resulting in the screen momentarily going black then returning to the lock screen.

    I manually tried to suspend the machine from a terminal using sudo pm-suspend but still to no avail. I started looking over the pm-suspend log at /var/log/pm-suspend.log, and I noticed something strange:

    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.
    

    More specifically, it was along these lines (this is the part where the system actually performs the suspend):

    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.
    

    I think the weird part here is the sh: echo: I/O error that shows up every time the system does a suspend, as you can see, the system immediately awakens after the error.

    I've tried a lot of workarounds that include the following:

    • Disabling Virtualbox's vboxdrv modules as I have read that they sometimes interfere with a host machine's ability to suspend
    • Disabling all devices that could wake the system in /proc/acpi/wakeup
    • Replacing the errors=remount ro option for / in /etc/fstab to errors=continue

    Despite all of those the problem still persists. Could it be an issue with the kernel? Back when I was still using Opensuse 12.3 I was stuck in kernel 3.7, and now here in Ubuntu 14.04 I'm using kernel 3.13. Though I kind of doubt that the kernel might be the issue since 3.13 came out of the box and suspend still worked at that time.

    UPDATE:

    I've found that the cause for the echo that causes the I/O fail is in line 321 of /usr/lib/pm-utils/pm-functions. I got this by turning on verbose logging and debugging for pm-suspend, and disabling all hooks (by moving them temporarily to another directory).

    This is the line in question:

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

    As I understand it, this echo is crucial because it's the interface between pm-suspend and the low-level functions in the kernel that handle suspends. The issue now is why would an I/O error occur at that moment. I'll try to manually perform the command on a terminal and see if an I/O error still occurs.

    • Admin
      Admin almost 10 years
      I have the same problem on Linux Mint 17 (same base as Ubuntu 14.04). Actually, the problem pertains only to hibernation, while suspend works fine. When I hibernate, I get the same "sh: echo: I/O error" message, and hibernation immediately aborts. This is really annoying, since hibernation used to work fine with this hardware. So my question is: 1. Does this bug affect everyone, or only certain hardware? 2. Is there already a bug open on Launchpad?
    • rey_balgs
      rey_balgs almost 10 years
      Hibernation works for me, although it doesn't when Chrome or a lot of RAM-hungry apps are open (it takes a long time, maybe 2-3 minutes, then gives up altogether). Found an eerily similar case here on Launchpad: answers.launchpad.net/ubuntu/+question/249560
    • Nick Sweeting
      Nick Sweeting almost 6 years
      In my case my SSD was simply reporting IO errors because it had run out of space. Make sure to check your drive has enough space to accept new writes! ncdu /
  • musiKk
    musiKk over 9 years
    I had the same problem. How on earth should a mere mortal find this out? I cannot thank you enough...
  • Wilf
    Wilf about 9 years
    This may be more of a issue with how Nemo handles the connection (I can't recall having any issues this way on Ubuntu, Fedora and other Linux OSs), so you could report the issue to the Mint devs (not quite sure where, may be here). You could also include how you added the /etc/ftstab entry. thanks
  • S Imphead
    S Imphead about 9 years
    Wilf, thanks for hint. Filed at bugs.launchpad.net/linuxmint/+bug/1447340