Wifi scan interval in Debian Wheezy, reconnect after sleep

5

1

I want to reconnect to a wireless network as fast as possible when waking up my computer from sleep mode. It always takes a while (usually 15-30 seconds) before there's even a listing of available networks. Scanning with iwlist does not even take one second so I guess it takes a while before it even starts scanning.

Can I shorten the scan interval or solve my problem in a different way?

I'm running Debian Wheezy without any special configurations. Network connections are handled by the GUI but I'm a long time Debian user and not afraid of the command line. Even Bash solutions are welcome - anything which solves my problem.

Emil Vikström

Posted 2012-07-19T13:23:30.280

Reputation: 419

Answers

2

It's going to depend on a number of factors.

Sleep vs Hibernate

Software Issues

  • Connecting to an open wifi network or specific net

  • Not Connecting without waiting for a BSID

  • Accessing your password

  • KWallet issue from KDE ?

Hardware Issues

  • Sleep modes can differ with manufactures

  • Wireless Drivers can be very different

Direction For research:

Although I can't directly answer your question, you would likely be able to execute a direct scan with iwlist, and join an open network based on the Power management hook in Wheezy.

ACPI (old way)

This action would be scripted through the ACPID event hooks.

You can learn more about acpid /etc/acpi/actions

PM-Utils launchpad

This action would be scripted through pm-util event hooks

  • resume -- The hook MUST perform whatever action is appropriate when the system is coming out of suspend.

  • thaw -- The hook MUST perform whatever action is appropriate when the system is coming out of suspend-to-disk.

Suspend/resume functionality can be easily modified by installing files into the /etc/pm/sleep.d directory. These files, known as hooks, can perform specific tasks on suspend/resume.

  1. Some event happens to wake the machine up

  2. Each of /etc/pm/sleep.d/* are executed in reverse C sort order, with a command line argument of "resume" or "thaw"

shadowbq

Posted 2012-07-19T13:23:30.280

Reputation: 195

Thanks! I will definitely try some of this! ACPI hooks looks like the right way to go. The problem, by the way, is not the time it takes to connect, but the time it takes before it even begins to scan for networks. – Emil Vikström – 2012-08-10T17:08:21.707

2

If your network uses only iPv4, the problem could be that Debian Linux is first trying to connect via iPv6 without success, before passing on to iPv4 and succeeding. Turning off iPv6 might in this case solve the problem.

For more details see the Debian IPv6 Project, and especially the section How to turn off IPv6.

harrymc

Posted 2012-07-19T13:23:30.280

Reputation: 306 093

1Nice catch, but I've already checked this and disabled IPv6. The problem is not the connection time, it is the time it takes before it even starts to scan for networks. – Emil Vikström – 2012-08-10T17:07:03.563

Have you tried to debug the wake-up, maybe using tools such as in Help on software suspend.

– harrymc – 2012-08-10T17:33:33.920

2

You've mentioned you are running Debian Wheezy without any special configurations, so I assume you are using NetworkManager. What you can try to do is forcing NetworkManager to reconnect as soon as your machine wakes up.

To do that, try this way:

  1. get the UUID of the connection you're interested in:

    $ nmcli con
    
  2. ensure you have the pm-utils package installed and create a script in /etc/pm/sleep.d/ like this:

    nmcli con up uuid 9890c6b9-d2b4-4ed2-a743-ad07cb6c125f

Obviously, replace the UUID with the one you got in step 1. The script has to be executable, and it will be executed every time your laptop comes out of suspend (or suspend-to-disk).

ema

Posted 2012-07-19T13:23:30.280

Reputation: 306

2

I have a local version of Debian, called Canaima (Venezuelan distro).

Without doing anything that I can remember, the reconnection to the Wi-Fi network got very slow after waking up the computer from “sleep.” It would take minutes just for the window with the Wi-Fi password and the connect button to show up.

At first, to overcome this I would go to the Wi-Fi configuration window, and turn it off, and on again, and the window with the wifi password would show up, and I would just click “connect” and that was it.

Then I noticed that there was an option for “AVAILABLE FOR ALL USERS,” in the Wi-Fi configuration window, that was unchecked. I simply checked it and that was the end of my problem. Now, When the laptop wakes up from sleep the Wi-Fi is already connected to its network.

Most probably, this is not everybody’s case but, when it is the case the solution seems to be quite simple.

erpp45

Posted 2012-07-19T13:23:30.280

Reputation: 21