No wifi with Broadcom 43142 - Ubuntu 16.04

After browsing the internet for several hours, trying to figure out how to fix the issue I am having, I come to you in desperate time of need.

I am currently using Ubuntu 16.04 and for some reason, I can't make the wifi work at all.

When I run:

sudo apt-get install bcmwl-kernel-source

I get the following:

Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les NOUVEAUX paquets suivants seront installés :
  bcmwl-kernel-source
0 mis à jour, 1 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 0 o/1 515 ko dans les archives.
Après cette opération, 8 013 ko d'espace disque supplémentaires seront utilisés.
Sélection du paquet bcmwl-kernel-source précédemment désélectionné.
(Lecture de la base de données... 444582 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu8_amd64.deb ...
Dépaquetage de bcmwl-kernel-source (6.30.223.248+bdcom-0ubuntu8) ...
Paramétrage de bcmwl-kernel-source (6.30.223.248+bdcom-0ubuntu8) ...
Loading new bcmwl-6.30.223.248+bdcom DKMS files...
First Installation: checking all kernels...
Building only for 4.4.0-47-generic
Building for architecture x86_64
Building initial module for 4.4.0-47-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/bcmwl-kernel-source.0.crash'
Error! Bad return status for module build on kernel: 4.4.0-47-generic (x86_64)
Consult /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/make.log for more information.
modprobe: FATAL: Module wl not found in directory /lib/modules/4.4.0-47-generic
update-initramfs: deferring update (trigger activated)
Traitement des actions différées (« triggers ») pour initramfs-tools (0.122ubuntu8.5) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-47-generic

As you can see, the module wl is not found and I haven't found a single way to fix that issue.

Here are some more infos:

lspci -knn | grep Net -A2

returns:

08:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)
    DeviceName: Broadcom BCM43142 802.11bgn 1x1 WiFi Adapter + BT 4.0 combo adapter
    Subsystem: Hewlett-Packard Company BCM43142 802.11b/g/n [103c:2230]

I am also booting in insecure mod.

I have installed Ubuntu with UEFI Bios using a flashdrive.

cat /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/make.log

gives:

DKMS make.log for bcmwl-6.30.223.248+bdcom for kernel 4.4.0-47-generic (x86_64)
mercredi 9 novembre 2016, 22:00:56 (UTC+0100)
make : on entre dans le répertoire « /usr/src/linux-headers-4.4.0-47-generic »
Makefile:691: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  LD      /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/built-in.o
  CC [M]  /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/src/shared/linux_osl.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
scripts/Makefile.build:258 : la recette pour la cible « /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/src/shared/linux_osl.o » a échouée
make[1]: *** [/var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/src/shared/linux_osl.o] Erreur 1
Makefile:1418 : la recette pour la cible « _module_/var/lib/dkms/bcmwl/6.30.223.248+bdcom/build » a échouée
make: *** [_module_/var/lib/dkms/bcmwl/6.30.223.248+bdcom/build] Erreur 2
make : on quitte le répertoire « /usr/src/linux-headers-4.4.0-47-generic »

Solution 1:

If you wouldn't solve your problem in another way, you can always install it from the source, which is described in second point.

  1. How I installed my BCM4360 on Ubuntu 16.04 Xenial. We have the same card vendor, so just to make sure you haven't omitted any step.
  2. The last resort aka building from source.

Ad. 1

sudo -i
apt update
apt upgrade
apt-get purge bcmwl-kernel-source
reboot

sudo -i
apt update
apt-get install build-essential    # Just to make sure if it's installed
update-pciids
apt-get install bcmwl-kernel-source
reboot

# If it's still not working type:
# modprobe wl

After that I had list of available WiFi networks in network menu at top bar, but I had to check something like "All users can connect with this network" in Modify connections in the same drop-down menu. (I think it's much more safe to use two separate steps purge & install rather than install --reinstall).

Ad. 2

If everything else would fail, you could always install the driver from source. Pretty good explanation is given here http://www.broadcom.com/docs/linux_sta/README.txt

Frankly, I've never done it before, because I've never had to and probably you also won't.

Better check that against this README, but the installation process should start like that:

sudo -i
apt-get install build-essential linux-headers-generic
#
# I'm not sure with this following line:
# apt-get build-dep linux-generic
#
mkdir hybrid_wl
cd hybrid_wl
[ `uname -m` == 'x86_64' ] && FILE='hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz' || FILE='hybrid-v35-nodebug-pcoem-6_30_223_271.tar.gz'
wget http://www.broadcom.com/docs/linux_sta/$FILE
tar -zxf $FILE
make clean
make
make install

The next steps depends on whether you're already using wl module, but in README they suggest checking

/lib/modules/`uname -r`/kernel/net/wireless

and on my computer I've found it in

/lib/modules/`uname -r`/updates/dkms/wl.ko

Better check it with:

sudo find / -name wl.ko

Looking at Broadcom official support site, it seems that version 6.30.223.271 downloaded above is the most up to date (compare it with 6.30.223.248 availabale in Xenial or even Yakkety repos).