Woody Leonhard's no-bull news, tips and help for Windows, Office and more… Please disable your ad blocker – our (polite!) ads help keep AskWoody going!
Home icon Home icon Home icon Email icon RSS icon
  • Fixing slow wifi in Linux (Intel wifi)

    Posted on Ascaris Comment on the AskWoody Lounge

    Home Forums AskWoody support Other platforms – for Windows wonks Linux for Windows wonks Fixing slow wifi in Linux (Intel wifi)

    This topic contains 7 replies, has 5 voices, and was last updated by  Ascaris 2 days, 8 hours ago.

    • Author
      Posts
    • #197555 Reply

      Ascaris
      AskWoody MVP

      This may also work for non-Intel cards, so feel free to try it if your wifi is slow. The directions are the same for Intel or other cards.

      While Linux Mint and the other members of the Ubuntu Linux family have done a great job of configuring everything with the appropriate driver right out of the box (meaning as soon as Linux was done installing, before I started changing the default settings) every time I’ve installed Linux in recent years, there was one issue that was really annoying, and I thought I’d share how I fixed it with the good readers of AskWoody.com.

      I have several laptops with wireless networking (wifi) capability, and out of the box, they’ve always worked, but not as quickly as in Windows.  All of them use Intel wifi adapters… my Core 2 Duo laptop uses an Intel 7260 AGN (dual band without Bluetooth) MiniPCIE card, while my Dell laptop with Celeron N3060 uses an Intel 7265 AGN+AC (dual band with Bluetooth) M.2 card.  Those were not the original wifi cards in either of them, but upgrading wireless cards is easy and cheap (tons of cards on eBay for under $10), so why not?

      In Windows, the new 7265 card I put in the Dell ran at the full expected speed right from the get-go, but in Linux, it was actually slower than the supposedly “half as fast” card it had replaced.  That was… annoying!

      Meanwhile, I have a faint memory of the same slow speed being a problem when I first installed Linux on the Core 2 Duo laptop, but when I tested it now, it was fast– actually besting its performance in Windows by a little bit.  The 7260 and 7265 cards are very similar, and I am using the same version of Linux on both, so what did I change that fixed it on the older laptop?

      Searching the internet for “slow wifi” and other related things turned up a lot of stuff, and sorting through the outdated or irrelevant information can be frustrating.  I did find some answers, though.

      First of all, don’t use file copying from a Samba or Windows networking share as a measure of the wifi speed.  On most Linux systems, the automounting of a network share is handled by GVFS (Gnome Virtual File System, which was using that name for about a decade before MS came along and clumsily named something else the very same thing), and GVFS is slooooooow in copying from network shares on the client end.

      To get a better measure, I connected to my backup server’s FTP server (FileZilla) from Waterfox and downloaded some large files.  This did effectively max out the wifi connection and give a good report of the actual speed.  I got 22 MB/s in Windows and 24 MB/s in Linux on the 7260; on the 7265, I got 22 MB/s in Windows but only ~10 MB/s in Linux, with great variability (swinging back and forth between ~6 and ~14 MB/s), and sometimes not even that.  This is on the 5 GHZ “A” band, with no other detected networks impinging on the 40MHz channel I used.

      Most people probably won’t want to install a FTP server on a network computer just to test the wifi speed.  I happened to have it already set up (since the PC it is on is a backup server anyway), so that was easy.  Otherwise, you’d have to find a benchmark program you could install on a remote PC (another one on the network) as well as on the one with the slow wifi to get a good measure of the speed.  If you’re lucky enough to have internet fast enough to max out your wifi, you can try using that.

      So, back to troubleshooting the slowness.

      One of the answers suggested (that a lot of people said was helpful) was to disable the N mode in the card using a certain command.  I don’t know if it truly disables all of the N features or just the 40MHz bonded channel mode (two 20MHz channels used as one), but I didn’t replace the wifi card just to turn it back into the card it replaced (or worse).  I also knew that a very similar card performs as well or better in Linux as in Windows, so I was not going to try that “fix.”

      I tried checking the “firmware” (binary blob from Intel) to make sure it was the latest version, and it was.  I checked the Linux performance tuning TCP parameters, and they were fine.  I found out that my card was not registered to the US regulatory domain, so it was operating with “safe” international parameters that didn’t let it transmit at full power, but fixing that (I will have to make a separate post about fixing that) didn’t fix the problem (it may have helped a little, but it didn’t cure it).

      Finally, I stumbled across a web page that suggested turning off the wifi power saving mode, and it triggered a faint memory of something I’d done with the older laptop that delivered great performance over its Linux wifi.

      I issued the command on the laptop with the slow wifi (into the terminal, the Linux name for what Windows calls the command prompt):

      iwconfig

      That shows a list of the wireless devices on the PC with some of the more important bits of info for each card.  As expected, the slow wifi laptop showed Power Management: on for its wifi card.  It’s a laptop, so when it is on battery, it’s good to be able to save as much power as possible, so having that on would usually seem to be a good thing.

      I issued the same command on the fast wifi laptop, and…. Power Management: off.  Mmm, I may be on to something!

      To turn power management off, we need to know the name Linux knows the card by.  It’s not shown in the iwconfig info.  This command will give you the info you need in Mint and other Ubuntu relatives:

      sudo lshw -class network

      “ls” in Linux means list.  ‘ls’ by itself is the equivalent of ‘dir’ in Windows, listing the files in the current working directory.  ‘lshw’ means list hardware.  ‘lspci’ lists PCI devices on the computer, while ‘lsusb’ lists USB devices, and so on.  The -class network is pretty obvious; without that switch, lshw would list all the hardware, and we’d have to scroll through a ton of stuff to find what we need. ‘sudo’ means to run the command that follows as a superuser, also known as administrator or root, which ensures that the lshw command has access to all the hardware info.

      After entering the password for the sudo, scroll down through the info it provides and find the one that says “description: Wireless interface,” which on the Dell is the only one listed (it has no ethernet port), and a few lines under that it should say “logical name: wlp1s0”, where the actual name of your card replaces wlp1s0.

      It used to be that the first wifi card enumerated by the system would be called wlan0 (or ath0 for Atheros cards), but since it was never certain which order things would be enumerated in if there were multiples of something, they changed it so that things had more unique names that would stick with the device regardless of enumeration order, and that’s the one my 7265 ended up with.  That’s the situation in Mint 18.3, anyway; I don’t know about other Linuxes.

      So, now that you know the Linux name of the card, enter (substituting the name of your card for wlp1s0):

      sudo iwconfig wlp1s0 power off

      After that, iwconfig should show that power management is off.  Try the speed test again, and you should find a big improvement.

      Note that this is not a permanent fix.  The next time you reboot, it will go back to the way it was, with power management on.  If turning it off worked and you want to make it permanent in a distro that, like Mint, uses NetworkManager, there’s an easy way:

      sudo xed /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

      xed is the text editor in Mint 18.3 Cinnamon.  If you are using another version of Linux, substitute what your text editor is named for xed (pluma if you are using a Mate desktop, kate/kwrite/kedit for KDE, etc.).

      In that file, look for wifi.powersave = 3.  Change the 3 to a 2, then save the file.

      Of course, then the filename says “powersave on” even though it contains the command to turn power saving off, which didn’t seem like a good idea to me, since I might later forget what it is supposed to mean.  I’m no Linux expert, but I’ve noticed that directories (folders) that end in .d usually contain .conf files that are all obeyed in a certain order (sometimes they are preceded by numbers, like 20-whatever.conf, which would be obeyed before 3o-whatever-else.conf, and so on, up to 99).  So I tried changing the name from default-wifi-powersave-on.conf to default-wifi-powersave-off.conf (using the Mint GUI, just right click and select rename from an elevated/root Nemo (file manager) window, which you can get by first right clicking the background and selecting “Open as root”.

      I rebooted to be sure, and iwconfig still shows power management as off, so it looks like the name change didn’t affect anything.  Whether or not you rename the file, a reboot will let you know if it is going to persist as intended or not.

      That should do it.

      It appears that the iwlwifi driver (the driver for all of the newer Intel wireless adapters) has a bug in power management that kills its throughput.  It’s been an issue for a long time, as you can see in how far back the messages from people asking for help go, but with the limited resources in Linux, these kinds of things happen sometimes, unfortunately.  It may be Intel’s binary blobs that are at fault, and since those are closed-source, there would be no way to fix it until Intel decides to do it themselves.

      How this will affect battery life, I do not know yet.  For me, the full speed of the wifi connection is only needed when doing LAN stuff like transferring files over the network.  Even the slow performance with power management enabled is good enough for most public wifi internet connections, and certainly for my own home internet connection, and that’s the main purpose of the laptop when I am not at my desk (where the laptop is likely plugged in, so the slight increase in power consumption by the wifi adapter won’t make any difference), so I may end up with some kind of a script to turn power management back on when the laptop goes on battery power.

      4 users thanked author for this post.
    • #197624 Reply

      johnf
      AskWoody Lounger

      Great answer, Ascaris!

      You can turn off power management with this command in terminal as well

      sudo sed -i ‘s/3/2/’ /etc/NetworkManager/conf.d/*

      (got that from here!)

      You can create a launcher with the script above, then just hit that button, add the password, and you’re set.

      Power management can be tricky, though, depending on the Card. Atheros cards are usually very Linux frendly, other cards like Broadcom and Realtek may not be. If someone is having issues with power mangement on those, they may want to either try and google solutions, or just put in a third party wireless USB dongle that’s Linux friendly.

       

       

      • This reply was modified 4 days, 10 hours ago by  johnf.
      2 users thanked author for this post.
      • #197635 Reply

        JohnW
        AskWoody Lounger

        I have never had any luck getting my WiFi dongle with Broadcom (Netgear WNA3100) to even connect under Linux.

        But the cheap 802.11N 150Mbps dongle I got with a Ralink chip (Panda) works with every distro I tested with, as well as Windows.  http://pandawireless.com/

        Haven’t had to dig into the power settings under Linux yet, but thanks for the tips!

        1 user thanked author for this post.
        • #197640 Reply

          Ascaris
          AskWoody MVP

          My Compaq (HP) M2000z laptop (single core AMD Turion CPU, Win XP era) laptop came with a Broadcom MiniPCI (not MiniPCIE; this thing was much larger, about the size of a business card but a bit taller) wifi card that I ended up replacing with an Atheros all those years ago, when I was running Ubuntu Feisty Fawn alongside the preinstalled XP.

          Of course, it being a HP, as soon as I put in the new wifi card, it refused to boot, since the card was not in the whitelist.  I did my first BIOS mod on that laptop to replace the Broadcom PCI ID with the one from the Atheros.  It worked, and I still have that laptop today, with its Atheros card still working just fine.  It still dual boots XP and Linux, though the Linux is Mint Xfce 32-bit now, and as you would expect, XP doesn’t get to connect to the outside world.  I don’t really have much use for the PC with it being as slow as it is and with me having so many laptops anyway, but it still works nicely.

          I’m told HP did away with the whitelists about three years ago, finally.  I wonder if Lenovo (the other notorious whitelister for wifi cards) has or will do the same.

        • #197713 Reply

          johnf
          AskWoody Lounger

          +1 for Panda! I have the same dongle (for an old laptop with a weird Realtek inboard wireless), and the Panda works perfectly!

        • #197719 Reply

          DrBonzo
          AskWoody Lounger

          I’ve got a PAU06 wireless dongle from Panda. Works flawlessly with a trivial setup (I’d call it true plug and play) on a 10 year old HP laptop running Ubuntu 16.04 LTS. Looks like they still sell it through Amazon for $15.00.

          Note: the Amazon description does not include Ubuntu 16.04 LTS, but as I recall I confirmed with Panda’s customer service that it would indeed work.

    • #197626 Reply

      MrJimPhelps
      AskWoody MVP

      Excellent info from both of you!

      I’ll have to try this, not only on my Linux Mint machine, but also on my Elementary OS machine. The Elementary OS machine needs all the help it can get, being an old, lame computer. But the fact that Elementary OS is a “light” version of Linux means that they may have already thought of that.

      I have a desktop, not a laptop, so I have no need for a power saving feature. Even if I had a laptop, as Ascaris said, the power you save is so small as to not really be worth the slower speed it causes.

      Group "L" (Linux Mint)
      with Windows 8.1 running in a VM
    • #198075 Reply

      Ascaris
      AskWoody MVP

      I just found this:

      Power Save Polling (PSP) Causes Connection Issues with Access Points

      “If a Wi-Fi access point (AP) or broadband Wi-Fi router does not support the power save polling (PSP) feature:

      • Intermittent loss of Wi-Fi connection
      • Inability to initiate a Wi-Fi connection
      • Poor Wi-Fi connection data performance”

      Note that third bullet item!

      The solution was to enable “continuous awareness mode,” which involves setting the profile to max performance mode (in XP), which is exactly what I am doing in Linux.  In Windows 8.1 or 7, it says to set transmit power to highest, which is what I have it set to in Linux, but I don’t have any reason to believe that continuous awareness mode is necessarily always linked to transmit power (if you read the article, you can see clearly that it is something else.  It’s linked in the Windows Intel driver, but is it in Linux?).

      Of course, this is Windows-centric advice, and I must note that in Windows, the same wifi card works flawlessly without changing any settings.  Still, it makes me wonder if my router is doing something incorrectly… I will have to research it.  The router uses DD-WRT, and I did find one mention of someone saying that they’d had reports that DD-WRT doesn’t do power saving well, but… well, the internet and grains of salt and what not.  It may or may not be this, but it’s worth some investigation.

      • This reply was modified 2 days, 8 hours ago by  Ascaris.
      1 user thanked author for this post.

    Please follow the -Lounge Rules- no personal attacks, no swearing, and politics/religion are relegated to the Rants forum.

    Reply To: Fixing slow wifi in Linux (Intel wifi)

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.

    Your information:


    Comments are closed.