Realtek-r8152 -- build with dkms fails

I’ve got a Lenovo USB-C hybrid dock, which obviously comes with a Realtek r8152 network chip. Out of the box, tumbleweed does not support the dock, I need the evdi driver and a the r8152 driver. The latter is available with

[git clone GitHub - wget/realtek-r8152-linux: A kernel module for Realtek RTL8152/RTL8153 Based USB Ethernet Adapters - Meant to be used in distributions only - For upstream bugs, please report them to your distribution maintainer or to Realtek.](git clone GitHub - wget/realtek-r8152-linux: A kernel module for Realtek RTL8152/RTL8153 Based USB Ethernet Adapters - Meant to be used in distributions only - For upstream bugs, please report them to your distribution maintainer or to Realtek.)

Works like a charm:

make -j2

then

sudo depmod -a

then

 sudo make install
make -C /lib/modules/6.11.3-2-default/build M=/home/AW/Downloads/realtek-r8152/realtek-r8152-linux INSTALL_MOD_DIR=kernel/drivers/net/usb modules_install
make[1]: Verzeichnis „/usr/src/linux-6.11.3-2-obj/x86_64/default“ wird betreten
  INSTALL /usr/lib/modules/6.11.3-2-default/kernel/drivers/net/usb/r8152.ko
  DEPMOD  /usr/lib/modules/6.11.3-2-default
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Verzeichnis „/usr/src/linux-6.11.3-2-obj/x86_64/default“ wird verlassen
modprobe r8152

Quick test:

hwinfo --netcard
33: USB 00.0: 0200 Ethernet controller
  [Created at usb.122]
  Unique ID: TdZS.SW7EWJRoTxC
  Parent ID: 7bWa.8jK6xb13aDA
  SysFS ID: /devices/pci0000:00/0000:00:0d.0/usb2/2-3/2-3.3/2-3.3:1.0
  SysFS BusID: 2-3.3:1.0
  Hardware Class: network
  Model: "Lenovo ThinkPad Lan"
  Hotplug: USB
  Vendor: usb 0x17ef "Lenovo"
  Device: usb 0xa359 "ThinkPad Lan"
  Revision: "31.03"
  Serial ID: "301F5A52C"
  Driver: "r8152"
  Driver Modules: "r8152"
  Device File: enp0s13f0u3u3
  HW Address: 00:50:b6:f5:a5:2c
  Permanent HW Address: 00:50:b6:f5:a5:2c
  Link detected: yes
  Module Alias: "usb:v17EFpA359d3103dc00dsc00dp00icFFiscFFip00in00"
  Driver Info #0:
    Driver Status: r8152 is active
    Driver Activation Cmd: "modprobe r8152"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #54 (Hub)

But unfortunately dkms fails:

dkms build -m realtek-r8152 -v 2.18.1

dkms build -m realtek-r8152 -v 2.18.1
Sign command: /lib/modules/6.11.5-1-default/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/realtek-r8152/2.18.1/source/dkms.conf)

Building module:
Cleaning build area...
Building module(s).....
Error!  Build of r8152.ko failed for: 6.11.5-1-default (x86_64)
Make sure the name of the generated module is correct and at the root of the
build directory, or consult make.log in the build directory
/var/lib/dkms/realtek-r8152/2.18.1/build for more information.

And this log says:

DKMS make.log for realtek-r8152-2.18.1 for kernel 6.11.5-1-default (x86_64)
Sa 26. Okt 19:18:02 CEST 2024
make: Verzeichnis „/var/lib/dkms/realtek-r8152/2.18.1/build“ wird betreten
make -C /lib/modules/6.11.5-1-default/build M=/var/lib/dkms/realtek-r8152/2.18.1/build modules
make[1]: Verzeichnis „/usr/src/linux-6.11.5-1-obj/x86_64/default“ wird betreten
  CC [M]  /var/lib/dkms/realtek-r8152/2.18.1/build/r8152.o
  MODPOST /var/lib/dkms/realtek-r8152/2.18.1/build/Module.symvers
  CC [M]  /var/lib/dkms/realtek-r8152/2.18.1/build/r8152.mod.o
  LD [M]  /var/lib/dkms/realtek-r8152/2.18.1/build/r8152.ko
  BTF [M] /var/lib/dkms/realtek-r8152/2.18.1/build/r8152.ko
Skipping BTF generation for /var/lib/dkms/realtek-r8152/2.18.1/build/r8152.ko due to unavailability of vmlinux
make[1]: Verzeichnis „/usr/src/linux-6.11.5-1-obj/x86_64/default“ wird verlassen
make: Verzeichnis „/var/lib/dkms/realtek-r8152/2.18.1/build“ wird verlassen

But the driver has been built, I see the files r8152.c , .ko , .mod , .mod.c , mod.o , o.

I’m a user, maybe I’m doing something really stupid, or I’m missing something – ?

Here comes the dkms.conf file I wrote:

PACKAGE_NAME="realtek-r8152"
PACKAGE_VERSION="2.18.1"

MAKE="'make' -C ./ modules"
CLEAN="'make' clean"

DEST_MODULE_LOCATION=/extra
BUILT_MODULE_NAME[0]="r8152"
BUILT_MODULE_LOCATION[0]="src"

AUTOINSTALL="yes"
REMAKE_INITRD=no

So, before I’m going on to waste my time: any ideas?

r8152 should be inside the Kernel:

laptop:/home/stephan # modinfo r8152
filename:       /lib/modules/5.14.21-150500.55.83-default/kernel/drivers/net/usb/r8152.ko.zst
version:        v1.12.13
license:        GPL
description:    Realtek RTL8152/RTL8153 Based USB Ethernet Adapters
author:         Realtek linux nic maintainers <nic_swsd@realtek.com>

Or this one from here:
https://download.opensuse.org/repositories/home:/Sauerland:/hardware/openSUSE_Tumbleweed/

Yes, same here:

b/modules/6.11.5-1-default/kernel/drivers/net/usb/r8152.ko
version:        v2.18.1 (2024/05/20)
license:        GPL
description:    Realtek RTL8152/RTL8153 Based USB Ethernet Adapters
author:         Realtek nic sw <nic_swsd@realtek.com>
suserelease:    openSUSE Tumbleweed
srcversion:     1EDCAE164193E198AC7CDE4

Especially “suserelease” hints at openSUSE as maintainer.

But it “doesn’t work”: When I connect the dock to the laptop, another ethernet driver (cdc_… something) gets loaded and works poorly. Anytime the laptop goes into suspend, my whole network at home breaks down, until I pull the ethernet cable from the dock.

Probably you provide packages for r8152 and many other chips for that reason, don’t you?

OK, I’ll try you package, thank you very much!

Why does it say:

r8152-kmp-default - udev-rule File for r8152

– the package contains the driver and, as far as I can see, no udev-rule file?

there is a:
kmp-package with the driver
udev-rules with the udev rules for the USB dongles
uefi-cert with the cert for secure boot.

so 3 packages to install.

First of all: thank you for helping!

There are four r8152 packages, of which three share the same summary in Yast:

  • r8152-kmp-default, " udev-rule File for r8152" and
  • r8152-udev-rules, " udev-rule File for r8152"
  • r8152-kmp-pae, " udev-rule File for r8152"

The field “description” (here: “Beschreibung” and I translated the Yast column “Zusammenfassung” with summary) there is a kind of heading, for the last package it says:

r8152-kmp-pae - udev-rule File for r8152

I installed three (not the pae kernel module), it works™. I fail to translate “eine Baustelle weniger” (“one more issue closed” may be ok).

4 only if you use Tumbleweed 32 bit.

Post:
uname -a

If I search for r8152 in Yast (!), having your repo active, I get four packages:

  1. r8152-udev-rules
  2. r8152-kmp-default
  3. r8152-kmp-pae
  4. r8152-ueficert

So Yast adds the pae-version as possibility to install, although the machine runs on x86_64, as uname -a shows:

Linux X1CarbG9-AW 6.11.5-1-default #1 SMP PREEMPT_DYNAMIC Wed Oct 23 04:27:11 UTC 2024 (b4e3aa9) x86_64 x86_64 x86_64 GNU/Linux

However.

I had to uninstall the package r8152-kmp-default, because it broke the DisplayLink driver from home:jtorres:displaylink . This dock wasn’t constructed with Linux users in mind. And now, I’ll shut down my computer for today and go and cook something !

The pae kernel is an 32 bit kernel, but you have installed an 64 bit kernel…

So only the r8152-kmp-default in 64 bit will work.

Of course. I installed kmp-default and not pae. There is no doubt about that.

Why do you use an /home: Repo when this is a branch from the X11:Xorg Repo?

I do not know, if the r8152 is breaking something, but it should not.

Aha:

udev rules configuring DisplayLink usb ethernet device

IMPORT{builtin}=“usb_id”

ACTION==“add|move|bind”, ENV{ID_USB_DRIVER}==“cdc_ncm”, ATTRS{idVendor}==“17e9”, ATTR{cdc_ncm/rx_max}==“?“, ATTR{cdc_ncm/dwNtbInMaxSize}==”?”, ATTR{cdc_ncm/rx_max}=“$attr{cdc_ncm/dwNtbInMaxSize}”
ACTION==“add|move|bind”, ENV{ID_USB_DRIVER}==“cdc_ncm”, ATTRS{idVendor}==“17e9”, ATTR{cdc_ncm/tx_max}==“?“, ATTR{cdc_ncm/dwNtbOutMaxSize}==”?”, ATTR{cdc_ncm/tx_max}=“$attr{cdc_ncm/dwNtbOutMaxSize}”

1 Like

I’m seeing this here:

If you ask me: that’s a bug, isn’t it? It should be r8152 instead of cdc_ncm. I left a comment here:

But not all devices with displaylink will have a r8152 chip for ethernet, I guess.

I haven’t found a bugreport on bugzilla.opensuse.org yet. Should I write one?

Bugreport: 1232668 – displaylink driver uses wrong ethernet module cdc_ncm instead of r8152

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.