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