Raspberry PI – Edimax wifi kept shutting down

So, I got myself an Edimax EW-7811Un 802.11n WIFI adapter for my Respberry PI 2 B+. I was told that it should be rock stable on a Raspberry PI with Raspbian.
At first glance it seemed to be true, the installation was straight forward and configuration was only a few changes and it was up running.

But after some hours, the PI went offline – it didn’t shut down, it just lost the connection. Since I don’t have a monitor and keyboard connected to it, I restarted it and it was online again for a few hours and then it was offline again. I repeated this many time, trying to trace the error, but no logfile said anything about what was wrong.

After some searching on the Internet, I found out that I wasn’t the only one having this problem. However, despite many great ideas, none of them worked for me.

But then… I one thread, someone suggested a power management setting – why didn’t I think of that!? There was a couple of suggestions how to disable it, but this one did the trick in my case:

I simply added the file /etc/modprobe.d/8192cu.conf with this content:

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

And then reboot.

You can check that the power management has been disabled, by running this command:
cat /sys/module/8192cu/parameters/rtw_power_mgnt

It will write a 0 (zero) if the power management is disabled.

So, if you are experiencing the same problem, you can try this solution – I hope it helps! :-)