NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.74k stars 13.86k forks source link

Missing WiFi driver while installing NixOS 16.03 on my Mac Mini 7,1 #15162

Closed ThomasMader closed 2 years ago

ThomasMader commented 8 years ago

This comes from #11540 but is separated into this issue. I installed NixOS unstable (16.03) on my Mac Mini 7,1 and have the following probem with it.

The Live CD wasn't able to provide me with WiFi. I guess the Live CD doesn't come with the needed drivers for my WiFI card (BCM4360 14e4:43a0) which are commercial :-( -> broadcom_sta I resolved my problem by using an Ethernet connection, after the installation WiFi worked. Would be nice if those could be packaged with the Live CD.

matthewbauer commented 8 years ago

The pkg "pkgs.broadcom_sta" in NixOS configuration should do it, but I'm not sure if we're allowed to distribute it. Does wifi work with other live cds?

vcunat commented 8 years ago

IIRC it is redistributable (and there are very few drivers that aren't).

We have a policy that Hydra doesn't build anything depending on unfree stuff, including the ISOs. Maybe we might make an exception for redistributable drivers?

vcunat commented 8 years ago

/cc @edolstra about allow-ability of unfree drivers on Hydra.

rasendubi commented 8 years ago

My friend suffered from the same issue. He has the same Wi-Fi card (BCM4360 14e4:43a0), and the network doesn't work on the Live CD. Unfortunately, he has no Ethernet...

b43 driver failed with:

b43-phy0 ERROR: FOUND UNSUPPORTED PHY (Analog 12, Type 11 (AC), Revision 1)
b43: probe of bcma0:1 failed with error -95

So I ended up packing a custom Live CD with the broadcom_sta. Can confirm it works fine.

I've checked up broadcom_sta is unfreeRedistributable (https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/broadcom-sta/default.nix#L45), so it would be nice to include it in the default image.

matthewbauer commented 8 years ago

broadcom_sta should be able to just go into hardware.firmware in nixos/modules/hardware/all-firmware.nix. The biggest issue though is that we want to use open source drivers when they are available.

according to https://wiki.debian.org/wl:

That leaves BCM43227 BCM43228 BCM43142 BCM43142 and BCM4360 that will need the broadcom provided "sta" driver. I don't know if there is a way to let only enable it for certain hardware?

While we're at it, can we see if there is any other nonfree wifi drivers that should be included?

rasendubi commented 8 years ago

Any update on this?

rasendubi commented 8 years ago

The issue seems to be waiting on @edolstra's input

rasendubi commented 7 years ago

(triage) @domenkozar, could you look into this?

vitvakatu commented 7 years ago

Hello! I want to try nixos on my laptop. Unfortunately, I have BCM43142 WiFi module, which is not working without proprietary drivers. I suppose, broadcom_sta will make it working. But I don't have opportunity to use wired connection during installation. Perhaps, someone can make custom installation ISO for me?

rasendubi commented 7 years ago

@vitvakatu here you go!

NixOS minimal (330M)

$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix
$ sha256sum nixos-17.03.git.12a3947-x86_64-linux.iso
fc762c9f94f0ca1ae48c9ccf0de9935b34503e7991191bcaf4b389adad338b75  nixos-17.03.git.12a3947-x86_64-linux.iso

NixOS graphical KDE (806M)

$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-graphical-kde.nix
$ sha256sum nixos-17.03.git.12a3947-x86_64-linux.iso
b564729a25dc92df2113324422820e7efe7f2cc47a33182c71379f25710d1c63  nixos-17.03.git.12a3947-x86_64-linux.iso

Built from https://github.com/rasendubi/nixpkgs/tree/nixos-broadcom-sta, nixos directory.

vitvakatu commented 7 years ago

@rasendubi Thank you so much! I successfully installed it :)

kyp0717 commented 7 years ago

I have the same problem - a wireless card made by broadcom. However, I am able to connect via ethernet. Can you please provide the steps to install the broadcom wireless card when connected via ethernet?

kyp0717 commented 7 years ago

Or alternatively, can you provide a more detailed steps to build the iso? That is, should I clone your folder? If so, which folder?
I plan to build a usb bootable using UnetBootin.

vcunat commented 7 years ago

@kyp0717: and your card isn't covered by our broadcom_sta module? EDIT: you probably have to enable the module explicitly.

srid commented 6 years ago

@rasendubi - After having installed using your image, is it possible to update the system to use upstream NixOS repos?

Otherwise, what is the recommended way to do "offline installation" of Broadcom drivers on a fresh install of NixOS on Mac?

rasendubi commented 6 years ago

@srid yes. Actually, it is only live image that is built using custom repo; the system you'll install from it will use upstream repo.

srid commented 6 years ago

@rasendubi Ah, I see. I'll give it a try, thanks.

svalaskevicius commented 6 years ago

any tips how do I install 18.03 from windows without this?

svalaskevicius commented 6 years ago

Nvm, used the provided custom image, thanks @rasendubi :)

svalaskevicius commented 6 years ago

Would be good though to include these essential modules in the std image

matthewbauer commented 6 years ago

@vcunat would this commit fix the issue:

c495d79237d372a777144cdd0ab9b7f09e572db1

?

I think that those drivers are already in the live cd.

svalaskevicius commented 6 years ago

To add to the last comment, I've tried 18.03 graphical install ISO and no luck (no module wl found, checked files manually in kernel modules too), the image linked in this pr helped.

Or do you mean it was on the nix store in the image? (I'm new to nixos so didn't check that.. Learning curve :) )

On a side note - had some fun with wpa supplicant and DHCP :) I'd suggest to document running wpa supplicant in foreground as then it reports errors on screen.. Also how to install DHCP (nix-env -i) and to run dhclient..

Anyways, its installed now, lessons learned. So far I like what I see, very much so!

vcunat commented 6 years ago

I don't think that commit would work. It's linuxPackages.broadcom_sta – a kernel module, not a firmware per se. EDIT: the link above looks right and was tested https://github.com/rasendubi/nixpkgs/commit/d135ae91b5

aaronjanse commented 6 years ago

NixOS noob here.

I tried @rasendubi's iso files and they worked (thank you!) but I'm not sure where to go from there. For context, I am trying to dual boot between NixOS and macOS. Should I dd the iso to a partition on my disk? Should I use it on a USB drive and from then build another version of NixOS while running the live USB somehow?

-- not sure if this is the right place to ask but it seems relevant and it might be helpful to others

rasendubi commented 6 years ago

There is nothing special about my iso. Just install your system as normal.

Don't forget to add "wl" and "broadcom_sta" so your fresh system has WiFi, too.

(I have something like this in my configuration.nix)

  boot.initrd.kernelModules = [ "wl" ];

  boot.kernelModules = [ "kvm-intel" "wl" ];
  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
rasendubi commented 6 years ago

FWIW, "normal" means "follow the manual."

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
andrewrk commented 4 years ago

Still important to me

matklad commented 3 years ago

The links to iso's no longer work, but this is how I build one from an existing NixOs installation:

# Clone nixpkgs repo
$ git clone https://github.com/NixOS/nixpkgs.git && cd nixpkgs

# Checkout the target channel (nixos-unstable in my case)
$ git switch nixos-unstable

# Apply the following patch
$ git diff
diff --git a/nixos/modules/profiles/all-hardware.nix b/nixos/modules/profiles/all-hardware.nix
index 19f821ae17f..c12866466da 100644
--- a/nixos/modules/profiles/all-hardware.nix
+++ b/nixos/modules/profiles/all-hardware.nix
@@ -3,7 +3,7 @@
 # enabled in the initrd.  Its primary use is in the NixOS installation
 # CDs.

-{ ... }:
+{ config, ... }:

 {

@@ -51,6 +51,10 @@
   # Include lots of firmware.
   hardware.enableRedistributableFirmware = true;

+  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
+  boot.kernelModules = [ "wl" ];
+  nixpkgs.config.allowUnfree = true;
+
   imports =
     [ ../hardware/network/zydas-zd1211.nix ];

# build the image
$ cd nixos
$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix default.nix

# Write iso to the USB stick
$ cat ./result/iso/nixos-21.03.git.ff8a3c75b9aM-x86_64-linux.iso > /dev/sdb
nixos-discourse commented 3 years ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/livecd-wifi-woes/10663/1

rasendubi commented 3 years ago

Yeah... I had ran out of space on gdrive and dropped isos. Wasn't sure how much interest there is given they are real old. Will update to 20.09 and host on s3 tomorrow.

rasendubi commented 3 years ago

NixOS 20.09 Live CD images with broadcom drivers:

SHA-256 ``` -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 5ec34285c21271a595aca13e045b4e7ac28d9756e630df7174dbf66fb79d3f9e nixos-20.09-gnome-x86_64-linux.iso e58d457ab5362c53d506312711d7720f93dc1411ab46e0bc08a3e67be85eb0e6 nixos-20.09-minimal-x86_64-linux.iso 5120b44630698de47984b2ee46210663c5e39f22f9de79b7bb655541395748c4 nixos-20.09-plasma5-x86_64-linux.iso -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE3PPB2N619bhpsT2i3O97zOswZsMFAl/oXIYACgkQ3O97zOsw ZsOEtQf/euBoaRehplY4Bizuf6BiIoffJFOKQU6SAF5DCuIBQuNvpTjbZPew2tXG IvcOde6k6ic/Gi5PhD1uO1WXLBqWQCRT8kJs62uHKFBIo0yj/DDy/0wCXnNKD8kv z4wymByh22dFT/Ib6FboBzZsYJWTsSlS7F0KgIbHmddzAUaT5ivXj/Kb3wp2WCdf /buH7fnRILt2ko/0exvFEHQ55KAV4qni9AN52VUCqk2YQ09K7Wn19c7O9aLtWdWI n+bv9w28QQZwg9nglntPLR3dqHTPyc8Jldr9+h05gW5iM/Ii+uw5YVRKicNhgGyA wHNjTxSSzWSS4PWq5CUEOxQtx5yPyw== =Yo3w -----END PGP SIGNATURE----- ```
How to build images yourself 1. Install Nix (NixOS is not required) 2. Checkout/cherry-pick the patch: https://github.com/rasendubi/nixpkgs/commit/fa004f814f97592d7ef0cdd08a1a4645eb831355 3. cd into nixos directory 4. build the image you want: ``` nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-graphical-gnome.nix nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix ``` 5. results are in `./result/iso/` directory

Besides adding broadcom driver to the live CD itself, there are no other differences. To install the system, follow the manual as usual.

Don't forget to install broadcom drivers into your final system, so it has Wi-Fi, too! Add the following lines your configuration.nix (or make sure they exist in hardware-configuration.nix):

nixpkgs.config.allowUnfree = true;
boot.kernelModules = [ "wl" ];
boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];

Enjoy!

stelcodes commented 3 years ago

For anyone else trying to install nixOS on their Macs, it seems like I'm not able to build my own images on x86_Darwin. Getting this:

error: Package ‘syslinux-unstable-20190207’ in /Users/stel/Code/nixpkgs/pkgs/os-specific/linux/syslinux/default.nix:96 is not supported on ‘x86_64-darwin’, refusing to evaluate.
Julian commented 2 years ago

In case anyone else has the same issue, after https://github.com/NixOS/nixpkgs/issues/15162#issuecomment-751451253 I still have some remaining issues trying to install on a Mac (an iMac in my case).

WiFi in the live USB works fine, but in the installed system I still can't get it to work. First one is a silly one, which is if you find you have no WiFi adapter found by Gnome after the install, you have to make sure you remembered to add your user to the networkmanager group via extraGroups, c.f. https://nixos.org/manual/nixos/stable/#sec-user-management.

Second is even after that, now I can connect to WiFi, but cannot get to the internet, just my local network. Somehow I think default routes I believe are being incorrectly discovered, but I don't know how to fix that yet. Will update after figuring it out (or asking for help).

EDIT: OK, indeed it was incorrect default routes, running sudo ip route del default && sudo ip route add default via $MYROUTERIP lets me reach the internet now. Not sure why the LiveUSB got me working internet and the booted system didn't -- I'm no expert neither on NixOS nor networking, so this may be offtopic for this ticket, if so feel free to hide the comment, but leaving it here given as I say, this worked fine on the LiveUSB boot, and I have no other LAN devices with WiFi issues, so maybe it'll help someone else.

flokli commented 2 years ago

I wrote some docs in https://github.com/NixOS/nixpkgs/pull/168306, which should probably document this sufficiently.

HHR2020 commented 2 years ago

In case anyone else has the same issue, after #15162 (comment) I still have some remaining issues trying to install on a Mac (an iMac in my case).

WiFi in the live USB works fine, but in the installed system I still can't get it to work. First one is a silly one, which is if you find you have no WiFi adapter found by Gnome after the install, you have to make sure you remembered to add your user to the networkmanager group via extraGroups, c.f. https://nixos.org/manual/nixos/stable/#sec-user-management.

~Second is even after that, now I can connect to WiFi, but cannot get to the internet, just my local network. Somehow I think default routes I believe are being incorrectly discovered, but I don't know how to fix that yet. Will update after figuring it out (or asking for help).~

EDIT: OK, indeed it was incorrect default routes, running sudo ip route del default && sudo ip route add default via $MYROUTERIP lets me reach the internet now. Not sure why the LiveUSB got me working internet and the booted system didn't -- I'm no expert neither on NixOS nor networking, so this may be offtopic for this ticket, if so feel free to hide the comment, but leaving it here given as I say, this worked fine on the LiveUSB boot, and I have no other LAN devices with WiFi issues, so maybe it'll help someone else.

I encountered the same route problem too. For some reason, I have to let the system installed on my computer boot in legacy mode, instead of EFI. As I have tested, networkmanager with wpa_supplicant as its backend doesn't work well, but it works if you only use wpa_supplicant without networkmanager. However, simply using wpa_supplicant without a gui front-end(wpa_gui doesn't work on my computer) isn't a good idea for me.

I solved the problem by using iwd as the backend of networkmanager instead. Add the following code in your configuration.nix and everything will work perfectly! networking.networkmanager.wifi.backend = "iwd"

NOTE: The system installed on my computer boots in legecy mode, but I boot the LiveCD in EFI mode. If your computer boots in EFI mode, you'll probably NOT encounter those problems.

My machine is a MacBook Pro 12-mid.

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/new-user-wifi-not-working-latest-nixos-with-enlightenment-de-on-imac-help-asap-appreciated/25068/2

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/no-wifi-on-fresh-install-kde-plasma/29537/2