networking – On starting up laptop WiFi works then after 5 minutes it stops working

This happened after an upgrade from 18.04 to 20.04.

Here is result of sudo lshw -C network:

       description: Wireless interface
       product: Ralink corp.
       vendor: Ralink corp.
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: wlo1
       version: 00
       serial: 84:4b:f5:09:eb:9b
       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-77-generic firmware=0.40 ip= latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:16 memory:c2500000-c250ffff
       description: Ethernet interface
       product: RTL810xE PCI Express Fast Ethernet controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: eno1
       version: 05
       serial: a0:b3:cc:83:74:2f
       size: 100Mbit/s
       capacity: 100Mbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8101 driverversion=1.035.03-NAPI duplex=full ip= latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:28 ioport:3000(size=256) memory:c2404000-c2404fff memory:c2400000-c2403fff
  *-network DISABLED
       description: Ethernet interface
       physical id: 2
       logical name: virbr0-nic
       serial: 52:54:00:32:15:a7
       size: 10Mbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=tun driverversion=1.6 duplex=full link=no multicast=yes port=twisted pair speed=10Mbit/s

here is the output of dmesg running it once before connecting and then after failing to connect.

I have three WiFi networks at home and whenever I try to connect to any of them I get a notification saying: Activation of network connection failed.

Here is also some data from syslog while trying to connect.

Also, I have a problem with snap. I can’t install snap packages. I’ve documented this problem here it might be related somehow…

I’ve also tried installing a different driver for the card, one from GitHub r8101 that didn’t change anything. I’ve also been looking into Google for a while but nothing helped.