Preons
June 16, 2023, 11:30pm
1
I am trying to switch to NixOS from Fedora 38. I have a HP laptop with a Realtek network card. The required driver is rtw89
. While it seems NixOS (stable) has this (from running find / | grep rtw89
), nothing appears when trying to connect to the internet. (The only connection that appears after running ip address
is lo
(loopback)).
I tried using the unstable branch, but (unlike when I used Fedora 38 while it was in beta) it did not fix the problem.
Damage
June 17, 2023, 12:20am
2
I can’t help with the Wi-Fi, but i have found unstable more practical with less issues overall than stable. That said, i have had a number of issues as 23.05 became stable which i haven’t had the chance to resolve yet - mainly due to vacation with very little Internet access
1 Like
Preons
June 17, 2023, 2:00am
3
Thank you, but the unstable branch did not fix it, but if I can get it working, I’ll use the unstable branch.
Do you have
boot.kernelModules = [ "rtw89" ];
in your configuration?
1 Like
Preons
June 18, 2023, 7:15pm
5
Yes. I start the NixOS live environment, start Konsole, and run:
sudo su
nixos-generate-configuration
nixos-rebuild edit
Then, a small nix config file shows (one line of actual configuration!) I insert the boot.kernelModules = [ "rtw89" ]
line into the configuration, and run nixos-rebuild switch
. Following that, I get slammed with many many network errors (But nothing that prevents the configuration from being built I think.) I log out, log back in, and nothing changed. Still can’t install or use the internet on the NixOS live environment. I think it might have something to do with not being able to have data persist through restarts in live enviornments, but I can’t change that.
Ah, this is a boot option, so it will likely not work with the live environment.
You can try sudo modprobe
as you would do on any other Linux system.
1 Like
Preons
June 18, 2023, 9:39pm
7
modprobe
does not seem to search in the nix directory. It tries to look in /run/booted-system/kernel-modules/lib/6.1.33/
.
I’m not sure whether the live system includes this kernel module.
Try find /nix/store -name "*rtw89*.ko"
to locate it and use sudo insmod
with the path you found.
Preons
June 18, 2023, 11:26pm
9
It includes the rtw89_a, ae, c, and ce drivers. However I need the b and be ones. I think I’ll come back next release… Thank you!
If you have some means to circumvent the rtw89 for installation (ethernet, USB-Wifi) it might be possible to get the rtw89 working afterwards.
NixOS is using this driver:
It is packaged here:
{ stdenv, lib, fetchFromGitHub, kernel }:
let
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/rtw89";
in
stdenv.mkDerivation {
pname = "rtw89";
version = "unstable-2022-12-18";
src = fetchFromGitHub {
owner = "lwfinger";
repo = "rtw89";
rev = "e834edfe8bee6e27e31c2f783817a9c13ff45665";
sha256 = "19ApYiEvA0E6qgf5XQc03paZ+ghjZL8JoC3vSYYw3xU=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [ "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];
enableParallelBuilding = true;
This file has been truncated. show original
and it probably needs an update which hopefully also fixes the issues with 5.15 LTS:
opened 06:36AM - 16 Jun 22 UTC
0.kind: bug
6.topic: hardware
### Describe the bug
*Working with nixos-unstable*
I have a notebook `T14s G… en1` which requires the `rtw89` kernel module for wifi. This module worked for me until an upgrade on May 20 (after roughly a month of no updates).
Since then, the module doesn't work anymore on Kernel 5.15 (but I had a working configuration on 5.15.36). The config I had until it broke, was simply the following line in my config:
```
boot.extraModulePackages = with config.boot.kernelPackages; [ rtw89 ];
```
Since nothing has happened with the kernel module itself I assume it relates to following issue [splitting up firmwares](https://github.com/NixOS/nixpkgs/issues/148197).
Another possibility is that there is simply a bug in the kernel module which might already be fixed upstream and we need to upgrade it.
### Steps To Reproduce
1. Have a laptop with a Realtek 8852:
```
lspci | grep Network
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. Device 8852
```
2. Use the following in your `hardware-configuration.nix` and use Kernel 5.15.X
```
boot.extraModulePackages = with config.boot.kernelPackages; [ rtw89 ];
hardware.firmware = [ pkgs.rtw89-firmware ];
# optionally make sure you use kernel 5.15
#boot.kernelPackages = pkgs.linuxPackages_5_15;
```
3. Rebuild the config and reboot
The following stack trace appears in dmesg and wifi won't work:
```
[ 11.387364] rtw89_pci 0000:03:00.0: Firmware version 0.13.24.0, cmd version 0, type 1
[ 11.387371] rtw89_pci 0000:03:00.0: Firmware version 0.13.24.0, cmd version 0, type 3
[ 11.389419] BUG: unable to handle page fault for address: ffffb2e9427f25d4
[ 11.390477] #PF: supervisor write access in kernel mode
[ 11.391428] #PF: error_code(0x0003) - permissions violation
[ 11.392056] PGD 100000067 P4D 100000067 PUD 100193067 PMD 10981e067 PTE 80000001061f8161
[ 11.392975] Oops: 0003 [#1] SMP NOPTI
[ 11.393572] CPU: 2 PID: 910 Comm: systemd-udevd Tainted: G O 5.15.46 #1-NixOS
[ 11.394270] Hardware name: LENOVO 20UH0056MZ/20UH0056MZ, BIOS R1CET67W(1.36 ) 10/20/2021
[ 11.394958] RIP: 0010:rtw89_fw_download+0x6a/0x3e0 [rtw89core]
[ 11.395496] Code: c2 48 8b 28 44 8b 48 08 48 85 ed 0f 84 7f 0e 02 00 45 85 c9 0f 84 76 0e 02 00 0f b6 45 19 b9 e4 07 00 00 49 01 e9 48 8d 75 20 <66> 89 4d 1c 8d 78 02 88 44 24 10 c1 e7 04 89 7c 24 14 48 63 ff 48
[ 11.396292] RSP: 0018:ffffb2e94174ba98 EFLAGS: 00010296
[ 11.397184] RAX: 0000000000000003 RBX: 00000000000000ff RCX: 00000000000007e4
[ 11.397327] RDX: ffffa05574402120 RSI: ffffb2e9427f25d8 RDI: ffffa05574402000
[ 11.398330] RBP: ffffb2e9427f25b8 R08: 0000000000000088 R09: ffffb2e942853930
[ 11.399119] R10: 0000000000000000 R11: 0000000000000002 R12: 0000000000000000
[ 11.400265] R13: ffffa05574402000 R14: ffffa05574402000 R15: ffffa05540ff10c8
[ 11.400710] FS: 00007f770818cd40(0000) GS:ffffa0583f880000(0000) knlGS:0000000000000000
[ 11.401302] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 11.402054] CR2: ffffb2e9427f25d4 CR3: 0000000102434000 CR4: 0000000000350ee0
[ 11.402908] Call Trace:
[ 11.403531] <TASK>
[ 11.404990] ? schedule+0x44/0xa0
[ 11.404990] ? schedule_hrtimeout_range_clock+0x9d/0x120
[ 11.404990] ? __hrtimer_init+0xc0/0xc0
[ 11.407080] ? usleep_range_state+0x60/0x90
[ 11.408046] ? rtw89_pci_txbd_recalc+0x50/0x50 [rtw89pci]
[ 11.408046] ? hfc_func_en+0x26/0x70 [rtw89core]
[ 11.409761] ? rtw89_pci_ops_write16+0x20/0x20 [rtw89pci]
[ 11.410051] ? hfc_init.constprop.0+0x72c/0x750 [rtw89core]
[ 11.410918] rtw89_chip_info_setup+0x8c/0xf0 [rtw89core]
[ 11.410918] rtw89_pci_probe+0x9d6/0xb70 [rtw89pci]
[ 11.413050] local_pci_probe+0x42/0x80
[ 11.413807] ? __cond_resched+0x16/0x40
[ 11.414596] pci_device_probe+0xfa/0x1b0
[ 11.415246] really_probe+0x1f5/0x3f0
[ 11.415820] __driver_probe_device+0xfe/0x180
[ 11.416796] driver_probe_device+0x1e/0x90
[ 11.417494] __driver_attach+0xc0/0x1c0
[ 11.418450] ? __device_attach_driver+0xe0/0xe0
[ 11.419048] ? __device_attach_driver+0xe0/0xe0
[ 11.419482] bus_for_each_dev+0x78/0xc0
[ 11.420115] bus_add_driver+0x12b/0x1e0
[ 11.421043] driver_register+0x8f/0xe0
[ 11.421760] ? 0xffffffffc1339000
[ 11.422702] do_one_initcall+0x44/0x1d0
[ 11.423460] ? __cond_resched+0x16/0x40
[ 11.424130] ? kmem_cache_alloc_trace+0x44/0x3c0
[ 11.424560] do_init_module+0x4c/0x250
[ 11.425420] __do_sys_init_module+0x121/0x1a0
[ 11.426381] do_syscall_64+0x3b/0x90
[ 11.427081] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 11.427081] RIP: 0033:0x7f7708ab3eda
[ 11.427896] Code: 48 8b 0d 41 5f 0e 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 0e 5f 0e 00 f7 d8 64 89 01 48
[ 11.428641] RSP: 002b:00007ffcb98fdfd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
[ 11.428641] RAX: ffffffffffffffda RBX: 0000561a07d6afc0 RCX: 00007f7708ab3eda
[ 11.428641] RDX: 00007f7708c12b1d RSI: 0000000000133e58 RDI: 0000561a07d72220
[ 11.431323] RBP: 0000561a07d72220 R08: 0000000000000007 R09: 0000561a07d12c00
[ 11.431958] R10: 0000000000000005 R11: 0000000000000246 R12: 00007f7708c12b1d
[ 11.433309] R13: 0000561a07d6afc0 R14: 0000561a07bc1110 R15: 0000561a07d6afc0
[ 11.433419] </TASK>
```
`lshw` is also missing all the networking capabilities:
```
# lshw -C network
...
*-network
physical id: 0
bus info: pci@0000:03:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: driver=rtw89_pci latency=0
resources: irq:89 ioport:2000(size=256) memory:fd600000-fd6fffff
```
### Expected behavior
No stack trace in dmesg and working Wifi.
### Additional context
I worked around it by using the newest kernel which has `rtw89` built into the kernel and the rtw89-firmware (the `extraModulePackages` isn't necessary:
```
boot.kernelPackages = pkgs.linuxPackages_5_18;
hardware.firmware = [ pkgs.rtw89-firmware ];
```
### Notify maintainers
@TvoroG
### Metadata
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
```console
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.06 MiB download, 0.30 MiB unpacked):
/nix/store/6pkx11fz05v4m8jgx76y1q1ri6llpf3i-bash-interactive-5.1-p16-dev
copying path '/nix/store/6pkx11fz05v4m8jgx76y1q1ri6llpf3i-bash-interactive-5.1-p16-dev' from 'https://cache.nixos.org'...
- system: `"x86_64-linux"`
- host os: `Linux 5.15.46, NixOS, 22.11 (Raccoon), 22.11pre385289.6616de389ed`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.9.1`
- channels(root): `"nixos"`
- channels(samuelh): `""`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
```
Hello! I’ve recently acquired a 4th gen ThinkPad E14 but have been struggling to get WiFi going… According to the spec-sheet, this laptop should have an RTL8852be chip.
Reading around that sounds like the rtw89 package is what I’m looking for but it’s complicated : the kernel module package seems to be broken. Moreover it seems that config.boot.kernelPackages.rtw89 is gone entirely?
hardware.firmware = [ pkgs.rtw89-firmware ];
boot.extraModulePackages = with config.boot.kernelPackages; [ rtw…
Once the update is in, you can check the Live-System based on unstable.
1 Like