Sunday, August 16, 2020

Unreliable Wifi on a 2018 Mac mini - a workaround

When I bought this Mac mini (2018) it was used with a permanent ethernet connection and all was well. It's only now that we're in a new house where I must use Wifi in my office that this problem has emerged.

For periods of time, up to about 24 hours, all will be fine and I can reliably ping the Wifi router over 5GHz Wifi, but then things will slow down and I can see terrible ping loss as shown on the right.

As you can imagine, this causes all sorts of trouble using the machine on the internet.

Searching for a fault with an Apple product, or probably any product, makes you feel that the problem is incredibly widespread but I think that it's just the illusion of being able to find similar stories with great ease on a search engine.

I have found many similar stories and tried all of the suggestions. Finally, I've found a workaround that is working for me. I have tried:

  • Rebooting everything (Wifi router, Mac)
  • Moving the Wifi router to get a better signal (RSSI -65, Noise -90)
  • Using a different Wifi router (Telstra modem and I tried a Google Wifi)
  • Turning off Bluetooth (there are stories of it interfering with Wifi)
  • Wiping the Mac and doing a clean install of macOS 10.15.6 Catalina (This seemed to work for about a day)
  • Unplugging USB devices (Again, stories of interference)
  • Running the built-in diagnostic, which found no hardware faults

In the end the solution for me is simply not to use Wifi. 

I have an old Thinkpad X230 on my desk running  Ubuntu 20.04.1 LTS which is used for WSPR, Fldigi, and other ham radio software. Following the instructions at Cesariogarcia I ran nm-connection-editor (which was already installed) and (slightly varying those instructions) edited the ethernet interface to set it's IPv4 settings to make it "Shared to other computers".

Open the Ethernet interface:

Edit the IPv4 settings to set the method like this:

I also changed the name so I'd remember. A pity this option isn't in the Sharing settings.

The Mac is plugged in with a normal Ethernet cable. (All recent Macs figure out if they need to cross over.) When I saved the setting on Linux the interface changed from "self assigned IP" to with the router as

I'd rather the laptop used bridge mode but I haven't figured that out yet.

Speed test isn't quite as fast as I can get when the Wifi was working reliably but it's much better than it was with 30% packet loss.

You can no doubt use a Raspberry Pi for this task and there are little Wifi routers that can do this too. The Thinkpad barely idles even when running a speed test. 

I hope this helps someone else with this issue. Incidentally, the Mac mini is out of warranty and I fear that if I take it to Apple it will work perfectly while they have it. I know I should give it a shot and I have had great experiences with the Genius folks in the past.

I've been monitoring with PeakHour and you can clearly see that ping loss (blue graph) has stopped since adding the linux gateway to the mac's network.

Apple has some tips on resolving Wifi and Bluetooth interference issues but this hasn't helped in my case. It might be worth trying before following my radical path.

What about printing etc?

One problem of having the Mac off the main network is that Bonjour zeroconf can't see the rest of the network so devices like the printer aren't immediately visible. (You can still get to them but you need to figure out the IP address).

The solution is to configure avahi-daemon on the Linux machine to "reflect". You do this by editing /etc/avahi/avahi-daemon.conf



(I got the interface names by running ifconfig).

You need to restart avahi:

sudo service avahi-daemon restart

It takes a minute or two for the names to propagate. I check them on the Mac by using the excellent Discovery app from Lily Ballard.

Update - a USB Wifi adapter

As a simpler alternatie I ordered a Hungwu USB 3.0 Wifi Adapter via Amazon

It came with a mini CD containing the driver but I don't have anything that can take these disks. I found an open source driver that works here. It's a bit weird in that you get an additional Wifi menu bar item that has found networks in a non-standard font.

Pretty bad that it tries to take over Command-W and Command-O but happily this doesn't affect the Finder or other apps.

The seller responded to my message quickly and sent a link to a driver but the one I found is working fine so I'll stick with it for now.

So far it's working well with no ping loss 24 hours later and as good a speed as I've had with the native Apple Wifi interface.

Call me an old "fuddy-duddy" but I find <2ms ping times over a wireless network pretty amazing.  For now, I've retired the Linux wifi to ethernet router described above. Note that Airdrop and watch unlock don't work with this Wifi adapter.

No comments: