Wifi suddenly stopped working on Ubuntu 18.04

Per request, here is the solution to fixing the Failed to start INIT ucode: -5 issue

Solution

  1. First, before you even move onto any steps having anything to do with the Linux kernel itself, make sure you have SecureBoot disabled in your BIOS. While SecureBoot was meant to be a security feature ensuring that all drivers are properly signed , from what I have seen this causes more problems than it solves in Linux kernel, especially when network and graphics drivers are concerned. This will more often than not be the key to solving this issue and your wifi driver will be loaded properly upon reboot.

  2. Once inside your Linux distro (and this is a good situation where using root account is actually appropriate), first ascertain if your kernel can see your wireless controller.

This first one will tell you whether the wireless card/controller can be seen as a device at all by your kernel (even if the driver initialization fails)

lshw -c network

While this one will tell you whether the system actually initialized it as a wireless device.

iw list

Now, in the case of OP the first command did show the Intel AC 9560, while the second command had a null output, telling us that the kernel a) can see the card but b) fails to initialize it. This tells us that the problem is more than likely related to the module/driver of the card

Just to be safe all run

sudo rfkill list

and make sure your wifi device is unblocked or just execute

sudo rfkill unblock all

to be sure that everything radio related is unblocked.

  1. If you have disabled SecureBoot in your BIOS, yet for some reason your wifi is still not loaded correctly on reboot you can then run:

    sudo rmmod iwlmvm && sudo modprobe iwlmvm
    

and the kernel will reload the module and initialize it properly, and from then on it will work on every subsequent reboot. Why it often doesn't work right away upon the first reboot is a mystery to me, because as far as I know and have been taught, modules get freshly loaded upon every boot. It is also possible that simply rebooting twice might produce the same outcome as executing the above command.

  1. Once you have a stable internet connection, update your kernel headers and microcode packages.