Sometimes when you try to suspend the Ubuntu operating system, it wakes up immediately. This is often because certain devices are in “awake” state. To fix it, first you need to find out which device it is. Do:
acpitool -w
You might see output like the following:
Device S-state Status Sysfs node
---------------------------------------
1. P0P1 S4 *disabled
2. GLAN S4 *disabled
3. XHC S4 *enabled
To disable ‘XHC’, do:
echo 'XHC' > /proc/acpi/wakeup
with superuser privilege.
Typical suspects are USB devices. To find out the USB devices in your system, do:
lspci | grep USB