42

Whenever I leave my Raspberry Pi on overnight, it always seems to have entered some kind of suspended state. The red power light is still on but the light on the USB WiFi device is off and I can't access it with SSH.

I have no peripherals attached except for a USB WiFi device. I just use it headless as an audio player.

Anyone know how to completely disable any kind of suspend features?

goldilocks
  • 56,430
  • 17
  • 109
  • 217
dgrant
  • 522
  • 1
  • 4
  • 6
  • It would be helpful to us if you could tag your question with the appropriate display manager. Thanks! –  Aug 01 '12 at 04:12
  • Can you see any output on an attached screen? And do you have an up-to-date OS? Could be a kernel panic, which happended to me randomly after certain uptime. – macrojames Aug 01 '12 at 05:40
  • 1
    @BryanDunsmore I doubt he is using a DM - it's a ***headless*** audio player... – Alex Chamberlain Aug 01 '12 at 08:20
  • Possible duplicate of [How do I prevent the screen from going blank?](http://raspberrypi.stackexchange.com/questions/752/how-do-i-prevent-the-screen-from-going-blank) – Jivings Aug 01 '12 at 10:53
  • @AlexChamberlain If he is using Raspian I highly doubt he has uninstalled the default display manager. =/ –  Aug 01 '12 at 15:50
  • Sorry for the late reply, I never got a notification that there were replies. As I said, "headless" and "no peripherals attached except for a USB WiFi device" so that means no monitor/screen. I'm using Raspian. – dgrant Aug 10 '12 at 16:41
  • Although you are running headless, it still could possibly be running a display manager. When you hook up a screen and boot it, if it's truly headless it should only show a text based command prompt asking for login details. I only ask because I'm running a bittorrent seed box on my Raspberry pi, and I've never experienced this. Also try plugging in an Ethernet cable next time it falls asleep. Perhaps it's something to do with the USB wifi adapter turning itself off for some reason. Does the disk light still flash when it's "asleep"? – Kibbee Aug 31 '12 at 12:24
  • @dgrant I noticed you hadn't selected an answer on this, so I'm guessing your issue was not solved. Please take a look at my answer and see if it is of any help. – Herohtar Jan 16 '13 at 09:11
  • I had a similar problem with an ethernet connection. I ended up adding a script that retries getting an internet connection if it goes down. Seems to have helped. – Andy Boura Nov 18 '14 at 09:31

4 Answers4

52

You didn't provide a lot of details, but I'm going to assume you are using a WiFi adapter with the Realtek 8192cu chip, since that seems to be commonly used. Mine is the same and I have been experiencing what I think is the same issue: when leaving the RPi idle for an extended period of time, the WiFi seems to be disabled and you can no longer connect via SSH, etc.

I have been searching for a solution to this for months and only just now found one here: https://github.com/xbianonpi/xbian/issues/217. The solution is for xbian, but it worked for me on Raspbian.

The problem seems to be that the adapter has power management features enabled by default. This can be checked by running the command:

cat /sys/module/8192cu/parameters/rtw_power_mgnt

A value of 0 means disabled, 1 means min. power management, 2 means max. power management. To disable this, you need to create a new file:

sudo nano /etc/modprobe.d/8192cu.conf

and add the following:

# Disable power management
options 8192cu rtw_power_mgnt=0

Once you save the file and reboot your RPi, the WiFi should stay on indefinitely.

techraf
  • 4,254
  • 10
  • 29
  • 41
Herohtar
  • 833
  • 1
  • 9
  • 14
  • Unfortunately, the same thing is happening to be on xbian with 8192cu and power management is already set to 0. Somehow it still goes into coma... – StasM Jul 30 '13 at 07:06
3

The preferred answer looks close to correct, but some additional comments in the original issue (https://github.com/xbianonpi/xbian/issues/217) would suggest an additional option is better:

options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

in /etc/modprobe.d/8192.conf, as opposed to just rtw_power_mgnt=0. Simply specifying that one option did not work for me, as the wifi still turned itself off.

Talos
  • 31
  • 1
1

My issue was the screen saver. Disable with the following commands:

This turns off the screen saver:

xset s off

Disable other energy star features:

xset -dpms

This will not work in a remote SSH session

Dan Power
  • 119
  • 1
0

GDM

You can prevent GDM from suspending your computer by changing a value in dconf-editor. Note that I said dconf-editor, not gconf-editor.

$ dconf-editor

Now, you need to navigate to the org.gnome.settings-daemon.plugins.power node. You should see a whole list of key-value pairs. Change the following keys to the following values.

  • sleep-inactive-ac-type to nothing
  • sleep-inactive-battery-type to nothing

References

  • 3
    Where did he say he was using GDM? – Jivings Aug 01 '12 at 10:53
  • 1
    @Jivings He didn't. I'm just providing an answer _in the case_ that he is using GDM. –  Aug 01 '12 at 15:52
  • Sorry, but -1 from me for an open-ended answer, with no sure fire way of knowing if it answers the question. You should have left a comment. – Jivings Aug 01 '12 at 15:59
  • @Jivings How is this answer open-ended? I'm providing the GDM answer since we do not know more information? –  Aug 01 '12 at 23:01
  • 2
    Then you should ask for more information before answering. – Jivings Aug 02 '12 at 08:56
  • 1
    I highly doubt that they will respond considering (1) they have no account on here, and (2) this question is about a week old. In this case it would still be best to provide an answer for future visitors. –  Aug 02 '12 at 16:19
  • 2
    I do have an account at stackoverflow and a few of the other stackexchange sites and I asked this question on superuser.stackexchange and then it got moved to raspberrypi.stackexchange. I guess that's why I got no notifications of replies. It got moved to a sub-site where I had no account, before anyone commented on it. Annoying. – dgrant Aug 10 '12 at 16:43
  • Or maybe stackoverflow doesn't send email reminders... anyways, I finally saw the replies when I logged into stackoverflow.com today. – dgrant Aug 10 '12 at 16:44
  • 1
    And finally, my raspberry pi is "headless" :-) – dgrant Aug 10 '12 at 16:44
  • I think the actual problem is the WiFi itself and not the RPi going to sleep. See my answer for details. – Herohtar Jan 16 '13 at 09:12