Ubuntu karmic: problems with suspend|hibernate

Are you having problems with your new Ubuntu Karmic (9.10) fresh installation to suspend or hibernate ??
The are several posts on the web concerning this issue, just google it!

My problem was due the fact that i had one SD / MMC card inserted on my laptop and there are some issues with those cards, because the linux can’t unmount them before suspend and the system hangs.

The solution i found was to create a file at /usr/lib/pm-utils/sleep.d/010_unmount_SD.sh (chmod +x) whith the following:

<pre># Drop to: /etc/pm/sleep.d
# Use this script to prevent data loss on mounted MMC/SD
# cards. It syncs data and umounts all mmcblk devices prior to
# suspend, and cancels suspend if umounting was not possible
# (i.e: something locks a file)
case "${1}" in
    hibernate|suspend)
        /bin/sync
        for drive in $( /bin/ls /dev/mmcblk?* ); do
            /bin/umount ${drive} &gt; /dev/null
            # If umount failed: abort suspend
            if [ $? -gt 0 ]; then
            # Test if device keeps mounted. Previous command could fail
            # (i.e device was not mounted) with a non-stopper
            # problem for the suspend process.
            /bin/mount | /bin/grep ${drive}
            if [ $? -eq 0 ]; then
                exit 1
            fi
            fi
        done
        ;;
#    resume|thaw)
##       Do nothing. All devices will be automatically mounted again.   
#       ;;
esac</pre>

Note: Before try to suspend the system do a test run on the script, and see if there are something wrong

/usr/lib/pm-utils/sleep.d/010_unmount_SD.sh suspend

If there are no error messages and the SC card is unmounted then try to do a suspend of the system.
Keep your fingers crossed and the system will suspend and resume without problem.

See you soon,

Blogged with the Flock Browser

5 comments on “Ubuntu karmic: problems with suspend|hibernate

  1. This script fails because I have both /dev/mmcblk0 and
    /dev/mmcblk0p1 devices output from the ‘ls’ command.
    Everything gets mounted on the mmcblk0p1 devices.
    (Is this “p*” suffix something new?)

    The “failure” is legit — one of the several mmcblk* devices fails to unmount so the script aborts. Since there is more than one, the script needs to identify not only “devices” but ones that have something actually in use. It should loop over THOSE devices to unmount — not whatever devices might exists, but those in actual use.

    I’ll post an up-to-date script later, for now here are some notes:

    1. I added a statement MMCPATTERN=”/dev/mmcblk[0-9]?[0-9]”. Then, I salted references to this pattern through the rest of the script as appropriate.

    2. Output from ‘ls’
    /dev/mmcblk0 /dev/mmcblk0p1

    3. Output from ‘mount’
    /dev/mmcblk0p1 on /media/SDMUMBLES16 type vfat
    rw,nosuid,nodev,uhelper=hal,shortname=mixed,
    uid=1000,utf8,umask=077,flush)

    4. Output from running the script
    bash -x ./unmountSD.sh suspend
    + MMCPATTERN=’/dev/mmcblk?*’
    + case “${1}” in
    + /bin/sync
    ++ /bin/ls /dev/mmcblk0 /dev/mmcblk0p1
    + for drive in ‘$( /bin/ls $MMCPATTERN )’
    + /bin/umount /dev/mmcblk0
    umount: /dev/mmcblk0 is not mounted (according to mtab)
    + ‘[‘ 2 -gt 0 ‘]’
    + /bin/mount
    + /bin/grep /dev/mmcblk0
    /dev/mmcblk0p1 on /media/SDMUMBLES16 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
    + ‘[‘ 0 -eq 0 ‘]’
    + exit 1

  2. Ok, this probably worked fine with Karmic, but something has changed with more recent releases.

    I am trying to get suspend working with my SD card mounted as /home. Out of the box, suspend does not work. Using the script above, correctly allows the card to unmount but it never gets mounted.

    This is under Natty. Can you confirm if you have it working under a newer release and possibly under Natty? What changes were required?

    Thanks.

    • I still have the same script working after updating to oneiric.
      Because i’ve updating my system since hardy, i might have lots of legacy scripts that might making this working also.
      As soon as possible i will check this iut more thoroughly.

      Cheers,

      • Hi there!

        I found a new situation on Ubuntu 11.10, you need to disable the tpm_tis module,
        sudo modprobe -r tpm_tis
        otherwise it can’t suspend!

        Why?? i still don’t know why, but as soon as i figure it out, i’ll post it here.
        Cheers,

Leave a comment