Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] cannot load external module
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 8:59 pm    Post subject: [solved] cannot load external module Reply with quote

I flashed sabayoninos Linux Recovery System on an usb stick. After writing usb mbr with grub-install and creating boot entry with grub-mkconfig I can boot LRS from said stick. As my wifi is a wireless usb stick, which needs a kernel module provided by rtl8812au_aircrack-ng package from pentoo overlay, I created a local overlay on LRS too, grabbed the ebuild and compiled it successfully in LRS, just as I did on my gentoo box.

Compiling worked fine, but it does not load module within booted LRS. Issuing modprobe 88XXau I get modprobe: FATAL: Module 88XXau not found in directory /lib/modules/4.19.86-gentoo-x86_64. While searching, I found 88XXau.ko module file in /lib/modules/4.19.86-gentoo/misc. On my box I find the module similarly in /lib/modules/5.4.6-gentoo/misc/88XXau.ko and I dont have a 5.4.6-gentoo-x86_64 folder.

What am I doing wrongly? How can I load this module within LRS to get wireless and thus network connectivity working within LRS?


Last edited by Elleni on Mon Dec 30, 2019 11:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
sabayonino
l33t
l33t


Joined: 03 Jan 2012
Posts: 781

PostPosted: Mon Dec 30, 2019 9:15 pm    Post subject: Reply with quote

Hi. Thanks for reporting

Looking for your wifi card/adapters :
https://wiki.gentoo.org/wiki/AC1200_Wireless_Adapters

I'll check kernel-config

see /usr/local/bin/kernel.sh script to recompile the kernel (a very tiny bash script ...) with all modules supports
_________________
BOINC ed il calcolo distribuito

My LiveRecoverySystem Repo
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 9:18 pm    Post subject: Reply with quote

I would be surprised if it works with kernel drivers, but I know it does with rtl8812au_aircrack-ng from pentoo overlay, so if you could tell me why the successfully compiled package does not load? The obvious difference is -x86_64 suffix in /lib/modules/kernelversion path, and I don't know, where this is comming from? I'll check the mentioned script, thanks :)

Last edited by Elleni on Mon Dec 30, 2019 9:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Mon Dec 30, 2019 9:22 pm    Post subject: Reply with quote

Elleni,

As a workaround meanwhile, try
Code:
insmod /full/pathlto/module.ko


modprobe is shiny and well behaved. It tries to to the right thing.
insmod is a blunt instrument. It tries to do what you tell it. Its not shiny and well behaved.
If your module needs other modules loaded, modprobe takes care of this.
With insmod, loading all the bits in the right order is your problem.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 9:27 pm    Post subject: Reply with quote

Hi Neddy, thanks, I'll test the workaround as soon as possible. Do you happen to know, what this suffix is about? On my gentoo box, I dont have it, although it is a 64-bit installation.
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 9:41 pm    Post subject: Reply with quote

Trying with insmod I get
Code:
insmod: ERROR: could not insert module /lib/modules/4.19.86-gentoo/misc/88XXau.ko: Invalid module format
Tried all different versions now, 5.3.4, 5.2.20 and even 9999 ebuild.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Mon Dec 30, 2019 9:43 pm    Post subject: Reply with quote

Elleni,

/lib/modules/<dir> should be named for
Code:
uname -r
Thats how the kernel finds its own modules.
If a local version is defined in the kernel .config then that's appended to the stuff at the top of the Makefile to make uname -r.

Here be dragons. The kernel works with a local version is defined in the kernel .config but not all external kernel modules respect the local version.
This causes the situation that you report.

If that's the cause, the kernel will reject your module as the versions won't match.
I think insmod has a -f (for force) option but its years since I've needed insmod.

dmesg is the best place to look for errors.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.


Last edited by NeddySeagoon on Mon Dec 30, 2019 9:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
sabayonino
l33t
l33t


Joined: 03 Jan 2012
Posts: 781

PostPosted: Mon Dec 30, 2019 9:44 pm    Post subject: Reply with quote

from https://github.com/pentoo/pentoo-overlay/blob/master/net-wireless/rtl8812au_aircrack-ng/rtl8812au_aircrack-ng-5.3.4_p20191030.ebuild


Code:
DEPEND="!!net-wireless/rtl8812au_astsam
   !!net-wireless/rtl8812au
   !!net-wireless/rtl8812au_asus"


https://github.com/pentoo/pentoo-overlay/tree/master/net-wireless

or this driver is not compatible with 4.19.x kernel
_________________
BOINC ed il calcolo distribuito

My LiveRecoverySystem Repo
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 9:47 pm    Post subject: Reply with quote

I understand. Here is the corresponding dmesg after trying to load with -f (only tried within chroot for now):
Code:
[   39.653965] ------------[ cut here ]------------
[   39.653974] WARNING: CPU: 4 PID: 4225 at net/wireless/nl80211.c:3153 nl80211_send_chandef+0x146/0x160
[   39.653975] Modules linked in: xfs fuse uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videodev videobuf2_common 88XXau(O) bnep amdgpu mfd_core gpu_sched ttm
[   39.653988] CPU: 4 PID: 4225 Comm: RTW_CMD_THREAD Tainted: G           O      5.4.6-gentoo #2
[   39.653989] Hardware name: System manufacturer System Product Name/PRIME B350-PLUS, BIOS 4207 12/07/2018
[   39.653993] RIP: 0010:nl80211_send_chandef+0x146/0x160
[   39.653996] Code: 00 00 be a1 00 00 00 48 89 ef 89 44 24 04 e8 f1 70 b0 ff 85 c0 0f 84 7b ff ff ff 41 bc 97 ff ff ff e9 70 ff ff ff 31 c0 eb a7 <0f> 0b 41 bc ea ff ff ff e9 5f ff ff ff e8 f8 55 76 ff 0f 1f 84 00
[   39.653997] RSP: 0018:ffffc90002c0bd80 EFLAGS: 00010246
[   39.653999] RAX: 0000000000000000 RBX: ffffc90002c0be08 RCX: 0000000000001464
[   39.654000] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc90002c0be08
[   39.654002] RBP: ffff888408dc2900 R08: 0000000000000000 R09: ffff8883ddd5801c
[   39.654004] R10: 0000000000000016 R11: ffff88840d355ec0 R12: ffffc90002c0be08
[   39.654005] R13: 0000000000000000 R14: ffff888408dc2900 R15: ffff8883ddd58014
[   39.654007] FS:  0000000000000000(0000) GS:ffff88840ed00000(0000) knlGS:0000000000000000
[   39.654009] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   39.654011] CR2: 00007f0a4b9831c0 CR3: 000000040bc44000 CR4: 00000000003406e0
[   39.654012] Call Trace:
[   39.654019]  nl80211_ch_switch_notify.constprop.0+0xc7/0x160
[   39.654077]  rtw_cfg80211_ch_switch_notify+0x142/0x151 [88XXau]
[   39.654120]  ? rtw_chk_start_clnt_join+0x7f/0x7f [88XXau]
[   39.654159]  rtw_chk_start_clnt_join+0x78/0x7f [88XXau]
[   39.654200]  join_cmd_hdl+0x273/0x37f [88XXau]
[   39.654229]  rtw_cmd_thread+0x292/0x3ed [88XXau]
[   39.654234]  kthread+0xfb/0x130
[   39.654263]  ? rtw_stop_cmd_thread+0x34/0x34 [88XXau]
[   39.654266]  ? kthread_park+0x80/0x80
[   39.654270]  ret_from_fork+0x22/0x40
[   39.654273] ---[ end trace f0db65a6700fc7bc ]---
[   53.521872] xfs filesystem being mounted at /mnt/usb supports timestamps until 2038 (0x7fffffff)
[  426.671347] 88XXau: version magic '4.19.86-gentoo SMP preempt mod_unload ' should be '5.4.6-gentoo SMP preempt mod_unload '


I'll boot to the stick and try from there and post corresponding dmesg
Back to top
View user's profile Send private message
sabayonino
l33t
l33t


Joined: 03 Jan 2012
Posts: 781

PostPosted: Mon Dec 30, 2019 9:48 pm    Post subject: Reply with quote

as I wrote 4.19.X is not supported by the driver

[ 426.671347] 88XXau: version magic '4.19.86-gentoo SMP preempt mod_unload ' should be '5.4.6-gentoo SMP preempt mod_unload '
_________________
BOINC ed il calcolo distribuito

My LiveRecoverySystem Repo
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Mon Dec 30, 2019 9:56 pm    Post subject: Reply with quote

Elleni,

insmod gave it a good shot but you can't load a module built for one kernel version into a completely different version.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sabayonino
l33t
l33t


Joined: 03 Jan 2012
Posts: 781

PostPosted: Mon Dec 30, 2019 10:05 pm    Post subject: Reply with quote

You can install and build 5.x.x kernel version you need. You can manage LRS as Gentoo Linux Installation

this is the genkernel options passed
Code:
genkernel --firmware --busybox --mdadm --do-keymap-auto --luks --lvm --nfs --bootdir=/boot --no-symlink --all-ramdisk-modules --install --kernel-config=/etc/kernels/config --menuconfig all

(or run /usr/local/bin/kernel.sh)

for better support, most common modules are included. Feel free to remove the modules you don't need :roll:

Keep in mind that high I/O write access could stress your USB Pendrive
_________________
BOINC ed il calcolo distribuito

My LiveRecoverySystem Repo
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 10:13 pm    Post subject: Reply with quote

Back. Here are the corresponding dmesg entries.

for 5.2.20 ebuild
for 5.3.4 ebuild

I'll happily try a newer kernel, but I know, it should start as it did on my hostsystem too, even before I had a 5.x kernel installed. The error before was because I had tried modprobe and insmod from within chroot. :wink:

If I understand correctly -x86_64 is defined somewhere in .config? I'll check.
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 10:42 pm    Post subject: Reply with quote

Indeed localversion is where this suffix is set, as you said Neddy.

I had tried compiling the kernel by just extracting the config from /proc/config.cz and issuing make and make modules_install without genkernel, as I was not used to it. I will now try again, but this time with the instructions sabayonino gave me and remove this lovalversion variable within menuconfig and report back, if it then works. Thanks for your assistance much appreciated, guys!
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Mon Dec 30, 2019 11:47 pm    Post subject: Reply with quote

Its a bit strange, but it works now. Writing this from LRS :D. As said, I compiled kernel with instructions of sabayonino and within menuconfig I deleted said suffix in CONFIG_LOCALVERSION. Now after new boot 88XXau module is successfully loaded. But if I look into /usr/src/linux/.config or make menuconfig, I see
Code:
CONFIG_LOCALVERSION="-x86_64"
# CONFIG_LOCALVERSION_AUTO is not set


also
Code:
uname -r
4.19.86-gentoo-x86_64


So my change in make menuconfig was obviously ignored?

Extracting config with zcat /proc/config.gz showing CONFIG_LOCALVERSION="-x86_64"

But compiling the kernel with kernel.sh obviously helped, as checking the location of the module 88XXau.ko this time it is also found in the right place
Code:
ls /lib/modules/4.19.86-gentoo-x86_64/misc/
88XXau.ko


However - I will maybe re-flash the image to start with a clean state just in case I messed something while trying to compile the kernel, as I do it on my gentoo installed box, by issuing emerge gentoo-sources && make clean && make && make modules_install & make install && grub-mkconfig....

-> solved. Thanks again you 2 :D
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Tue Dec 31, 2019 8:58 am    Post subject: Reply with quote

Elleni,

As well as matching 'uname -r' everywhere you need the kernel and all its modules compiled with the same version of gcc. The kernel checks.
There are a few other constrains on out of kernel modules too but most of these are fixed by having the kernel .config that you want to load the kernel into to hand.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Tue Dec 31, 2019 9:17 am    Post subject: Reply with quote

Thanks NeddySeagoon for your detailed information. You would have made a great teacher. It's always a good oportunity to learn thus good to have you assisting in a thread - teaching howto fisch and not just feeding. :D I reflashed LRS and thus recompiled kernel and rtl8812au_aircrack-ng, and this time all went well.

One thing, I dont quite understand is, why changes made in menuconfig while in the process of compiling the kernel with genkernel within LRS are ignored. like when I had removed CONFIG_LOCALVERSION="-x86_64" from the kernel configuration. Another is - as asked in the other thread, how autologin with no password is handeled and thus could be modified, as I'd like to have the ability to boot LRS from my stick without autologin, but with normal user authentication and also a root protected with password. But even if I set a password with passwd, there is no password needed to su into root after a reboot. Furthermore it would make probably sense to encrypt the whole thing. Only then it would be wise to put on personal data on the stick, right?
Back to top
View user's profile Send private message
sabayonino
l33t
l33t


Joined: 03 Jan 2012
Posts: 781

PostPosted: Tue Dec 31, 2019 12:41 pm    Post subject: Reply with quote

Elleni wrote:
Thanks NeddySeagoon for your detailed information. You would have made a great teacher. It's always a good oportunity to learn thus good to have you assisting in a thread - teaching howto fisch and not just feeding. :D I reflashed LRS and thus recompiled kernel and rtl8812au_aircrack-ng, and this time all went well.

One thing, I dont quite understand is, why changes made in menuconfig while in the process of compiling the kernel with genkernel within LRS are ignored. like when I had removed CONFIG_LOCALVERSION="-x86_64" from the kernel configuration. Another is - as asked in the other thread, how autologin with no password is handeled and thus could be modified, as I'd like to have the ability to boot LRS from my stick without autologin, but with normal user authentication and also a root protected with password. But even if I set a password with passwd, there is no password needed to su into root after a reboot. Furthermore it would make probably sense to encrypt the whole thing. Only then it would be wise to put on personal data on the stick, right?


I'll check this asap. Thanks for your help.
Some kernel features should be disable/enable ...
All kernel configurations are stored in /etc/kernels dir.
Genkernel autosave your configuration all the time you (re)compile the kernel.
Anyway , please check /etc/genkernel.conf to setup your favourite configuration/options to pass to genkernel


Root by default can't start any X11 applications
Root autologin cofigured by /etc/inittab
Code:
[...]# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty1 linux
c2:2345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty2 linux
c3:2345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty3 linux
c4:2345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty4 linux
c5:2345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty5 linux
c6:2345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty6 linux

"Welcome message" to TTY and some checks is provided by /bin/bashlogin file

/etc/inittab.bk is a backupfile of original Gentoo inittab file.
Code:
cp /etc/inittab.bk /etc/inittab

You'll get the standard Gentoo login to TTY.

Root account is passwordless. Please setup the Rott password before any changes.
Then you can setup your user as Gentoo handbook explained.

You can remove "Keyboard Menu selection" to grub :
Code:
# chmod -x /etc/grub.d/ 42_localeset && grub-mkconfig -o /boot/grub/grub.cfg

Setup keyboard configuration according on Gentoo Handbook.
See /etc/default/grub --> keymap=\${bkeymap} kernel line option also (remove this and update grub.cfg)
--dokeymap option to genkernel must be removed and future kernels must be configured without this option to avoid keyboard selction at all boot time

LRS is not localized. If you want to localized your LRS installation , plese follollow Gentoo Handbook Localization Guide.
You can rebuild all LRS system and customize all LRS configuration files !!! It's Gentoo !!

LRS was build in my spare time as funny work ! Nice to share LRS with you ! I'm not a programmer or developers !
Just for fun !
_________________
BOINC ed il calcolo distribuito

My LiveRecoverySystem Repo
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Wed Jan 01, 2020 6:05 pm    Post subject: Reply with quote

Thanks sabayonino, for your help and for sharing your work. Very nice :)
Back to top
View user's profile Send private message
sabayonino
l33t
l33t


Joined: 03 Jan 2012
Posts: 781

PostPosted: Fri Jan 03, 2020 6:24 pm    Post subject: Reply with quote

20200103 images are available . Keymap setup at boot will be persistent after first system boot and CONFIG_LOCALVERSION was disabled.
Please let me know if it works.
_________________
BOINC ed il calcolo distribuito

My LiveRecoverySystem Repo
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1039

PostPosted: Sun Jan 05, 2020 10:53 pm    Post subject: Reply with quote

Yep, works fine! Thanks and keep up the good work! :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum