Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command to delete the driver folder in /var/lib/dkms/ when the driver is removed #145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gmrparcerao
Copy link

When the driver is removed using the remove-driver.sh script (mostly after updating the Linux kernel), the driver folder remains in the /var/lib/dkms/ folder, which causes issues to reinstall the driver after kernel updates and even blocks another DKMS software to update. I simply added two lines to remove the driver folder in the designed location, solving this problem.

@morrownr
Copy link
Owner

Hi @gmrparcerao

Thanks for the patch. I have not merged it yet because I am thinking about it.

I think you have an issue that needs to be addressed but it is not clear to me if this is the optimal solution. If I am understanding you correctly, this is an issue that only comes up with a new kernel is installed causing the driver to be compiled for the new kernel automatically? Right? If so, it would be best if this is properly handled automatically instead of having to run remove-driver.sh .

I think need to determine what the real problem is and why it does not happen when installing or reinstalling with install-driver.sh. The automatic compilation when a new kernel is installed uses dkms.conf and the only external code that it uses is dkms-make.sh .

the driver folder remains in the /var/lib/dkms/ folder, which causes issues to reinstall the driver after kernel updates and even blocks another DKMS software to update.

I tested using remove-driver.sh and the /var/lib/dkms folder is deleted. So, that means I am not duplicating the problem. If you can take a deeper look at this and help, I would appreciate it.

@morrownr

@vstavrinov
Copy link

Some time ago, I have also encountered this problem. I don't remember the details, but it took an efforts and dancing to resolve it manually. And Yes, like You I don't know (remember) how to reproduce it. I am using Debian where kernel is updated automatically. If I am not wrong, the incident caused by two events that happened simultaneously: the kernel was updated with new version and I have pulled updates and installed new version of the driver. I am not sure if I am describing the scenario exactly, but it is something like that.

@morrownr
Copy link
Owner

@vstavrinov

And Yes, like You I don't know (remember) how to reproduce it.

I've been thinking about this and I can come up with an idea what the issue might be but it is a pain to reproduce.

If I am not wrong, the incident caused by two events that happened simultaneously: the kernel was updated with new version and I have pulled updates and installed new version of the driver. I am not sure if I am describing the scenario exactly, but it is something like that.

That is what I am thinking. Something goes wrong when a new kernel comes in with a distro version upgrade. What I think I am going to do is use @gmrparcerao patch but slightly modified so as to use it for testing but ultimately we need to figure out a way to do this that does not include running remove-driver.sh.

Any ideas are welcome.

@vstavrinov
Copy link

Why do You not submit Your driver to stock kernel?

@morrownr
Copy link
Owner

@vstavrinov

Why do You not submit Your driver to stock kernel?

This is not my driver. it is Realtek's driver. I maintain the driver with help and I make it easier to install.

There is an effort to improve the in-kernel driver for this chip. See:

#115

The in-kernel driver is improving. Five patches recently went into kernel 6.9. Those patches dramatically improve the experience with client mode. AP mode needs work. I hope we can get the in-kernel driver in good enough shape for me to shut this repo down. I need to be spending more time with other parts of the site.

@vstavrinov
Copy link

@morrownr wrote:

I've been thinking about this and I can come up with an idea what the issue might be but it is a pain to reproduce.

it comes back reproducing itself:

Setting up linux-image-6.9.7-amd64 (6.9.7-1) ...
/etc/kernel/postinst.d/dkms:
dkms: running auto installation service for kernel 6.9.7-amd64.
Sign command: /lib/modules/6.9.7-amd64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
Building module(s)........................................................(bad exit status: 2)
Failed command:
kernelver=6.9.7-amd64 ./dkms-make.sh
Error! Bad return status for module build on kernel: 6.9.7-amd64 (x86_64)
Consult /var/lib/dkms/rtl8821cu/5.12.0.4/build/make.log for more information.

see log:
make.log

@morrownr
Copy link
Owner

morrownr commented Jul 9, 2024

@vstavrinov

The log makes it look like an API change has failed to make it into this driver. Let me test. I see your kernel is 6.9.

@morrownr
Copy link
Owner

@vstavrinov

Your log makes it look like you are using a version of the driver that is not updated. Did you run the following before updating the kernel?

$ git pull

@vstavrinov
Copy link

@morrownr

Your log makes it look like you are using a version of the driver that is not updated. Did you run the following before updating the kernel?

$ git pull

Yes I did. Though I think it may not be enough and reinstalling the driver with your script is necessary too. I will try, but before I want to test stock driver rtw88_8821cu with new kernel.

@vstavrinov
Copy link

Here is the result. I am using this driver with hostpad serving 2 clients. It works for a few minutes then lost connection:

Jul 10 15:52:17 ficep kernel: rtw_8821cu 1-4:1.2: error beacon valid
Jul 10 15:52:17 ficep kernel: rtw_8821cu 1-4:1.2: failed to download rsvd page
Jul 10 15:52:17 ficep kernel: rtw_8821cu 1-4:1.2: failed to download firmware
Jul 10 15:52:19 ficep kernel: usbcore: deregistering interface driver rtw_8821cu

Jul 10 15:52:04 ficep kernel: rtw_8821cu 1-4:1.2: timed out to flush queue 3
Jul 10 15:52:13 ficep kernel: rtw_8821cu 1-4:1.2: failed to get tx report from firmware
Jul 10 15:52:19 ficep kernel: ------------[ cut here ]------------
Jul 10 15:52:19 ficep kernel: Have pending ack frames!
Jul 10 15:52:19 ficep kernel: WARNING: CPU: 1 PID: 4136 at net/mac80211/main.c:1684 ieee80211_free_ack_frame+0x3e/0x50
[mac80211]
Jul 10 15:52:19 ficep kernel: Modules linked in: xt_nat veth nf_conntrack_netlink xfrm_user xfrm_algo xt_addrtype ccm r
tw88_8821cu(-) rtw88_8821c rtw88_usb rtw88_core mac80211 libarc4 overlay snd_hda_codec_hdmi snd_sof_pci_intel_apl nft_c
hain_nat snd_sof_intel_hda_common xt_MASQUERADE nf_nat soundwire_intel xt_tcpudp snd_sof_intel_hda_mlink xt_conntrack n
f_conntrack intel_rapl_msr nf_defrag_ipv6 nf_defrag_ipv4 soundwire_cadence nft_compat intel_rapl_common snd_sof_intel_h
da x86_pkg_temp_thermal nf_tables snd_sof_pci intel_powerclamp snd_sof_xtensa_dsp coretemp kvm_intel snd_sof btusb libc
rc32c btrtl btintel snd_sof_utils soundwire_generic_allocation btbcm i915 soundwire_bus btmtk kvm bluetooth snd_soc_avs
 snd_soc_hda_codec snd_soc_skl snd_soc_hdac_hda snd_hda_ext_core ghash_clmulni_intel sha256_ssse3 sha1_ssse3 snd_soc_ss
t_ipc snd_soc_sst_dsp snd_soc_acpi_intel_match drm_buddy snd_soc_acpi snd_soc_core sha3_generic jitterentropy_rng mei_h
dcp sha512_ssse3 aesni_intel binfmt_misc sha512_generic mei_pxp ctr evdev drbg drm_display_helper
Jul 10 15:52:19 ficep kernel:  snd_compress crypto_simd ansi_cprng ecdh_generic ecc cryptd wdat_wdt snd_pcm_dmaengine r
apl watchdog intel_cstate snd_hda_intel cec snd_intel_dspcfg rc_core snd_intel_sdw_acpi snd_hda_codec pcspkr intel_pmc_
core snd_hda_core ttm drm_kms_helper mei_me snd_hwdep button intel_vsec snd_pcm snd_timer pmt_telemetry pmt_class snd soundcore mei i2c_algo_bit cfg80211 rfkill br_netfilter efi_pstore bridge stp llc configfs nfnetlink efivarfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic dm_mod mmc_block sdhci_pci ahci i2c_hid_acpi libahci i2c_hid libata cqhci drm sdhci r8169 scsi_mod crct10dif_pclmul crct10dif_common realtek mdio_devres crc32_pclmul crc32c_intel libphy xhci_pci xhci_hcd mmc_core i2c_i801 scsi_common usbcore fan i2c_smbus usb_common hid video wmi
Jul 10 15:52:19 ficep kernel: CPU: 1 PID: 4136 Comm: modprobe Not tainted 6.9.7-amd64 #1  Debian 6.9.7-1
Jul 10 15:52:19 ficep kernel: Hardware name:  /, BIOS 5.13 09/03/2021
Jul 10 15:52:19 ficep kernel: RIP: 0010:ieee80211_free_ack_frame+0x3e/0x50 [mac80211]
Jul 10 15:52:19 ficep kernel: Code: 74 15 48 89 df be 02 00 00 00 e8 dd 1e b0 c9 31 c0 5b c3 cc cc cc cc 48 c7 c7 4c 72 84 c1 c6 05 27 27 0b 00 01 e8 b2 46 1f c9 <0f> 0b eb d4 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 90 90 90 90
Jul 10 15:52:19 ficep kernel: RSP: 0018:ffffb55ac3477b50 EFLAGS: 00010286
Jul 10 15:52:19 ficep kernel: RAX: 0000000000000000 RBX: ffff9cc708b67200 RCX: 0000000000000027
Jul 10 15:52:19 ficep kernel: RDX: ffff9cc77bd21708 RSI: 0000000000000001 RDI: ffff9cc77bd21700
Jul 10 15:52:19 ficep kernel: RBP: ffffffffc1aca450 R08: 0000000000000000 R09: 0000000000000003
Jul 10 15:52:19 ficep kernel: R10: ffffb55ac34779e0 R11: ffffffff8c8ca3a8 R12: 0000000080000000
Jul 10 15:52:19 ficep kernel: R13: 0000000000000000 R14: ffff9cc702169f40 R15: ffff9cc71031fb90
Jul 10 15:52:19 ficep kernel: FS:  00007ffbad409600(0000) GS:ffff9cc77bd00000(0000) knlGS:0000000000000000
Jul 10 15:52:19 ficep kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jul 10 15:52:19 ficep kernel: CR2: 00005615ca6a0e48 CR3: 0000000108a4a000 CR4: 0000000000350ef0
Jul 10 15:52:19 ficep kernel: Call Trace:
Jul 10 15:52:19 ficep kernel:  <TASK>
Jul 10 15:52:19 ficep kernel:  ? __warn+0x80/0x120
Jul 10 15:52:19 ficep kernel:  ? ieee80211_free_ack_frame+0x3e/0x50 [mac80211]
Jul 10 15:52:19 ficep kernel:  ? report_bug+0x164/0x190
Jul 10 15:52:19 ficep kernel:  ? handle_bug+0x3c/0x80
Jul 10 15:52:19 ficep kernel:  ? exc_invalid_op+0x17/0x70
Jul 10 15:52:19 ficep kernel:  ? asm_exc_invalid_op+0x1a/0x20
x_ieee80211_free_ack_frame+0x10/0x10 [mac80211]
Jul 10 15:52:19 ficep kernel:  ? ieee80211_free_ack_frame+0x3e/0x50 [mac80211]
Jul 10 15:52:19 ficep kernel:  idr_for_each+0x71/0xf0
Jul 10 15:52:19 ficep kernel:  ieee80211_free_hw+0x2f/0xa0 [mac80211]
Jul 10 15:52:19 ficep kernel:  usb_unbind_interface+0x90/0x280 [usbcore]
Jul 10 15:52:19 ficep kernel:  device_release_driver_internal+0x19f/0x200
Jul 10 15:52:19 ficep kernel:  driver_detach+0x48/0x90
Jul 10 15:52:19 ficep kernel:  bus_remove_driver+0x6d/0xf0
...skipping...
Jul 10 15:52:19 ficep kernel:  usb_deregister+0x7d/0xf0 [usbcore]
Jul 10 15:52:19 ficep kernel:  __do_sys_delete_module+0x1d1/0x340
Jul 10 15:52:19 ficep kernel:  do_syscall_64+0x82/0x190
Jul 10 15:52:19 ficep kernel:  ? __memcg_slab_free_hook+0xef/0x140
Jul 10 15:52:19 ficep kernel:  ? __x64_sys_close+0x3c/0x80
Jul 10 15:52:19 ficep kernel:  ? kmem_cache_free+0x3c1/0x3f0
Jul 10 15:52:19 ficep kernel:  ? syscall_exit_to_user_mode+0x7e/0x210
Jul 10 15:52:19 ficeJul 10 15:52:19 ficep kernel:  ? __pfx_ieee80211_free_ack_frame+0x10/0x10 [mac80211]
Jul 10 15:52:19 ficep kernel:  ? ieee80211_free_ack_frame+0x3e/0x50 [mac80211]
p kernel:  ? do_syscall_64+0xJul 10 15:52:19 ficep kernel:  idr_for_each+0x71/0xf0
8e/0x190
Jul 10 15:52:19 ficep kernel:  ? syscall_exit_to_user_mode+0x7e/0x210
Jul 10 15:52:19 ficep kernel:  ? do_syscall_64+0x8e/0x190
Jul 10 15:52:19 fiJul 10 15:52:19 ficep kernel:  ieee80211_free_hw+0x2f/0xa0 [mac80211]
cep kernel:  ? __count_memcg_events+0x4d/0xb0
Jul 10 15:52:19 ficep kernel:  ? count_memcg_events.constprop.0+0x1a/0x30
Jul 10 15:52:19 ficep kernel:  ? handle_mm_Jul 10 15:52:19 ficep kernel:  usb_unbind_interface+0x90/0x280 [usbcore]
fault+0xae/0x320
Jul 10 15:52:19 ficep kernel:  ? do_user_addr_fault+0x30f/0x6b0
Jul 10 15:52:19 ficep kernel:  ? clear_bhb_loop+0x25/0x80
Jul 10 15:52:19 ficep Jul 10 15:52:19 ficep kernel:  device_release_driver_internal+0x19f/0x200
kernel:  ? clear_bhb_loop+0x25/0x80
Jul 10 15:52:19 ficep kernel:  ? clear_bhb_loop+0x25/0x80
Jul 10 15:52:19 ficep kernel:  entry_SYSCALL_64_after_hwframe+0xJul 10 15:52:19 ficep kernel:  driver_detach+0x48/0x90
76/0x7e
Jul 10 15:52:19 ficep kernel: RIP: 0033:0x7ffbacd27977
Jul 10 15:52:19 ficep kernel: Code: 73 01 c3 48 8b 0d a9 94 0c 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 b8 b0 00 00 00 0f 05 <48> 3d 01 f0Jul 10 15:52:19 ficep kernel:  bus_remove_driver+0x6d/0xf0
 ff ff 73 01 c3 48 8b 0d 79 94 0c 00 f7 d8 64 89 01 48
Jul 10 15:52:19 ficep kernel: RSP: 002b:00007ffda4910368 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
Jul 10...skipping...
 15:52:19 ficep kernel: RAX: ffffffffffffffda RBX: 000055b25fe127a0 RCX: 00007ffbacd27977
Jul 10 15:52:19 ficep kernel: RDX: 0000000000000000 RSI: 0000000000000800 RJul 10 15:52:19 ficep kernel:  usb_deregister+0x7d/0xf0 [usbcore]
DI: 000055b25fe12808
Jul 10 15:52:19 ficep kernel: RBP: 0000000000000000 R08: 1999999999999999 R09: 0000000000000000
Jul 10 15:52:19 ficep kernel: R10: 00007ffbacJul 10 15:52:19 ficep kernel:  __do_sys_delete_module+0x1d1/0x340
d99ac0 R11: 0000000000000206 R12: 0000000000000000
Jul 10 15:52:19 ficep kernel: R13: 0000000000000000 R14: 00007ffda49103a0 R15: 00007ffda4911858
Jul 10Jul 10 15:52:19 ficep kernel:  do_syscall_64+0x82/0x190
 15:52:19 ficep kernel:  </TASK>
Jul 10 15:52:19 ficep kernel: ---[ end trace 0000000000000000 ]---
Jul 10 15:52:52 ficep kernel: rtw_8821cu 1-4:1.2: timed oJul 10 15:52:19 ficep kernel:  ? __memcg_slab_free_hook+0xef/0x140
ut to flush queue 3
Jul 10 15:52:52 ficep kernel: rtw_8821cu 1-4:1.2: timed out to flush queue 3Jul 10 15:52:19 ficep kernel:  ? __x64_sys_close+0x3c/0x80

@vstavrinov
Copy link

Also reinstalling your driver give no result too. So rollback to old kernel

@morrownr
Copy link
Owner

@vstavrinov

I will do some testing here with kernel 6.9.

Please post results for rtw_8821cu in the following Issue:

#115

For what it is worth, AP mode in rtw88 is bad in all drivers accept for rtw_8821au and it is not even in the kernel yet... hopefully it will be soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants