Coder Social home page Coder Social logo

awesometic / realtek-r8152-dkms Goto Github PK

View Code? Open in Web Editor NEW
52.0 5.0 13.0 161 KB

A DKMS package for easy use of Realtek r8152 driver, which supports Realtek USB NICs including RTL8156 2.5 GbE.

License: GNU General Public License v2.0

Makefile 0.29% Shell 0.40% C 99.31%
debian dkms realtek-driver launchpad-ppa r8152 realtek rtl8152

realtek-r8152-dkms's Introduction

Realtek r8152 DKMS

GitHub release (latest SemVer)

This provides Realtek r8152 driver in DKMS way so that you can keep the latest driver even after the kernel upgrade.

Compatibility

The RTL8152 driver supports the following USB Ethernet chipsets.

  • RTL8156 / RTL8156B(S)(G): 2.5 GbE (USB 3.0)
  • RTL8153 / RTL8153B: 10/100/1000 MbE (USB 3.0)
  • RTL8154 / RTL8154B: 10/100/1000 MbE (USB 2.0)
  • RTL8152B: 10/100M (USB2.0)

Installation

There are 3 ways to install this DKMS module. Choose one as your tastes.

Those are not interfering with each other. So you can do all 3 methods but absolutely you don't need to.

Installation using the Debian package is recommended for the sake of getting the newer driver.

Debian package

Released package file

Download the latest Debian package from the Release tab on the Github repository.

Then enter the following command.

sudo dpkg -i realtek-r8152-dkms*.deb

If multiple files selected by the wild card, you should type the specific version of the file.

sudo dpkg -i realtek-r8152-dkms*.deb

If dependency error occurs, try to fix that with apt command.

sudo apt install --fix-broken

Launchpad PPA (Recommended)

Add the Launchpad PPA.

sudo add-apt-repository ppa:awesometic/ppa

Then install the package using apt tool.

sudo apt install realtek-r8152-dkms

autorun.sh

Using the autorun.sh script that Realtek provides on their original driver package. This is not installed as a DKMS, only efforts to the current kernel.

Download or clone this repository and move to the extracted directory, then run the script.

sudo ./autorun.sh

dkms-install.sh

This script is from aircrack-ng team. You can install the DKMS module by a simple command.

Download or clone this repository and move to the extracted directory, then run the script.

sudo ./dkms-install.sh

Debian package build

You can build yourself this after installing some dependencies including dkms.

sudo apt install devscripts debmake debhelper build-essential dkms
dpkg-buildpackage -b -rfakeroot -us -uc

LICENSE

GPL-2 on Realtek driver and the debian packaing.

References

realtek-r8152-dkms's People

Contributors

awesometic avatar corytodd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

realtek-r8152-dkms's Issues

Cannot build module

Board is a Raspberry Pi 4, running 64bit Debian 11 Bullseye, kernel is 6.1.21-v8+, headers installed via raspberrypi-kernel-headers and are appropriate version 6.1.21-v8+.

Print of uname -a
Linux orthanc 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

Device info:
ASUS 10/100/1000/2500 USB-C2500
Link to tech specs: http://en.techinfodepot.shoutwiki.com/wiki/ASUS_USB-C2500
Realtek RTL8156B • USB ID: [0b05:1976]
Interesting to note, it uses a different Vendor ID and Product IDs from all other devices mentioned in 50-usb-realtek-net.rules; however it is mentioned in all of the tested repo's r8152.c files.

Doesn't seem to matter which method I use to try and build the module, I error out. See prints below.

Troubleshooting steps taken:
Fresh 32-bit install (same problem)
Fresh 64-bit install (same problem)
Attempted build on Rock5b (Just to make sure I'm not crazy), 5.10 kernel (make successful)

Attempted building from the following sources:
Realtek provided download
wget's repo
menzo2003's repo
This repo

Is there something fundamentally incompatible with this kernel version? I see there are a number of people who have it working on various other kernel versions; including yourself fixing it on 6.1 for Proxmox.

Possibly something silly with the aarch64 architecture instead of x86?

Thank you so much for your help!


Print from autorun.sh:

ERROR: modpost: /home/pi/Downloads/realtek-r8152-dkms-master/src/r8152: 'rtl8152_get_version' exported twice. Previous export was in vmlinux
make[3]: *** [scripts/Makefile.modpost:126: /home/pi/Downloads/realtek-r8152-dkms-master/src/Module.symvers] Error 1
make[2]: *** [Makefile:1964: modpost] Error 2
make[1]: *** [Makefile:24: modules] Error 2
make: *** [Makefile:18: modules] Error 2

Print from ./dkms-install

About to run dkms install steps...

Creating symlink /var/lib/dkms/r8152/2.17.1/source ->
                 /usr/src/r8152-2.17.1

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j4 KERNELRELEASE=6.1.21-v8+ -C /lib/modules/6.1.21-v8+/build M=/var/lib/dkms/r8152/2.17.1/build.........(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.21-v8+ (aarch64)
Consult /var/lib/dkms/r8152/2.17.1/build/make.log for more information.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j4 KERNELRELEASE=6.1.21-v8+ -C /lib/modules/6.1.21-v8+/build M=/var/lib/dkms/r8152/2.17.1/build.........(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.21-v8+ (aarch64)
Consult /var/lib/dkms/r8152/2.17.1/build/make.log for more information.
Finished running dkms install steps.
Copy the dedicated udev rules file...
Restarting udev...
Finished.

Print from .deb dpkg install:

sudo dpkg -i realtek-r8152-dkms_2.17.1-1_arm64.deb 
Selecting previously unselected package realtek-r8152-dkms.
(Reading database ... 124154 files and directories currently installed.)
Preparing to unpack realtek-r8152-dkms_2.17.1-1_arm64.deb ...
Unpacking realtek-r8152-dkms (2.17.1-1) ...
Setting up realtek-r8152-dkms (2.17.1-1) ...
Loading new realtek-r8152-2.17.1 DKMS files...
It is likely that 6.1.21-v8+ belongs to a chroot's host
Building for 6.1.21-v8+
Building for architecture arm64
Building initial module for 6.1.21-v8+
Error! Bad return status for module build on kernel: 6.1.21-v8+ (arm64)
Consult /var/lib/dkms/realtek-r8152/2.17.1/build/make.log for more information.
dpkg: error processing package realtek-r8152-dkms (--install):
 installed realtek-r8152-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 realtek-r8152-dkms

Output from make.log:

DKMS make.log for realtek-r8152-2.17.1 for kernel 6.1.21-v8+ (arm64)
Wed 23 Aug 13:20:33 MST 2023
make -C src/ modules
make[1]: Entering directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'
make -C /lib/modules/6.1.21-v8+/build M=/var/lib/dkms/realtek-r8152/2.17.1/build/src modules
make[2]: Entering directory '/usr/src/linux-headers-6.1.21-v8+'
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o
  MODPOST /var/lib/dkms/realtek-r8152/2.17.1/build/src/Module.symvers
ERROR: modpost: /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152: 'rtl8152_get_version' exported twice. Previous export was in vmlinux
make[3]: *** [scripts/Makefile.modpost:126: /var/lib/dkms/realtek-r8152/2.17.1/build/src/Module.symvers] Error 1
make[2]: *** [Makefile:1964: modpost] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-6.1.21-v8+'
make[1]: *** [Makefile:24: modules] Error 2
make[1]: Leaving directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'
make: *** [Makefile:18: modules] Error 2

Kernel 6.4 error

Building dkms module on kernel 6.4 gives the following error:

/var/lib/dkms/r8152/2.17.1/build/src/r8152.c:2094:10: error: implicit declaration of function ‘skb_gso_segment’; did you mean ‘skb_gso_reset’? [-Werror=implicit-function-declaration]
 2094 |   segs = skb_gso_segment(skb, features);
      |          ^~~~~~~~~~~~~~~
      |          skb_gso_reset

I was able to work around this by adding the following to r8152.c, taken from https://github.com/wget/realtek-r8152-linux/blob/master/r8152.c:

// Linux 6.4.10 added net/gso.h
#if defined __has_include
#if __has_include (<net/gso.h>)
#include <net/gso.h>
#endif
#endif

Registration/signing issue? Driver works but can't get LAN (from debian package)

Glad I found this repo, I have a 3 USB 1 LAN port PCIe expander that was not working with my system and causing hangs on boot until I installed this driver via the debian package.
First off I tried the launchpad ppa, and got a signing issue, so I just went for the debian package which installed just fine, and solved the system hanging. But now when I try and connect my ethernet port from my built in mobo port, to the port on the device, I don't have a connection. The only lead I have on the problem is this dmesg output:

[ 0.761395] alx 0000:03:00.0 eth0: Qualcomm Atheros AR816x/AR817x Ethernet [d8:cb:8a:1d:08:7c]
[ 0.764086] alx 0000:03:00.0 enp3s0: renamed from eth0
[ 1.972036] r8152 8-1:1.0 eth0: v2.17.1 (2023/06/13)
[ 1.972038] r8152 8-1:1.0 eth0: This product is covered by one or more of the following patents:
[ 2.078054] usbcore: registered new interface driver cdc_ether
[ 2.810698] r8152 8-1:1.0 eth0 (unregistered): get_registers -110
[ 3.314647] r8152 8-1:1.0 eth0 (unregistered): set_registers -110
[ 3.818663] r8152 8-1:1.0 eth0 (unregistered): get_registers -110
[ 4.323708] r8152 8-1:1.0 eth0 (unregistered): set_registers -110
[ 4.826672] r8152 8-1:1.0 eth0 (unregistered): get_registers -110
[ 5.330669] r8152 8-1:1.0 eth0 (unregistered): set_registers -110

Sorry just using AI to troubleshoot like a noob, but it seems like the problem is either because of conflicts with the alx driver, or it's because it's unregistered, but it seems to be trying to access my device. Hopefully someone can help. Thanks!

Info for update

Hi So thank for the driver, it look quite simple and not to used build something or so.
As the used, if i install on debian 11 , then do update and so.. when we gonna update to debian 12. The driver will still be the same without any other package to re-install ?

Thanks

DKMS is building and installing for the wrong kernel after kernel upgrade

Previous kernel version: 6.5.11-8-pve
New kerenl version:6.5.13-8-pve

When 6.5.13-8-pve was installed, dkms built and installed the driver for both kernels. However, while it correctly built it for the then currently running kernel (the old one):

6.5.11-8-pve make log
DKMS make.log for realtek-r8152-2.17.1 for kernel 6.5.11-8-pve (x86_64)
Fri Mar 15 10:04:01 PM EDT 2024
make -C src/ modules
make[1]: Entering directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'
make -C /lib/modules/6.5.11-8-pve/build M=/var/lib/dkms/realtek-r8152/2.17.1/build/src modules
make[2]: Entering directory '/usr/src/linux-headers-6.5.11-8-pve'
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o
  MODPOST /var/lib/dkms/realtek-r8152/2.17.1/build/src/Module.symvers
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.mod.o
  LD [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
  BTF [M] /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
Skipping BTF generation for /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko due to unavailability of vmlinux
make[2]: Leaving directory '/usr/src/linux-headers-6.5.11-8-pve'
make[1]: Leaving directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'

When it attempted to build and install it for kernel 6.5.13-1-pve, it instead installed it for the old kernel.

6.5.13-1-pve make log
DKMS make.log for realtek-r8152-2.17.1 for kernel 6.5.13-1-pve (x86_64)
Fri Mar 15 10:29:33 PM EDT 2024
make -C src/ modules
make[1]: Entering directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'
make -C /lib/modules/6.5.11-8-pve/build M=/var/lib/dkms/realtek-r8152/2.17.1/build/src modules
make[2]: Entering directory '/usr/src/linux-headers-6.5.11-8-pve'
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o
  MODPOST /var/lib/dkms/realtek-r8152/2.17.1/build/src/Module.symvers
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.mod.o
  LD [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
  BTF [M] /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
Skipping BTF generation for /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko due to unavailability of vmlinux
make[2]: Leaving directory '/usr/src/linux-headers-6.5.11-8-pve'
make[1]: Leaving directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'

After booting to 6.5.13-1-pve, if I try to ping an IP that is on that realtek interface, I can't. If I then build and install the modules with dkms build -m realtek-r8152/2.17.1 --force && dkms install -m realtek-r8152/2.17.1 --force, then reboot, it works and the log looks like it should, building for the correct kernel:

6.5.13-1-pve make log
DKMS make.log for realtek-r8152-2.17.1 for kernel 6.5.13-1-pve (x86_64)
Fri Mar 15 11:13:06 PM EDT 2024
make -C src/ modules
make[1]: Entering directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'
make -C /lib/modules/6.5.13-1-pve/build M=/var/lib/dkms/realtek-r8152/2.17.1/build/src modules
make[2]: Entering directory '/usr/src/linux-headers-6.5.13-1-pve'
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o
  MODPOST /var/lib/dkms/realtek-r8152/2.17.1/build/src/Module.symvers
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.mod.o
  LD [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
  BTF [M] /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
Skipping BTF generation for /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko due to unavailability of vmlinux
make[2]: Leaving directory '/usr/src/linux-headers-6.5.13-1-pve'
make[1]: Leaving directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'

And now, if I try to build and install for the old kernel that's not running with the commands dkms build -m realtek-r8152/2.17.1 -k 6.5.11-8-pve --force && dkms install -m realtek-r8152/2.17.1 -k 6.5.11-8-pve --force, the log now shows that it tried to build for 6.5.11-8-pve but actually built for the running kernel 6.5.13-1-pve

6.5.11-8-pve make log
DKMS make.log for realtek-r8152-2.17.1 for kernel 6.5.11-8-pve (x86_64)
Fri Mar 15 11:20:19 PM EDT 2024
make -C src/ modules
make[1]: Entering directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'
make -C /lib/modules/6.5.13-1-pve/build M=/var/lib/dkms/realtek-r8152/2.17.1/build/src modules
make[2]: Entering directory '/usr/src/linux-headers-6.5.13-1-pve'
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o
  MODPOST /var/lib/dkms/realtek-r8152/2.17.1/build/src/Module.symvers
  CC [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.mod.o
  LD [M]  /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
  BTF [M] /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko
Skipping BTF generation for /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.ko due to unavailability of vmlinux
make[2]: Leaving directory '/usr/src/linux-headers-6.5.13-1-pve'
make[1]: Leaving directory '/var/lib/dkms/realtek-r8152/2.17.1/build/src'

update to version v2.17.1 (2023/06/13)

Hi tanks for the very good work !

Is it possible to have a news build with version v2.17.1 (2023/06/13).

Or if not, what are the step to do it with you actuel git ?

Best regards,

Sylvain

Background updates breaks module init

I use this driver on Ubuntu 20.04. On my once a month manual reboot sometimes driver wont load.

Manually modprobe says:
modprobe: ERROR: could not insert 'r8152': Invalid argument

When I reinstall package via dkms -i, then it works just fine. Is this behaviour normal for dkms package or is it bug?

I think that some background update from ubuntu raises linux kernel version and installed module wont reconfigure on its own.

uname -a result:
Linux hostname 5.4.0-1093-raspi #104-Ubuntu SMP PREEMPT Thu Aug 24 08:54:40 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

Upgrade (version?) etc.

I will start with work "unfortunately". I had a case that dkms and package was installed (I belive in newest version). Then I have performed some of upgrade for apt packages (apt upgrade). And unfortunately I haven't catched error which was triggered by this process (error was definitely related to dkms).

I was looking at files and noticed strange (or maybe this is normal?) thing. This is for your evaluation (remark - this file is in 2.16.3-2 package):

obraz

TP-Link UE200 USB Ethernet Adapter Support

It seems RTL8152B - TP-Link UE200 USB Ethernet Adapter support is missing.

2.17.1 Driver Support List;

The RTL8152 driver supports the following USB Ethernet chipsets.

RTL8156 / RTL8156B(S)(G): 2.5 GbE (USB 3.0)
RTL8153 / RTL8153B: 10/100/1000 MbE (USB 3.0)
RTL8154 / RTL8154B: 10/100/1000 MbE (USB 2.0)
RTL8152B: 10/100M (USB2.0)

TP-Link UE200 USB Ethernet Adapter - RTL8152B
lsusb "Bus 001 Device 011: ID 2357:0602 TP-Link USB 10/100 LAN"

TP-Link UE300 USB Ethernet Adapter - RTL8153
lsusb "Bus 001 Device 011: ID 2357:0601 TP-Link USB 10/100/1000 LAN"

Driver only has TP-Link UE300 support -->

ATTR{idVendor}=="2357", ATTR{idProduct}=="0601", ATTR{bConfigurationValue}!="$env{REALTEK_MODE1}", ATTR{bConfigurationValue}="$env{REALTEK_MODE1}"

REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601),

Add support on TP-Link UE200 USB Ethernet Adapter

Update files accordingly.

realtek-r8152-dkms/udev/rules.d/50-usb-realtek-net.rules

# TP-LINK
ATTR{idVendor}=="2357", ATTR{idProduct}=="0601", ATTR{bConfigurationValue}!="$env{REALTEK_MODE1}", ATTR{bConfigurationValue}="$env{REALTEK_MODE1}"
ATTR{idVendor}=="2357", ATTR{idProduct}=="0602", ATTR{bConfigurationValue}!="$env{REALTEK_MODE1}", ATTR{bConfigurationValue}="$env{REALTEK_MODE1}"

realtek-r8152-dkms/src/r8152.c

/* TP-LINK */
REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601),
REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0602),

Tested on Raspi - Linux raspberrypi 6.1.69-v7+ armhf

You need proper kernel-headers to build/install dkms module. If you relly on raspi current kernel just install header package and dkms.
apt-get install dkms raspberrypi-kernel-headers

If you used rpi-update before ( like me ) and running on bleeding edge kernel, you need to get kernel headers for your current kernel version. You cannot find bleeding edge kernel headers on raspi repo. Don't try to symbolic link old kernel headers for newer kernel just use this handy tool rpi-source.

rpi-source --nomake
cd /root/linux
make modules_prepare
apt-get install dkms

Build and install driver via dkms-install.sh on this repo.

Blacklist the default kernel module cdc_ether. Check /etc/modprobe.d/ for any pre-blacklisted realtek module by raspi, they have some.
echo "blacklist cdc_ether" >> /etc/modprobe.d/blacklist-cdc_ether.conf

Enable loading r8152 module on boot.
echo "r8152" >> /etc/modules-load.d/modules.conf

You need initramfs on raspi.

cat /etc/default/raspberrypi-kernel First uncomment INITRD=Yes

# Defaults for raspberrypi-kernel

# Uncomment the following line to enable generation of
# /boot/initrd.img-KVER files (requires initramfs-tools)

#INITRD=Yes

# Uncomment the following line to enable generation of
# /boot/initrd(7).img files (requires rpi-initramfs-tools)

#RPI_INITRD=Yes

Install package.
apt-get install initramfs-tools

Then create an initramfs and check the full name on /boot
update-initramfs -c -k $(uname -r)

Edit /boot/confix.txt accordingly to load initramfs on boot.
initramfs initrd.img-6.1.69-v7+ followkernel (without equal sign)

reboot


Check initramfs loaded.

dmesg

Trying to unpack rootfs image as initramfs...

Check kernel module r8152 loaded.

dmesg | grep r8152

r8152: loading out-of-tree module taints kernel.
usbcore: registered new device driver r8152-cfgselector
r8152-cfgselector 1-1.3: reset high-speed USB device number 4 using dwc_otg
r8152 1-1.3:1.0 eth0: v2.17.1 (2023/06/13)
r8152 1-1.3:1.0 eth0: This product is covered by one or more of the following patents:
usbcore: registered new interface driver r8152
r8152-cfgselector 1-1.3: reset high-speed USB device number 4 using dwc_otg
r8152 1-1.3:1.0 eth0: v2.17.1 (2023/06/13)
r8152 1-1.3:1.0 eth0: This product is covered by one or more of the following patents:

modinfo r8152

filename:       /lib/modules/6.1.69-v7+/updates/r8152.ko.xz
version:        v2.17.1 (2023/06/13)
license:        GPL
description:    Realtek RTL8152/RTL8153 Based USB Ethernet Adapters

ethtool -i eth0

driver: r8152
version: v2.17.1 (2023/06/13)
firmware-version:
expansion-rom-version:
bus-info: usb-3f980000.usb-1.3
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

Optimise TP-Link UE200 USB Ethernet Adapter for rpi

You may face some disconnect and reconnect issues cause autoneg and power management.

## [ 3822.102586] r8152 1-1.3:1.0 eth0: carrier off
## [ 3824.045115] r8152 1-1.3:1.0 eth0: carrier on

Disable autoneg and power saving via systemd service + set 100 full duplex

apt-get install ethtool

r8152-rpi.sh --> Modify your interface name

#!/bin/bash
# Optimise Raspberry Pi for TP-LINK UE200 USB 2.0 100Mbps Ethernet Adapter
# 2023-12-24 for r8152b driver version: v2.17.1

# Modify your interface name
int="eth0"

# Disable auto negotation that cause disconnects
## [ 3822.102586] r8152 1-1.3:1.0 eth0: carrier off
## [ 3824.045115] r8152 1-1.3:1.0 eth0: carrier on
ethtool -s "${int}" speed 100 duplex full autoneg off

# Disable power management
echo "on" > /sys/class/net/"${int}"/power/control

r8152-rpi.service

[Unit]
Description=Optimise Raspberry Pi for TP-LINK UE200 USB 2.0 100Mbps Ethernet Adapter
Requires=network.target
After=network.target

[Service]
Type=oneshot
ExecStart=/path/r8152-rpi.sh

[Install]
WantedBy=multi-user.target

P.S: Both sides of a link must have auto-negotiation off, and full duplex. Don't forget the re-configure other sides of links which interacts with rpi.

Happy christmas.

.deb tries to install older kernel

I tried to install this on Proxmox with the latest kernel available for PVE, 5.15.83-1-pve. When I tried to install it using the first method, dpkg, apt begins to try to install kernel 5.10.0-20-amd64. Definitely don't want to use a kernel that isn't recommended by PVE, but need newer drivers for my Realtek USB adapter.

Compatibility with armhf

I have a few boards with armhf architecture. I have tried to compile the driver and it seems that it is working. However, I didn't tested driver itself. Is it possible to somehow remove restriction for architecture? Of course - release shall be given if also driver is verified.

screenshot 241

realtek-r8152 dkms broken after kernel upgrade

Using the debian package realtek-r8152-dkms_2.17.1-3_amd64.deb with Proxmox 8.1 om a Dell Optiplex 3050 Micro.

After a kernel update, the r8152 USB driver failed to load with the message:

r8152: disagrees about version of symbol module_layout

Output of dkms-status:

realtek-r8152/2.17.1, 6.5.11-8-pve, amd64: installed
realtek-r8152/2.17.1, 6.5.13-1-pve, x86_64: installed

Fixed by:

apt remove realtek-r8152
dpkg -i realtek-r8152-dkms_2.17.1-3_amd64.deb

It is headless so it is a bit of a hassle to fix without network.

Exec Format Error while running 'modprobe r8152' in Linux 6.2.8, Ubuntu 22.10

I've installed the Realtek 8152 driver via PPA. However, my TP-Link UE300C USB-Ethernet dongle remains undetected.

Step I did after setting up repo access to ppa:awesometic/ppa:

# uname -r
6.2.8-060208-generic

# cat /etc/issue
Ubuntu 22.10 \n \l

# apt install realtek-r8152-dkms
...
# depmod -a
# update-initramfs -u
...

# modprobe r8152
modprobe: ERROR: could not insert 'r8152': Exec format error

# dmesg | tail
...
[ 5567.266290] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000b244c428, val ffffffffc1e9a8b0

Any ideas?

Correct add support for kernel 6.8

Hello, my system76 galp5 got too latest kernel 6.8 and this dkms module must be updated... I try build manually and find correct place.

r8152.c on line 19687 change function strlcp to strscpy. I try change code only to

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
strscpy(uinfo->devpath, udev->devpath, sizeof(udev->devpath));
#else
strlcpy(uinfo->devpath, udev->devpath, sizeof(udev->devpath));
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */

After it, I make deb package on ubuntu 22.04.

This update works and i can install module on kernel 6.8 and 6.5 without problem. But if i try install module from running older ekrnele 5.17 or 5.15, i got

ERROR (dkms apport): kernel package linux-headers-6.8.0-76060800daily20240311-generic is not supported
Error! Bad return status for module build on kernel: 6.8.0-76060800daily20240311-generic (x86_64)

Install from running kernel

I try make fork, but I'm not sure if my changes is correct. URL to fork

Please check it and adopt my changes if is correct or make some updates and push it to PPA.

Thanks.

Install log before my code changes was:

matlala@matlala-galp5 ~ $ sudo apt-get install realtek-r8152-dkms
Loading package lists… Done
Building the dependency tree… Done
Loading status information... Done
The following NEW packages will be installed:
realtek-r8152-dkms
0 updated, 1 newly installed, 0 to remove and 10 not updated.
0 B/84.0 KB archives must be downloaded.
After this operation, an additional 706 KB will be used on the disk.
Selecting the currently unselected package realtek-r8152-dkms.
(Loading database ... now 586220 files and directories are installed.)
Preparing to replace …/realtek-r8152-dkms_2.17.1-3202403030905ubuntu22.04.1_amd64.deb …
Unpacking realtek-r8152-dkms (2.17.1-3202403030905ubuntu22.04.1) …
Setting up realtek-r8152-dkms package (2.17.1-3202403030905ubuntu22.04.1) …
Loading new realtek-r8152-2.17.1 DKMS files...
Building for 6.8.0-76060800daily20240311-generic
Building for architecture x86_64
Building initial module for 6.8.0-76060800daily20240311-generic
ERROR (dkms apport): kernel package linux-headers-6.8.0-76060800daily20240311-generic is not supported
Error! Bad return status for module build on kernel: 6.8.0-76060800daily20240311-generic (x86_64)
Consult /var/lib/dkms/realtek-r8152/2.17.1/build/make.log for more information.
dpkg: error processing package realtek-r8152-dkms (--configure):
thread script from installed package realtek-r8152-dkms: post-installation returned error return status 10
Errors occurred during processing:
realtek-r8152-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
matlala@matlala-galp5 ~ $ cat /var/lib/dkms/realtek-r8152/2.17.1/build/make.log
DKMS make.log for realtek-r8152-2.17.1 for kernel 6.8.0-76060800daily20240311-generic (x86_64)
Thu Apr 04 2024 17:06:33 CEST
make -C src/ modules
make[1]: Entering directory "/var/lib/dkms/realtek-r8152/2.17.1/build/src"
make -C /lib/modules/6.8.0-76060800daily20240311-generic/build M=/var/lib/dkms/realtek-r8152/2.17.1/build/src modules
make[2]: Entering directory "/usr/src/linux-headers-6.8.0-76060800daily20240311-generic"
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu122.04) 12.3.0
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1
22.04) 12.3.0
CC [M] /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o
/var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.c: In function 'rtltool_ioctl':
/var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.c:19687:17: error: implicit declaration of function 'strlcpy'; did you mean 'strscpy'? [-Werror=implicit-function-declaration]
19687 | strlcpy(uinfo->devpath, udev->devpath, sizeof(udev->devpath));
| ^~~~~~~
| strscpy
/var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.c: At top level:
/var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.c:20209:4: warning: no previous prototype for 'rtl8152_get_version' [-Wmissing-prototypes]
20209 | u8 rtl8152_get_version(struct usb_interface *intf)
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:243: /var/lib/dkms/realtek-r8152/2.17.1/build/src/r8152.o] Error 1
make[3]: *** [/usr/src/linux-headers-6.8.0-76060800daily20240311-generic/Makefile:1927: /var/lib/dkms/realtek-r8152/2.17.1/build/src] Error 2
make[2]: *** [Makefile:240: __sub-make] Error 2
make[2]: Leaving directory "/usr/src/linux-headers-6.8.0-76060800daily20240311-generic"
make[1]: *** [Makefile:24: modules] Error 2
make[1]: Leaving directory "/var/lib/dkms/realtek-r8152/2.17.1/build/src"
make: *** [Makefile:18: modules] Error 2

unknown compression for member 'control.tar.zst', giving up

When installing package to Debian (11) based Proxmox - system is giving-up with following error:

[root@pve /tmp]# dpkg -i realtek-r8152-dkms_2.16.3-1_amd64.deb
dpkg-deb: error: archive 'realtek-r8152-dkms_2.16.3-1_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive realtek-r8152-dkms_2.16.3-1_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
realtek-r8152-dkms_2.16.3-1_amd64.deb

Remark: package for r8125 is OK. The issue is for zstd compression method, which is used for r8152, but it seems to be not fully supported for Debian 11.

[root@pve /tmp]# uname -a
Linux pve 5.15.53-1-pve #1 SMP PVE 5.15.53-1 (Fri, 26 Aug 2022 16:53:52 +0200) x86_64 GNU/Linux
[root@pve /tmp]# dpkg --version
Debian 'dpkg' package management program version 1.20.12 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.

It is possible add support to kernel 6.0 and up?

I need use newest kernel than LTS or HWE in Ubuntu (because i Use very new HW and have laptop from system76, this manufacturer recomand and use kernel 6.0 in this driver repository). Realtek decided support max kernel 5.17.

Linus Tovards have some change in mainline kernel repo, but it's too mutch hardware stuff for my coding knowlenge.
mainline git repo

matlala@matlala-galp5 ~/git/realtek-r8152-dkms $ uname -a
Linux matlala-galp5 6.0.6-76060006-generic #202210290932~1669062050~22.04~d94609a~dev-Ubuntu SMP PREEMPT_DY x86_64 x86_64 x86_64 GNU/Linux

matlala@matlala-galp5 ~/git/realtek-r8152-dkms $sudo ./dkms-install.sh
About to run dkms install steps...
Error! DKMS tree already contains: r8152-2.16.3
You cannot add the same module/version combo more than once.

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
'make' -j8 modules....(bad exit status: 2)
ERROR (dkms apport): binary package for r8152: 2.16.3 not found
Error! Bad return status for module build on kernel: 6.0.6-76060006-generic (x86_64)
Consult /var/lib/dkms/r8152/2.16.3/build/make.log for more information.

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
'make' -j8 modules....(bad exit status: 2)
ERROR (dkms apport): binary package for r8152: 2.16.3 not found
Error! Bad return status for module build on kernel: 6.0.6-76060006-generic (x86_64)
Consult /var/lib/dkms/r8152/2.16.3/build/make.log for more information.
Finished running dkms install steps.
Copy the dedicated udev rules file...
Restarting udev...
Finished.

matlala@matlala-galp5 ~/git/realtek-r8152-dkms $ cat /var/lib/dkms/r8152/2.16.3/build/make.log
DKMS make.log for r8152-2.16.3 for kernel 6.0.6-76060006-generic (x86_64)
Pá 30. prosince 2022, 23:09:42 CET
make -C src/ modules
make[1]: Vstupuje se do adresáře „/var/lib/dkms/r8152/2.16.3/build/src“
make -C /lib/modules/6.0.6-76060006-generic/build M=/var/lib/dkms/r8152/2.16.3/build/src modules
make[2]: Vstupuje se do adresáře „/usr/src/linux-headers-6.0.6-76060006-generic“
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  You are using:           gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  CC [M]  /var/lib/dkms/r8152/2.16.3/build/src/r8152.o
/var/lib/dkms/r8152/2.16.3/build/src/r8152.c: In function ‘sg_en_store’:
/var/lib/dkms/r8152/2.16.3/build/src/r8152.c:20462:9: error: implicit declaration of function ‘netif_set_gso_max_size’; did you mean ‘netif_set_tso_max_size’? [-Werror=implicit-function-declaration]
20462 |         netif_set_gso_max_size(netdev, tso_size);
      |         ^~~~~~~~~~~~~~~~~~~~~~
      |         netif_set_tso_max_size
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:249: /var/lib/dkms/r8152/2.16.3/build/src/r8152.o] Chyba 1
make[2]: *** [Makefile:1858: /var/lib/dkms/r8152/2.16.3/build/src] Chyba 2
make[2]: Opouští se adresář „/usr/src/linux-headers-6.0.6-76060006-generic“
make[1]: *** [Makefile:24: modules] Chyba 2
make[1]: Opouští se adresář „/var/lib/dkms/r8152/2.16.3/build/src“
make: *** [Makefile:18: modules] Chyba 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.