Unreliable wifi on Ubuntu - RT3290 Wireless 802.11n 1T/1R PCIe

Asked by Gergő Nagy

Dear Community,

I have an HP 4340s laptop, and have been using Ubuntu since 2013.
During the years I used mainly LTS versions though the symptoms I'm describing occurred on several version. I can't recall exactly though as far as I can, 14.04 LTS and 18.04 LTS were stable in terms of the wifi, though 17.10 and 19.10 were not. I hoped that going up to 20.04 LTS will solve this phenomenon again, though unfortunately it's not the case.

Issues:
1) wifi is working for a while then suddenly the Wifi icon turns to be a (?) - question mark - and no network is available
  - workarounds:
    - put wifi to airplane mode, and turn it again
    - run this command: sudo ifconfig wlo1 down;sleep 5;sudo ifconfig wlo1 up;
2) GIVEN wifi is on, WHEN I power off the laptop it turns off THEN restarts in a couple second 3-4 sec
  - workarounds:
   - put wifi to airplane mode, and power off after this
   - run this command: sudo ifconfig wlo1 down;sleep 5;shutdown now

I think the problem is around the wifi driver, though before I start replacing it based on random linux forum comments I though I summarize it here perhaps someone experienced the same.

Some details:
gnagy@hp-pb-4340s:~$ uname -a
Linux hp-pb-4340s 5.4.0-28-generic #32-Ubuntu SMP Wed Apr 22 17:40:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

gnagy@hp-pb-4340s:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"

gnagy@hp-pb-4340s:~$ sudo lshw -C network
  *-network
       description: Wireless interface
       product: RT3290 Wireless 802.11n 1T/1R PCIe
       vendor: Ralink corp.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: wlo1
       version: 00
       serial: f4:b7:e2:1d:ea:25
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rt2800pci driverversion=5.4.0-28-generic firmware=0.37 ip=192.168.0.94 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:19 memory:d0610000-d061ffff

As I found 'driver=rt2800pci' is the open source driver and "is experimental"

I tried today:
gnagy@hp-pb-4340s:~$ sudo iwconfig wlo1 power off
gnagy@hp-pb-4340s:~$ iwconfig
wlo1 IEEE 802.11 ESSID:"Radios internet"
          Mode:Managed Frequency:2.442 GHz Access Point: 34:2C:C4:92:29:28
          Bit Rate=65 Mb/s Tx-Power=20 dBm
          Retry short long limit:2 RTS thr:off Fragment thr:off
          Power Management:off <--- this is off now, before the command it was on
          Link Quality=44/70 Signal level=-66 dBm
          Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
          Tx excessive retries:0 Invalid misc:40 Missed beacon:0

Wifi seems to be stable for a while let's see whether it solves the random wifi drop issue or not.
However it does not solve the restart issue.

I welcome any idea around this.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Gergő Nagy
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Try:

echo "options rt2800pci nohwcrypt=1" | sudo tee /etc/modprobe.d/rt2800pcifix.conf > /dev/null

Reboot to test. If it is no good then run:

sudo rm etc/modprobe.d/rt2800pcifix.conf

Then reboot

Revision history for this message
Gergő Nagy (ngergoistvan) said :
#2

Hi actionparsnip,

Thanks for your prompt reply.

I'll try this, though could you please tell me which issue should be solved by these steps?

Many thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Should make the WiFi more reliable. I can only see one issue in your post....

Revision history for this message
Gergő Nagy (ngergoistvan) said :
#4

Let me quote them:
Issues:
"1) wifi is working for a while then suddenly the Wifi icon turns to be a (?) - question mark - and no network is available
  - workarounds: (see in the original post)
2) GIVEN wifi is on, WHEN I power off the laptop it turns off THEN restarts in a couple second 3-4 sec
  - workarounds: (see in the original post)"

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Why not just try it. It costs nothing and is easily rolled back........

Revision history for this message
Gergő Nagy (ngergoistvan) said :
#6

Hi,

So I did further investigation and found this as well:
sudo modprobe -r rt2800pci
sudo modprobe rt2800pci nohwcrypt=1

Issue 2 seems to be resolved.

Testing is progress to prove that it solves Issue 1 as well.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

That's exactly what my fix does but survives a reboot. Running those commands only fixes the issue in the current boot. Once you reload Ubuntu the setting will not be present. The command I gave sets up a file so that the option is applied every time the kernel module is loaded.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

If you run:

sudo ifconfig wlo1 down;sleep 5;sudo ifconfig wlo1 up

Does it work OK? If so, we can add that to the boot up.

Revision history for this message
Gergő Nagy (ngergoistvan) said :
#9

Hi,

Thanks I got what your command do, though I didn't know that modprobe did not persist into a file. I expected so, anyway.
Will write to the file you mentioned.

Regarding the workaround I wrote:
sudo ifconfig wlo1 down;sleep 5;sudo ifconfig wlo1 up

So this was a command that I had to run each time the wifi card dropped the network. I just created it not to click on icons so many times. I simply reran it each time the wifi network was interrupted.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#10

Yes but yours had a reboot. The one I gave doesn't.

Have you rebooted your router? It is a computer after all. Might help

Revision history for this message
Gergő Nagy (ngergoistvan) said :
#11

I would close this thread.

I spent a couple of more hours on investigation and wizzed through several forums etc, and the conclusion for me:
This Wifi card I have is not fully supported by Linux:
* there is only an experimental driver called rt2800pci
* Ralink does not provide official driver for newer linux kernels
* I could hack and patch around the problem:
  * turning off power management
  * turning off wifi before shutdown to prevent reboot

Also this model of card would support Bluetooth, though as there is no official driver it's quite hopeless to get it working.

The ultimate solution is to by a new internal Wifi card which has official Linux driver available.