[SOLVED] Kernel 5.10.66 on ARM machine not loading kernel modules
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Kernel 5.10.66 on ARM machine not loading kernel modules
I've recently made a LOT of progress with the board (Firefly ITX-3588J) that I mentioned over in the Embedded & SBC forum, to which I didn't get many responses to my inquiries - and so I'm not sure if this is the right forum or not for this because while it involves the board it is more specifically now related to the kernel itself. I managed to get an Ubuntu 20.04 system loaded after much trial and error because I wanted to install to an SSD hard disk, but the kernel modules don't load! In particular, running an lsmod from the command prompt gives
Code:
Module Size Used by
bcmdhd 1310720 0
... and that's it. Despite that I have a /lib/modules folder populated with lots of module files and a suitable modules.dep. This means a lot of device drivers for the system are not available. And I can't bring up a graphical desktop either when it's in this state.
For what it's worth, the way I have it set up is that the kernels are on a partition on the onboard flash MMC chip, while the OS root file system is located on the hard disk. The kernel boot options are (via cat /proc/cmdline), with the root file system indicated explicitly,
The modules (in /lib/modules) are also part of the root file system, so on the hard drive, which may not be ideal - and I note that while the kernel is booting the following flashes up for a moment on the serial console output:
Code:
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... Warning: Something odd, no /lib/modules.
done.
[ 15.972678] systemd[1]: Failed to find module 'autofs4'
[ 15.977494] systemd[1]: systemd 245.4-4ubuntu3 running in system mode. (+PAM)
[ 15.978373] systemd[1]: Detected architecture arm64.
And note this: "Warning: Something odd, no /lib/modules." And I suspect that is what is where it is failing. What could be causing this?
FWIW, the board vendor supplies a kernel config and kernel source tree and that's what I used to compile the kernel installed on the machine. My suspicion is that it has something to do with that it needs to know at this point to look on the hard drive for the modules, yet doesn't know to do so or how to. How can you tell it?
Your kernel, modules,initrd, and kernel headers should all be of the same kernel version. Further, the symlinks at /lib/modules/<version>/build & /lib/modules/<version>/source should not be broken.
To quote the fictional Jean-Luc Pickard: "Make it so" . It sounds like your initrd has the wrong modules for your kernel.
Your kernel, modules,initrd, and kernel headers should all be of the same kernel version. Further, the symlinks at /lib/modules/<version>/build & /lib/modules/<version>/source should not be broken.
To quote the fictional Jean-Luc Pickard: "Make it so" . It sounds like your initrd has the wrong modules for your kernel.
All the components are the right version because I generated them all from the provided kernel code pack (5.10.66), and prepared the modules using make modules_install. Moreover, I can modprobe any module in /lib/modules/5.10.66 into the running kernel. It seems the initrd, then, must or may be the source of the problem. I'm using the "stock" initrd, i.e. the one that shipped with the same kernel code pack, so again a version incompatibility should not exist. I suppose the problem is that the stuff in the initrd doesn't know to look on a different medium (the hard drive) from the one it lives/is booted on (the eMMC) to procure the modules. How/what do I need to change in there to give it a heads up?
(FWIW it's worth noting that I actually can't use any other kernel version than this 5.10.66 right now, because the RK3588 is not a fully supported SoC in the mainline kernel code streams, particularly given how new it is. Apparently even the whole RK35xx series generally is not fully supported.)
You load a kernel & initrd at startup. They have to be the same. If you switch kernel, you hace to remake the initrd.There's usually a script called 'mkinitrd' or 'mkinitrd.sh' in the $PATH.
It might be easiest to put back the original kernel, boot on that and the mkinitrd scripts have a switch that allows you to make an initrd for a different kernel version. Try mkinitrd --help.
You load a kernel & initrd at startup. They have to be the same. If you switch kernel, you hace to remake the initrd.There's usually a script called 'mkinitrd' or 'mkinitrd.sh' in the $PATH.
It might be easiest to put back the original kernel, boot on that and the mkinitrd scripts have a switch that allows you to make an initrd for a different kernel version. Try mkinitrd --help.
Is that the $PATH on the host machine (the one where I'm building the kernels) or the target one? Is it included with the kernel, or what?
ADD: I just ran it on the target machine (i.e. the Firefly/Rockchip machine) as that makes the most sense because of the architectural difference. I got the following two warnings though while it did its making:
Code:
W: mkconf: MD subsystem is not loaded, thus I cannot scan for arrays.
W: mdadm: failed to auto-generate temporary mdadm.conf file.
Is this a problem?
ADD 2: I just booted it from the new initramfs. The modules still don't load - lsmod still shows only one loaded module:
Code:
Module Size Used by
bcmdhd 1310720 0
Though admittedly, no user software but bash via the serial console is running at this point (X doesn't seem to be working for some reason and I have no framebuffer console either - though presumably there should be a way at least to get the former because the board's stock Ubuntu image can run X), and I've heard kernel modules are usually loaded/unloaded dynamically on a need basis. This module looks to be a wifi module. Is the system thus actually set up properly now?
FWIW now the part of the bootlog that I quoted in my initial post shows
No complaints about /lib/modules not being found or similar errors there or later. Taking it apart, it looks like actually the initramfs I was using before was the one the board maker provided which looked to be peculiar to that stock Ubuntu image and had some rather odd bits of functionality like using overlayfs - rather Android-like in that regard. Can I guess at least this issue is solved now, even though no other modules are showing as actually loaded by lsmod?
Good initrd scripts sniff around and add in the modules you want. Lesser ones either
stick in every conceivable module or
stick in basically no modules.
It looks like yours sticks in no modules. There's an option (often -m) to allow you to add in modules manually. I would add in every module you can think of - sound, graphics, filesystem, chipset, whatever your little thing uses. Then try it.
The errors you quoted I would ignore. Somebody compiled raid arrays into the kernel like your little sbc was a server serving the world. Raid arrays are multiple hard disks masquerading as one for various purposes (speed, redundancy, etc).
Good initrd scripts sniff around and add in the modules you want. Lesser ones either
stick in every conceivable module or
stick in basically no modules.
It looks like yours sticks in no modules. There's an option (often -m) to allow you to add in modules manually. I would add in every module you can think of - sound, graphics, filesystem, chipset, whatever your little thing uses. Then try it.
The errors you quoted I would ignore. Somebody compiled raid arrays into the kernel like your little sbc was a server serving the world. Raid arrays are multiple hard disks masquerading as one for various purposes (speed, redundancy, etc).
Thanks. If I open up the initrd and start poking around inside it, where is the "proper" place to put the code to add the modules? (I suppose it must be made to do modprobe with the modules.) Also, this makes sense - start with all of them, then if you find it's taking up too much RAM or CPU, start cutting back.
ADD: I just did some searching and found I can put it all in /etc/initramfs-tools/modules. Used & trimmed a find result on /lib/modules/5.10.66/kernel and put it all in there. Now it has all the modules loaded in. Not getting me graphics though, so no idea what's up there, but at least the issue in this thread is "fixed" for now, I'll say.
Run mkinitrd --help for program switches. They are usually bash scripts. Often 'mkinitrd -c' clears the tree and I'd recommend that as you've changed kernel versions. The -m option adds modules to your new initrd. All you actually need is enough to be able to mount and read the / drive.
The way this starts is that the initrd is mounted on /. That gives you the kernel modules, an 'emergency shell' which is usually busybox. When the root partition is mounted RO, it is mounted over the initrd which becomes invisible. If you ever want to use that emergency shell you need enough to make the keyboard talk to it.
Don't worry about fancy stuff or dependencies. Bells & whistles are loaded later from / and dependencies are catered for automatically.
The system does not have an "mkinitrd", but "mkinitramfs". That is what I ended up using. That does not support the same switches. Particularly, no -m switch. Also, it can mount / anyways because I compiled the kernel with the SATA drivers as integrated and not as modules for exactly that reason. The problem was that no other modules than the Broadcom module (which I believe is for the onboard wifi) were coming up. mkinitramfs does not allow dropping modules on the command line - instead, apparently you must list them in /etc/initramfs-tools/modules, and that's exactly what I did.
And I presume you mean "make the serial input talk to it", because getting a graphical console (thus keyboard) to work on this machine is a whole 'nother adventure in itself and to which I alluded on another thread on the main Software forum, as the RK3588 has a ARM Mali G610 integrated GPU, and no open source driver for that appears to exist yet, so I have to try to see what can be wrung from the closed drivers provided with the board. But I already have serial communication in all cases - though yes, over the longer term getting an independent graphical console would be a good thing and I was actually hoping that maybe some of those unloaded modules would help. Unfortunately, even with all modules loaded, however, graphics still doesn't work - not even Xorg, much less the framebuffer console for which there is no kernel config option at all for a Mali FB driver and including VGA doesn't help either (I presume ARM Mali is not VGA/PC-compatible, then, and cannot be driven in the same way a PC GPU card could be). Though for further discussion of that issue, I'd suggest looking and posting on my Graphics thread: https://www.linuxquestions.org/quest...ng-4175716561/
No I didn't mean serial port. I somehow fancied that if you dropped out of the initramfs without mounting /, you get dumped in a shell. But if you can't mount /, the only shell is in busybox. Your only comms would be the keyboard.
But you seem a bit lower down the food chain than I imagined. I think we can call this solved as if you're loading / it can get at it's own module tree.Enjoy your Graphics thread.
No I didn't mean serial port. I somehow fancied that if you dropped out of the initramfs without mounting /, you get dumped in a shell. But if you can't mount /, the only shell is in busybox. Your only comms would be the keyboard.
But you seem a bit lower down the food chain than I imagined. I think we can call this solved as if you're loading / it can get at it's own module tree.Enjoy your Graphics thread.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.