date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,428,446,776,000 |
I am trying to find an appropriate driver for a USB WiFi adapter that is reported by lsusb as
0bda:a811 Realtek Semiconductor Corp.
On WikiDevi it is described as "Realtek RTL8811AU Wireless 802.11ac 1x1 USB 2.0".
There are multiple repositories that seem to provide drivers for RTL8811AU, for example this one (it is based on this one that claims to support rtl8811AU). However, I would like to check the compiled module if it supports the device before trying to install it into the kernel (it is someone else's system that I am trying to mess with).
From searching online I concluded that it should be enough that the output of modinfo command for the driver module return a line of the kind
alias: usb:v0BDApA811d*dc*dsc*dp*ic*isc*ip*in*
which would contain the correct vendor ID (0BDA) and the correct product ID (A811).
How reliable is this method of checking compatibility of drivers with devices? Is this how the kernel selects the driver?
Is the exact match of both vendor and device IDs necessary? For example, I tried first installing rtl8812au-dkms package with apt-get (on Ubuntu). However, the output of modinfo 8812au | grep A811 was
alias: usb:v7392pA811d*dc*dsc*dp*ic*isc*ip*in*
-- the device ID is ok, but the vendor ID does not match. Does it mean that this driver will not work with this device?
|
This method is reliable, that is how the kernel (or udev and kmod) chooses a module to load: when a new device appears (including at boot time, when all devices are probed), it looks for a module with a modalias matching the device descriptor.
If modinfo lists an alias for a module which matches your device, then that means the module claims to support the device. In your case, the module supports devices matching 7392:A811 (and perhaps others which don’t match your grep), but not your device, so it appears rtl8812au-dkms won’t be much help (at least in its current state)... The Linux USB registry is currently offline, so I can’t check any further. Note that aliases are a first level of filtering, and don’t absolutely guarantee support — modules use their own probe functions when they initialise, and those can use other pieces of information. See this question for more details, and the kernel documentation for information on everything which can feature in an alias.
(The similarity in identifiers does suggest the driver could support your device too, so you could try adding the ids to the module to see what happens.)
| How to check if a given driver kernel module supports a given device? |
1,492,509,841,000 |
I read in Tanenbaum's book about operating systems that there are protection rings and ring 0 belongs to the kernel. Is it in general that one may say that "kernel modules handle the I/O and memory management of ring 0" or is "kernel module" specific for linux and not applicable for example for OpenBSD and MULTICS?
|
The ideas presented by Andrew Tanenbaum are usually not directly applicable to Linux (or any traditional monolithic Unix kernel). The answer to your question is much simpler than you are suggesting: a Linux kernel module is kernel code that has been compiled and linked into a separate file, instead of being linked into the kernel image. This separate kernel object file (.ko) can be loaded into the kernel address space, on demand, at run time. Practically all the drivers that can be compiled as kernel modules can also be statically linked into the kernel image, without any difference in functionality once code has been loaded.
The module code is kernel code and it runs with the same privilege as all other kernel code. A kernel module can in principle replace any kernel code, but to do so cleanly the kernel proper must provide a mechanism for the module to hook into.
A side note on terminology: Protection Rings is a concept introduced with the Multics operating system. "Ring 0" to "Ring 3" are terms that are specific to Intel processors. Other processor architectures use other terms, like User/Supervisor mode. Although Intel processors provide four different levels of privilege, most operating systems have only used two: Ring 3 for user level code and Ring 0 for kernel code, mirroring the User/Supervisor modes of other processors. (The exception is OS/2, which used three levels of privilege.)
The privilege level concept has been expanded lately with the advent of hardware level virtualization technology. For example, the ARM architecture defines three privilege levels: User, Supervisor and Hypervisor. Jokingly, it has been said that finally four rings are used on Intel-based machines: Ring 3 for user level code, Ring 0 for (virtual machine) kernel code, Ring -1 for hypervisor code and Ring -2 for SMM mode.
| Are kernel modules specific for linux or a general mechanism? |
1,492,509,841,000 |
I've been looking in my various Linux builds in those file:
/proc/config.gz
/boot/confi
/boot/config-$(uname -r)
And I'm noticing some major differences in number of active linux configs.
For example, in a default Debian image, I had:
Linux/x86 3.16.36 - 4462 kernel configurations set
In a Linode virtual machine, I have:
Linux/x86 4.5.5-x86_64-linode68 - 1479 kernel configurations set
I'm surprised to see that there are 3000 more kernel configurations on the default Debian one.
Is there a known minimal kernel configuration template somewhere ? Let's say for different usages, like a web server.
|
I'm surprised to see that there are 3000 more kernel configurations on the default Debian one.
That's normal. There are about 3000 different drivers available for real hardware that make zero sense for a VM (until you want PCI (or even USB) passthrough, at least).
Is there a known minimal kernel configuration template somewhere ?
No. People's requirements vary too much. Distro maintainers will only be interested in supporting the shotgun approach, where everything that makes even remote sense to use is enabled. However, there are some tools that can help you roll your own minimal kernel config, see https://kernel.org/doc/Documentation/kbuild/kconfig.txt
| Minimal kernel config repositories |
1,492,509,841,000 |
I've just installed a new Debian 8.4.0 on my ThinkPad T460P and now I need to config WIFI.
I've installed the intel driver with apt-get install firmware-iwlwifi but the kernel module won't load on startup only when calling modprobe iwlwifi it will be listed under lsmod.
ip a returns only the 'lo' and the 'eth0' but no wifi-interface.
lspci -k shows :
03:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
Subsystem: Intel Corporation Device 1130
(But no "Kernel drive in use: ****")
What am Im doing wrong?
|
Skylake support, especially mobile Skylake, needs at least a 4.6 kernel. The default kernel in Debian 8.4 (and the associated firmware) is too old... You should try the updates available in the backports:
echo deb http://http.debian.net/debian jessie-backports main contrib non-free > /etc/apt/sources.list.d/jessie-backports.list
(as root), then
apt-get update
apt-get -t jessie-backports install linux-image-amd64 firmware-iwlwifi
This will now give you at least kernel 4.6.
| No wifi-interface on ThinkPad T460P with debian |
1,492,509,841,000 |
I am trying to load the rtl8723ae kernel module on Arch Linux.
When I run
lsmod | grep rtl8723ae
...it doesn't show anything.
When I arch-chroot into the install from an Arch install USB,
it is showing the module as loaded; the same command returns the module.
If this module is supposed to come as standard with Arch, why can't I see it?
|
You misunderstand what the command does. lsmod doesn't list all available modules, it only lists the modules that are currently loaded. For example, on my Arch:
$ lsmod | grep rtl8723ae ## returns nothing, the module isn't loaded
$ sudo modprobe rtl8723ae
$ lsmod | grep rtl8723ae
rtl8723ae 81920 0
btcoexist 53248 1 rtl8723ae
rtl8723_common 20480 1 rtl8723ae
rtl_pci 28672 1 rtl8723ae
rtlwifi 65536 2 rtl_pci,rtl8723ae
As you can see, the module is listed as soon as you actually load it. Presumably, something in your chrooted environment is causing it to be loaded automatically.
| lsmod not showing module unless using arch-chroot |
1,492,509,841,000 |
The following two commands output the same thing:
$ modinfo iwlwifi
filename: /lib/modules/3.16.0-34-generic/kernel/drivers/net/wireless/iwlwifi/iwlwifi.ko
....
$ modinfo /lib/modules/3.16.0-34-generic/kernel/drivers/net/wireless/iwlwifi/iwlwifi.ko
What is iwlwifi.ko used for? What does .ko mean?
Is its content the installed module iwlwifi, or only the information about this module (similar to manpage of a program)?
|
It's the module code itself. Module metadata is usually either stored inside the module .ko or within flat files underneath /lib/modules/$(uname -r)/. If you want to know more about the module you're looking at you can do a modinfo iwlwifi
| What are files *.ko used for? |
1,492,509,841,000 |
I'm trying to intercept the clone system call so that I could print user ID and process ID before the actual system call executes. I am using get_user_id()->uid to access user ID in kernel module but it returns user ID in kuid_t type, which I can not cast to int. Is there any other way to do this?
I've read about using getuid() (from unistd.h) in other forums but interestingly the compiler recognizes the first use of this function as an implicit declaration.
|
That struct is defined in include/linux/uidgid.h. The only thing it contains is a val member of type uid_t, which is what the userspace getuid returns (an unsigned int on Linux, follow the headers by browsing via Linux Cross Reference for example).
Either access it directly from your kuid_t variable, or use __kuid_val from that same header.
| User ID in kernel module [closed] |
1,492,509,841,000 |
Ok. Running a version of LDME with a kernel of 3.11-2-amd64 ( basically debian testing).
Suddenly with the installation of this particular kernel the module ppa.ko is gone. Further an apt-file search shows that this module does not exist.
Anyone know what is happening?
|
This was disabled in the 3.11 build of the debian package. From the package's changelog:
Disable parport drivers that are no longer likely to be useful:
block: Disable PARIDE
media: Disable VIDEO_BWQCAM, VIDEO_CQCAM, VIDEO_W9966
SCSI: Disable SCSI_IMM, SCSI_PPA
This means the the maintainer no longer felt that Iomega Zip drive support was still useful for Debian users. If you feel this is incorrect, you can file a wishlist bug against the package in the Debian Bug Tracking System.
| The curous incident of the missing ppa.ko in debian 3.11 kernel? |
1,492,509,841,000 |
I'm installing a new server and I'm not able to figure out what module should I load to make its on-board network card work. Calling lspci prints:
Ethernet controller: Intel Corporation Device 1521
I tried to google, but I couldn't find what module should I load?
|
My server has the same Ethernet controller as yours, Intel Corporation Device 1521. According to lsmod, the module is igb.
| What module for network card Intel Corporation Device 1521? |
1,492,509,841,000 |
I've attempted to install drivers for an FPGA device, but require that I remove the usbserial module. This happens to be impossible because usbserial is a built-in module. It was suggested that I compile a new kernel to make usbserial dynamically loadable and unloadable.
I'm now trying to compile a custom kernel w/ Fedora. The guide being located here:
http://fedoraproject.org/wiki/Building_a_custom_kernel
At this moment I am using a GUI to set my kernel options, but I have no idea what options to select and deselect.
Any advice would be greatly appreciated.
|
Try using make nconfig or make menuconfig which presents you with interactive text UI. Both have search facility for both the kernel CONFIG_* options (those which are placed in .config which governs the build) and strings within the currently selected option menu. IMHO both of these TUIs are more usable than the GUI.
As for your case, you are probably looking for CONFIG_USB_SERIAL which is located in Device Drivers -> USB support -> USB Serial Converter support - you need to change this from <*> to <M> (using the M key).
| Compile Linux Kernel w/ Dynamically (Un)loadable usbserial Module |
1,492,509,841,000 |
I am porting the driver for a USB device to Rocky Linux 9.3. Once the module is inserted, new logins by ssh are unresponsive. Blacklisting the module and rebooting restores normal functionality.
https://github.com/izot/lon-driver
With the module inserted, lsmod|grep u50 "Used By" goes from 0 to 1 about every 7 secs. Then, when an SSH login is attempted, Used By goes between 3 and 2.
Stop the SSH login, modprobe -r u50, try again...
Now SSH gets motd but no prompt and says "PTY allocation request failed on channel 0."
ssh SITE "/bin/bash -i" (login succeeds) (same with module inserted)
modinfo u50
filename: /lib/modules/5.14.0-362.18.1.el9_3.x86_64/kernel/drivers/lon/u50.ko
description: U50 SMIP Driver 1.4 L2
alias: tty-ldisc-28
license: GPL
rhelversion: 9.3
srcversion: 311B898EC0CC268466EA85B
depends:
retpoline: Y
name: u50
vermagic: 5.14.0-362.18.1.el9_3.x86_64 SMP preempt mod_unload modversions
With the module removed, journalctl shows "error: openpty: Cannot allocate memory" and "error: session_pty_req: session 0 alloc failed."
With the module inserted again and an SSH attempt, journalctl shows "NetworkManager ... manager: (lon10): new Generic device (/org/freedesktop/NetworkManager/Devices/743)" and "NetworkManager ... manager: (lon11): new Generic device (/org/freedesktop/NetworkManager/Devices/744)."
When the SSH attempt is canceled, journalctl shows "Removing a network device that was not added" twice.
I finally have gdb setup to remotely debug. I copied the src to the host running gdb. I can break at a function in the loadable module but that is too late. I need to break when the module is loaded and it kills new ssh logins. This module is for USB and is not related to ssh.
I can break at do_init_module() and step until exit_to_user_mode_loop() then it says "Cannot find bounds of current function." Setting a breakpoint at module_init() for a future load does not break.
|
I didn't port this line properly and it failed to set the .num field in struct tty_ldisc_ops.
//FIXME err = tty_register_ldisc(N_U50, &u50_ldisc);
err = tty_register_ldisc(&u50_ldisc);
The other part of my question (breaking at module_init()) was solved by setting a breakpoint in rtnl_link_register().
| How can I break at module_init()? This loadable kernel module is preventing SSH logins |
1,492,509,841,000 |
So normaly during boot or when a device is hotplugged Linux loads kernel modules for hardware based on modaliases.
Is there a way to manually trigger this for a specific device or a general "rescan" for the whole system?
e.g. I have a pci device which had no matching driver during boot. Then I install a driver package with several modules. Now I want the system the automatically pick the right one based on modaliases and load it like it would on a reboot, without actually rebooting.
|
You can use udevadm trigger for this, on a specific device or the whole system.
| Rescan for matching kernel modules |
1,492,509,841,000 |
Somewhere along the line, the nested kvm kernel module became enabled by default. As hard as it may be to believe in this day and age, not everyone in the world had a need to run kvms on every host that gets built. Is there any performance cost to leaving this default enabled even if you have zero intention to deploy kvms? All my googling on this subject has come up with no useful info on pros/cons to having this module present - performance, security, or any other potential impact.
Or, is this just case of "if it ain't broke, don't fix it"?
|
Or, is this just case of "if it ain't broke, don't fix it"?
I'd go with that :)
There's no cost to the module being there. There might be a cost to the CPU having the feature enabled (which, on some older x86_64 you could disable in the UEFI setup, not sure this is still the case on modern machines), namely that of course nested page tables add a layer of page table redirection. But seeing you'd only use a single value for that redirection: that is effectless.
Things get more complicated once you consider features that can only work when virtualization is enabled – mostly IOMMU (if you actually use IOMMU groups, there is a minor performance overhead. Not enough for people with billions of dollars in servers to abandon that; draw your own conclusion).
So, in a sense, it really doesn't cost you anything (ok, a couple kilobytes in module memory, maybe) to keep it loaded. Then again, the kernel can work just as well without. If you're building a slimmed down kernel anyway, it'd be OK to exclude it.
| Is there any benefit in disabling kvm module on bare metal that won't ever run kvm guests? |
1,492,509,841,000 |
when I run efibootmgr command:
efibootmgr --create --disk /dev/sdb --part 1 --loader /EFI/syslinux/syslinux.efi --label "Syslinux" --unicode
I get this error:
EFI variables are not supported on this system.
when I try to load the module efivarfs, I get following error:
modprobe efivarfs
modprobe: ERROR: could not insert 'efivarfs': No such device
I am using self compile kernel, and i do have efivarfs support:
CONFIG_EFIVAR_FS=m
so why can't I load the module ?
I am using kernel 6.1.45 on Debian 12
UPDATE:
I have just tested on Debian Live-CD booted system, and I get the same error:
modprobe efivarfs
modprobe: ERROR: could not insert 'efivarfs': No such device
|
If you've booted in Legacy BIOS compatibility mode, the firmware cannot make UEFI runtime services available to the running OS, and so UEFI variables cannot be manipulated. In this situation, the Linux kernel will not present a /sys/firmware/efi/ directory at all, and so efivarfs cannot be mounted, as the kernel module fails to communicate with the firmware's UEFI runtime services.
Most modern installation and Live-CDs are prepared to be bootable both in legacy and UEFI modes, so you'll have to be really careful to boot from external media in UEFI mode if your system has the BIOS compatibility support module (CSM) module enabled.
The writer of the system firmware can decide whether the system will prefer legacy or UEFI-style boot, or make it selectable in the BIOS settings. Unfortunately the user interface to these settings is not standardized - each vendor can do it differently.
Generally, when starting to install the first operating system to a new computer, you should decide whether to use UEFI or legacy BIOS, and if possible, adjust the BIOS settings to allow that boot mode only. Completely excluding the "wrong" boot mode makes it easier to avoid mistakes.
| modprobe: ERROR: could not insert 'efivarfs': No such device |
1,492,509,841,000 |
I'm trying to use the following code in the kernel module
struct timeval now;
gettimeofday(&now, NULL);
But getting following error while compiling kernel
drivers/media/i2c/ox05b.c:776:17: error: storage size of ‘now’ isn’t known
776 | struct timeval now;
| ^~~
|
The first rule of kernel development is that the C library isn’t available. In a kernel module, if you want to know the time, you should use the appropriate ktime accessor, for example
#include <linux/timekeeping.h>
…
ktime_t now = ktime_get_real();
| How to use gettimeofday in the kernel module? |
1,492,509,841,000 |
I have the following Ethernet to USB-C adapter:
$ lsusb | grep Ethernet
Bus 002 Device 003: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
Currently it is not working when plugged into the USB-C port, in dmesg I get:
[23552.344134] ax88179_178a 2-1:2.1 eth1: Failed to read reg index 0x0000: -32
(However, it works on a different machine, but the error is still shown, and the transfer rate seems limited.)
I am wondering if I have the correct driver installed. I've seen that axge seems to be the correct driver, but it does not show up in lsmod.
What is the correct driver to use for AX88179, how to check if it is installed, and how to install it otherwise?
I am currently using Linux Mint 20.3.
|
The axge driver you linked is for the FreeBSD version of Ubuntu.
The corresponding Linux driver seems to be named ax88179_178a. It should be included in the standard kernels of all modern distributions, as the copyright marking in the source code is from year 2013. Here it is in kernel version 4.9.318, the oldest kernel currently in long-term support by the kernel developers.
| Driver for AX88179 Gigabit Ethernet |
1,492,509,841,000 |
My current problem is that: on my Acer Nitro laptop keyboard, there is a Nitro key - which is a special key that no other laptop brand has. You see in the image below that there is a weird N key next to the backspace key - that's the Nitro key.
I want to develop an GUI application such that whenever the Nitro button is pressed, my application shows up. I am using Ubuntu 22.04.
From what I have found, I think I would have to write a LKM to capture the Nitro key press event and start the application from there. I am following the answer here (https://stackoverflow.com/questions/33836541/linux-kernel-how-to-capture-a-key-press-and-replace-it-with-another-key) to capture the key press event.
I wonder if it is okay to start a GTK application within the LKM - in other words, putting the sample code here (https://www.gtk.org/docs/getting-started/hello-world) in my kernel module code. Also, I wonder if I am on the right track to achieve my goal.
Thanks in advance!
[UPD] Clarification on what I want: Acer Nitro laptops usually have an app called Nitrosense that provides a GUI to change the keyboard color and fan speed. The Nitro key when pressed shows users the GUI. However, Nitrosense app is only for Windows - I want to write the same thing for Ubuntu. So far I found various repos on changing the keyboard color and fan speed, but there is no repo for an app that opens when I press the Nitro key, so I want to build such thing. I'm using GNOME 42 on Ubuntu 22.04. What I want is whenever the user (already logged in) presses Nitro key, a GUI automatically shows for me to do stuffs.
[UPD2] I also found this repo https://github.com/kphanipavan/PredatorNonSense which seems trying to do the same thing as my concern on another Acer brand. I think it might be helpful, will see.
[UPD3] Here is the event I found when I used evtest
However, when I tried xev, there was nothing printed, which makes me think that the X Server doesn't recognize the Nitro key press event. I guess I should look for documentation to write a module to send the Nitro key event to X Server?
I tried to go to Keyboard settings in GNOME Control Center to try to add a keyboard shortcut, but it also didn't recognize the Nitro key - maybe because GNOME is running on X Server and X Server doesn't recognize the Nitro key event?
I also looked at the repo I mentioned in UPD2, so what the author did is also polling via continuously grep the log from evtest to see if the key is pressed - check out this shell command https://github.com/kphanipavan/PredatorNonSense/blob/master/PNS.sh.
What I think I can also do is to write a simple systemd service to poll the keyboard device file and check if the Nitro is pressed. However, one mentions that this might waste quite a lot of resources. Any suggestion about this?
|
I want to develop an GUI application such that whenever the Nitro button is pressed, my application shows up.
So you need to expose the Nitro button for example as a kernel input layer event. Then some userspace application can act on it and start your UI application.
Remember that Linux is multiuser, the system is designed for a situation where you have a single machine and dozens of people using a GUI with different accounts. So you can't just "start an application", you need to find the right user. But the kernel is user agnostic.
That means something for this particular user has to act on it. The simplest place to put this is the Window Manager configuration for that particular user (which would be you, I assume).
I wonder if it is okay to start a GTK application within the LKM
It's not ok, and it's not going to work.
Resources:
Kernel input subsystem
evtest
xev
Kernel HID documentation
Use evtest to see if the Nitro already produces a keypress event. If it does, you don't have to write a kernel module. Then use xev to see if it already gets translated into an X event.
If it doesn't produce a keypress event, the search for the actual event will get interesting...
Finally, find out what window manager your desktop uses, then google documentation for your window manager, and find out how to launch programs for a certain keypress.
(BTW, it's usually better to just paste text indented by four blanks instead of an image)
So that's an ordinary key press and release event for code 425 KEY_PRESENTATION.
If you want to make your own keyboard layout that maps this code to an X keysym, I recommend reading An Unreliable Guide to XKB Configuration (2004). Copy an existing layout with a new name and then modify it, that way you won't lose it when the system packages get updated.
If you want a small user-space program to listen for that key, pick a language with a library for the kernel input layer, e.g. Python. Make sure to use the symlink in /dev/input/by-path/... that corresponds to your keyboard, the /dev/input/eventX numbers are not stable across boots.
| Start a graphical application from kernel module? |
1,492,509,841,000 |
I am trying to make a Lenovo Thinkpad P52 work with an Lenovo USB-C Hybrid Dock (40AF, see docks to avoid ...) on Linux Mint 20.3 Una a.k.a. Ubuntu 20.04. What a ... journey ...
The laptop has its /home folder sitting on a ZFS file system (zpool). The operating system itself runs on btrfs. Graphics are switched to dedicated (i.e. Nvidia) in the BIOS and driven by Nvidia's proprietary driver. The laptop's BIOS has been updated to the latest version beforehand to avoid bricking the mainboard in this kind of setup (really impressive BIOS bugs). Thunderbold security has been switched off in the BIOS as well. Interestingly, the dock does not show up when running boltctl list - although I had to disable Thunderbold security. I guess this is where the "hybrid" comes in. DisplayLink drivers have been installed from here. I should be ready to go.
When I boot the laptop with the dock disconnected, everything works fine. I can then plug the dock in once the computer is up and network plus USB on the dock are working as expected. (I am not yet far enough down the rabbit hole to trouble-shoot the display connection.)
When I boot with the dock plugged into the laptop, the boot hangs for about two minutes just before the login screen should appear. It usually shows a single line of console output, usually some error, but different ones every time (e.g. ucsi_acpi USBC000:00 con1 failed to register alternate modes or bluetooth hci0 setting interface failed (71)). I figure that those errors also happen without the dock - it's due to the hang that I can see them, I guess. When I wait for some timeout to pass, I am presented with the usual graphical login screen, though login attempts fail. This is when I discovered that my zpool was gone (every time when I booted with the dock connected), hence there was no user folder to log a user into. I switched to the command line (Ctrl+F1) and checked zpool status - nothing. A manual zpool import data, the contents of /home showed up again, back the the login screen (Ctrl+F7) and everything worked fine.
The timeout and the fact that my zpool is gone suggest some sort of error during kernel module loading or initialization, perhaps the order in which things happen - though I am not sure how to debug this or what is going on. Without the dock, everything works as expected.
I am troubleshooting this system for a visually impaired person. The whole point of the docking station is that there are fewer cables to connect/disconnect from the laptop. It's the general difficulty of plugging the cables in and out that has created my scenario. Therefore, it's a tough sell for me to say "just unplug the cable every time before you boot the machine even if you do not carry it with you" even if it's only this one cable.
|
ZFS pools are imported during boot via the zfs-import-cache.service service. This one failed in my case with result dependency.
Going through the dependencies, I found that systemd-udev-settle.service had failed beforehand, reporting Main process exited, code=exited, status=1/FAILURE and Failed with result 'exit-code'.
Because this only happens when the Dock is attached, I ended up looking at DisplayLink and related bugs. I found this gem. As it turns out, /opt/displaylink/udev.sh is called by the udev service and times out, which is sort of a known issue - no relationship to ZFS whatsoever, just an unfortunate chain of events. The issue has been known for over two years and remains unfixed in the DisplayLink drivers, though various packagers have hacked around it.
I applied this hack, i.e. starting the displaylink-driver service from within /opt/displaylink/udev.sh as follows: systemctl start --no-block displaylink-driver
I literally only added the --no-block parameter. This solves my problem and the external display attached to the docking station actually also works as expected.
| Lenovo USB-C "hybrid" dock connected during boot: Boot hangs and zpool does not get loaded |
1,492,509,841,000 |
my goal is to make my kernel-headers to have the same version as my kernel and kernel-devel. Currently I have:
$ sudo yum install kernel-headers
Last metadata expiration check: 1:55:19 ago ...
Package kernel-headers-5.15.4-200.fc35.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
$ yum --showduplicate list kernel-headers
Last metadata expiration check: 0:39:37 ago ...
Installed Packages
kernel-headers.x86_64 5.15.4-200.fc35 @updates
Available Packages
kernel-headers.i686 5.14.9-300.fc35 fedora
kernel-headers.x86_64 5.14.9-300.fc35 fedora
kernel-headers.x86_64 5.15.4-200.fc35 updates
$ uname -a
Linux fedora 5.15.13-200.fc35.x86_64
I want to have kernel-headers set to 5.15.13-200.fc35.x86_64.
I have tried everything from
[1] https://askubuntu.com/questions/1045451/linux-kernel-header-files-to-match-the-current-kernel
[2] yum installs kernel-devel different from my kernel version
[3] kernel headers and kernel devel
My problem is that I am able to install kernel-headers that are only in the available packages list.
What I tried (and failed) was:
$ sudo yum install kernel-headers-generic
Last metadata expiration check: 1:59:50 ago ...
No match for argument: kernel-headers-generic
Error: Unable to find a match: kernel-headers-generic
$ sudo yum install kernel-headers-5.15.13-200.fc35.x86_64
Last metadata expiration check: 2:00:09 ago ...
No match for argument: kernel-headers-5.15.13-200.fc35.x86_64
Error: Unable to find a match: kernel-headers-5.15.13-200.fc35.x86_64
$ sudo yum install kernel-headers-generic-5.15.13-200.fc35.x86_64
Last metadata expiration check: 2:00:15 ago ...
No match for argument: kernel-headers-generic-5.15.13-200.fc35.x86_64
Error: Unable to find a match: kernel-headers-generic-5.15.13-200.fc35.x86_64
So question is how to install kernel-header 5.15.13-200.fc35.x86_64. And since the "usual" methods did not help, I am not sure if it is relevant/equivalent to ask, how to expand the list of Available Packages which appears with --showduplicates.
|
According to an answer to a similar question, this package isn't released with every version.
Yum doesn't omit any packages here. I'd recommend just trying the devel, as recommended in the first linked forum.
| Cannot install any specifc version of `kernel-headers` on Fedora |
1,492,509,841,000 |
I'm configuring an external USB-to-SATA adapter in OpenWRT (Linux 4.14.221). The hub works only if I bind the device to the usb-storage module (preventing it to bind to usb-storage-uas).
To do that I added the following line to /etc/modules.d/usb-storage
usb-storage quirks=<VID>:<PID>:u
Where <VID> and <PID> are my device ids.
In order to do that I had to replace an existing option, which begs the question: what if I had two or more devices that required this setting? How can I pass multiple quirks?
I tried with:
usb-storage quirks=<VID1>:<PID1>:u
usb-storage quirks=<VID2>:<PID2>:u
and
usb-storage quirks=<VID1>:<PID1>:u quirks=<VID2>:<PID2>:u
But only one is loaded (tested with cat /sys/module/usb_storage/parameters/quirks).
OpenWRT doesn't include man pages. The modprobe.d(5) manpage on my linux (which I guess is similar, presents a different syntax (option <modulename> <options...>) but doesn't mention multiple options.
|
This is an old question, but for anyone ending up here via Google, the correct syntax for multiple quirks is:
options usb-storage quirks=<VID1>:<PID1>:u,<VID2>:<PID2>:u,<VID3>:<PID3>:u
So basically just put a comma between each quirk.
| How to pass multiple instances of the same option to a kernel module via `/etc/module.d/<module>` config file? |
1,492,509,841,000 |
I want to get a bluetooth-usb-stick running.
In the terminal, I enter sudo modprobe btusb,
but the output is: FATAL: Module btusb not found in directory /lib/modules/5.11.0-25-generic.
I am on a machine running ubuntu 20.04.
What might be the reasons for this module to be missing, and how can I add this module?
|
With the help of commenters I was able to fix this issue by reinstalling ( sudo apt install --reinstall <pkg>. I found the related package on ubuntu package-search.
After this I found that what removed the btusb was the install-script (the Makefile, to be precise) from the download-files provided by the manufacturer. The related lines that made this happen are:
mv $(DRV_DIR)/btusb.ko $(DRV_DIR)/btusb_bak
cp -f $(SRC_DIR)/rtk_btusb.ko $(DRV_DIR)/rtk_btusb.ko
So it basically replaces btusb with rtk_btusb. Note to self: read the scripts, don't blindly execute...
| How do I fix a "module not found" error? |
1,492,509,841,000 |
I am trying to build the ksmbd kernel module. I tried the tag version:
$ wget https://github.com/namjaejeon/ksmbd/archive/refs/tags/3.2.1.tar.gz
$ tar xvfz 3.2.1.tar.gz
$ cd ksmbd-3.2.1
$ make
[...]
CC [M] /tmp/ksmbd-3.2.1/transport_tcp.o
/tmp/ksmbd-3.2.1/transport_tcp.c: In function ‘create_socket’:
/tmp/ksmbd-3.2.1/transport_tcp.c:484:10: error: incompatible type for argument 4 of ‘sock_setsockopt’
(char __user *)iface->name,
^~~~~~~~~~~~~~~~~~~~~~~~~~
As well as the version from git/master:
$ git clone [email protected]:namjaejeon/ksmbd.git
$ cd ksmbd
$ make
make -C /lib/modules/5.10.0-0.bpo.7-amd64/build M=/tmp/ksmbd modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.0-0.bpo.7-amd64'
make[3]: *** No rule to make target '/tmp/ksmbd/ksmbd_spnego_negtokeninit.asn1.c', needed by '/tmp/ksmbd/ksmbd_spnego_negtokeninit.asn1.o'. Stop.
make[2]: *** [/usr/src/linux-headers-5.10.0-0.bpo.7-common/Makefile:1845: /tmp/ksmbd] Error 2
make[1]: *** [/usr/src/linux-headers-5.10.0-0.bpo.7-common/Makefile:185: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-0.bpo.7-amd64'
make: *** [Makefile:47: all] Error 2
What's the trick to generate those *.asn1.c files ?
For reference:
$ cat Makefile
[...]
$(obj)/asn1.o: $(obj)/ksmbd_spnego_negtokeninit.asn1.h $(obj)/ksmbd_spnego_negtokentarg.asn1.h
$(obj)/ksmbd_spnego_negtokeninit.asn1.o: $(obj)/ksmbd_spnego_negtokeninit.asn1.c $(obj)/ksmbd_spnego_negtokeninit.asn1.h
$(obj)/ksmbd_spnego_negtokentarg.asn1.o: $(obj)/ksmbd_spnego_negtokentarg.asn1.c $(obj)/ksmbd_spnego_negtokentarg.asn1.h
|
On Fedora and RHEL, the ksmbd external module build works because the kernel-devel packages ship all the relevant tools, in particular asn1_compiler.
There is no equivalent package in Debian, so the only way to build ksmbd is to use the full kernel source, and the simple option is to build it in the kernel tree:
sudo apt install linux-source-5.10
cd $(mktemp -d)
tar xf /usr/src/linux-source-5.10.tar.xz
cd linux-source-5.10/fs
git clone https://github.com/namjaejeon/ksmbd
Make the necessary changes to fs/Kconfig and fs/Makefile, then
cd ..
make allmodconfig
make fs/ksmbd/ksmbd.ko
| Building ksmbd on Debian Buster (+bpo) |
1,492,509,841,000 |
TL;DR:
The kernel module sht3x (https://www.kernel.org/doc/html/latest/hwmon/sht3x.html) seems to be missing in a standard debian installation. I need it in order to read an external sensor. How can I install this kernel module?
The whole story
I try to connect an SHT31 temperature/humidity sensor to my Debian notebook. In order to do so, I flashed an ATTiny85 micro controller to act as i2c-tiny-usb interface.
I got this part working - lsusb lists the device as
Bus 003 Device 003: ID 0403:c631 Future Technology Devices International, Ltd i2c-tiny-usb interface
and I also get a promising response from i2cdetect
$ sudo i2cdetect -l
i2c-3 i2c i915 gmbus dpc I2C adapter
i2c-1 i2c i915 gmbus vga I2C adapter
i2c-8 i2c i2c-tiny-usb at bus 001 device 017 I2C adapter
i2c-6 i2c AUX B/port B I2C adapter
i2c-4 i2c i915 gmbus dpb I2C adapter
i2c-2 i2c i915 gmbus panel I2C adapter
i2c-0 i2c i915 gmbus ssc I2C adapter
i2c-7 i2c AUX D/port D I2C adapter
i2c-5 i2c i915 gmbus dpd I2C adapter
$ sudo i2cdetect 8
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-8.
I will probe address range 0x08-0x77.
Continue? [Y/n] Y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- 45 -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
However, I cannot read sensor data, because the kernel module sht3x is not installed on my (standard Debian) system and is not listed in lsmod.
Question
How can I install and make use of the sht3x kernel module on my Debian notebook?
|
I’m assuming you’re running Debian 10, but the instructions for later versions are similar. The module you’re after is supported by the kernel version used in Debian 10, but it is not enabled; let’s fix that.
Install the kernel source for the default version in your release:
sudo apt install linux-source
Extract it:
cd /usr/src
tar xf linux-source-*.tar.xz
(assuming there’s only a single linux-source tarball available, which will be the case unless you’ve installed multiple linux-source packages).
Copy the current kernel configuration:
cd linux-source-*/
cp /boot/config-$(uname -r) .config
Enable the configuration for the sht3x module:
make menuconfig
(this might complain about missing tools, such as a compiler; sudo apt install build-essential should fix things).
To find which option needs to be enabled, and where it is, press / and enter “SHT3X”:
This gives a number of pieces of information:
the option is called SENSORS_SHT3X;
it is listed under “Device Drivers”, “Hardware Monitoring Support”;
the options it depends on are already enabled;
but it is disabled.
Press Enter to exit the search results, go down to “Device Drivers”, press Enter, then go down to “Hardware Monitoring Support”, press Enter again, find the “SHT3x” option, and press M to enable it as a module.
Press Tab until “Save” is highlighted, then Enter, confirm the name of the file to write (.config), and select “Exit” several times until you’re back at the prompt.
Finally, build the module:
make drivers/hwmon/sht3x.ko
This might require additional dependencies, at least libelf-dev and libssl-dev (sudo apt install libelf-dev libssl-dev).
If all goes well, you’ll end up with a drivers/hwmon/sht3x.ko file which you can load as a module.
| hwmon: add missing kernel module |
1,492,509,841,000 |
Consider the following kernel module source, which uses kprobes_register to get the address of a kernel symbol.
It works for symbols like flush_tlb_all, but not for sys_call_table.
A quick lookup using /proc/kallsyms:
sudo cat /proc/kallsyms | grep -E '\sflush_tlb_all$|\ssys_call_table$'
ffffffff86a83e20 T flush_tlb_all
ffffffff87a002e0 D sys_call_table
The difference being (man nm) that flush_tlb_all is in the text section, where as sys_call_table is in the data section. However, both symbols are global (external).
Why can't kprobes_register be used to lookup the address of sys_call_table?
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kprobes.h>
#define MAX_SYMBOL_LEN 64
static char symbol[MAX_SYMBOL_LEN] = "flush_tlb_all";
module_param_string(symbol, symbol, sizeof(symbol), 0644);
/* For each probe you need to allocate a kprobe structure */
static struct kprobe kp = {
.symbol_name = symbol,
};
static int __init kprobe_init(void)
{
int ret;
ret = register_kprobe(&kp);
if (ret < 0) {
pr_err("register_kprobe failed, returned %d\n", ret);
return ret;
}
pr_info("Planted kprobe at %p\n", kp.addr);
return 0;
}
static void __exit kprobe_exit(void)
{
unregister_kprobe(&kp);
pr_info("kprobe at %p unregistered\n", kp.addr);
}
module_init(kprobe_init);
module_exit(kprobe_exit);
MODULE_LICENSE("GPL");
|
The difference being (man nm) that flush_tlb_all is in the text section, where as sys_call_table is in the data section. However, both symbols are global (external).
This is exactly why register_kprobe fails on sys_call_table: it only allows probes in the kernel text. kprobe_register calls check_kprobe_address_safe once it has the address to probe, and the latter checks that the address is part of the kernel text.
| Why is `kprobes_register` (kprobes) able to retrieve symbol addresses for symbols like `flush_tlb_all`, but not `sys_call_table`? |
1,492,509,841,000 |
Background: I'm running Fedora 32 on a Thinkpad. Current kernel version is as follows:
Linux 5.8.4-200.fc32.x86_64 x86_64
Problem: It was working as expected for several months, but now when I run dnf update the following error is given:
Error:
Problem 1: package kernel-modules-extra-5.7.15-200.fc32.x86_64 requires kernel-uname-r = 5.7.15-200.fc32.x86_64, but none of the providers can be installed
- conflicting requests
Problem 2: package kernel-5.7.15-200.fc32.x86_64 requires kernel-core-uname-r = 5.7.15-200.fc32.x86_64, but none of the providers can be installed
- conflicting requests
Current situation / what I've tried: My (current, likely incorrect) understanding is that this older kernel package is being specified by some other package, and can't be installed because it's older and does not appear in the default repos.
I can get non-kernel packages to update by running dnf --excludepkgs=kernel\* , but I'd like to 1) understand, and 2) fix this error so that I can get kernel updates normally.
I have researched the error somewhat (see links below), but none of the similar conflict errors match my situation very closely, and I'm reluctant to remove or disable the denoted module(s) without understanding what that might do.
All guidance much appreciated!
Links I've investigate to date:
(https://www.linux.org/threads/how-to-fix-problem-conflicting-requests-on-dnf-install-on-centos.29322/)
("package X requires Y, but none of the providers can be installed")
(https://askbot.fedoraproject.org/en/question/133821/dnf-upgrade-conflicting-requests/)
(yum update returns kernel error) NOTE: this one looks similar, but the config file fix suggested here is not applicable to my configuration
|
Try this:
dnf remove $(rpm -qa | grep 5.7.15-200)
| How can I fix a "conflicting requests" kernel module error when running dnf update on Fedora 32? |
1,492,509,841,000 |
I'm running Ubuntu Mate on a raspberry pi 4 and this kernel compiles seem to set a very high polling rate for the mouse, making a wireless mouse like the one I'm using extremely laggy.
The polling rate can be changed removing the usbhid module and starting it again with a lower polling rate:
sudo modprobe -r usbhid && sudo modprobe usbhid mousepoll=2
seems to solve the problem.
This is of course not persistent after a reboot, and I'd like to know how to make it persistent. /etc/modules seems to not be able to remove modules, I've tried adding a
-r usbhid
usbhid mousepoll=2
to it, but is doesn't work. Any solution? Properly loading the module at start would be great, otherwise how to automatically run the line above with superuser privileges without asking for my password would be OK.
Thanks.
|
Try:
cat >> /etc/modprobe.d/usbhid.conf << "EOF"
options usbhid mousepoll=2
EOF
And, if applicable:
update-initramfs -u -k all
...this .conf file should set the option for you the first time the module is loaded, and be persistent.
Another option is to include the setting in the kernel command line: usbhid.mousepoll=2. You will need to update the grub (or other bootloader) configuration for this to persist.
Also, after the module is loaded, this will (probably) change the polling rate on the fly:
echo 2 > /sys/module/usbhid/parameters/mousepoll
| Remove and load module during boot |
1,492,509,841,000 |
I am aware of Apparmor and specifically how it can be used to limit a program's access rights where of the file-system permissions otherwise allow. What I'm less clear on is whether it's possible for Apparmor or any similar security module to completely override a program's access rights. Can they grant a program access to read/write/execute files that the user otherwise has no access to.
I'm asking for what the Linux Kernel will allow such a security module to do, not what existing security modules can be configured to do.
Can security modules completely override Linux Kernel's access model?
|
This doesn’t seem to be mentioned in the kernel’s LSM documentation, but no, security modules can’t completely override the kernel’s access model, they supplement it.
For example, checks before execution include those in do_open_execat, which checks the permissions; the LSM hooks are called later (look for security_). Other examples include all the functions in fs/namei.c which call functions like may_delete before the relevant LSM hooks.
| Can security modules completely override Linux Kernel's access model? |
1,492,509,841,000 |
I have added the following to my /etc/modules:
nfs
nfsv4
and this is the result after a reboot:
nfsv4 638976 0
nfs 294912 1 nfsv4
lockd 98304 1 nfs
fscache 368640 2 nfsv4,nfs
sunrpc 385024 4 nfsv4,lockd,nfs
But, if I install nfs-kernel-server, this is the result:
nfsv4 638976 0
nfs 294912 1 nfsv4
fscache 368640 2 nfsv4,nfs
nfsd 368640 13
auth_rpcgss 94208 1 nfsd
nfs_acl 16384 1 nfsd
lockd 98304 2 nfsd,nfs
grace 16384 2 nfsd,lockd
sunrpc 385024 20 nfsd,nfsv4,auth_rpcgss,lockd,nfs_acl,nfs
What am I not doing correctly to get the same kernel modules loaded that installing via "apt" gets me?
Update: this is the "pure" apt install output, the other output has my "/etc/modules" NFS line + APT mixed together.
nfsd 368640 9
auth_rpcgss 94208 1 nfsd
nfs_acl 16384 1 nfsd
lockd 98304 1 nfsd
grace 16384 2 nfsd,lockd
sunrpc 385024 16 nfsd,auth_rpcgss,lockd,nfs_acl
|
nfs and nfsv4 are the filesystem driver modules (the NFS client). nfsd is the NFS server module. The rest are their dependencies, such as auth_rpcgss which is needed to support Kerberos.
| Load NFS-Kernel-Server modules via /etc/modules |
1,492,509,841,000 |
I recently received the following error in my syslog:
syslog:Apr 28 09:59:02 vostrodell kernel: [ 883.401212] nouveau 0000:01:00.0: fb: trapped read at 0039824400 on channel 12 [3ed04000 systemd-logind[576]] engine 05 [PFIFO] client 08 [PFIFO_READ] subclient 01 [SEMAPHORE] reason 00000002 [PAGE_NOT_PRESENT]
So I went to the documentation:
https://nouveau.freedesktop.org/KernelModuleParameters.html#debug
and I tried adding the following file:
$ cat /etc/modprobe.d/nouveau.conf
# debug nouveau
options nouveau debug="PFIFO=debug"
However this is not being passed as expected:
# cat /sys/module/nouveau/parameters/debug
(null)
I understand that PFIFO is not listed under debug section on the documentation page, but should fall under the category of any engine (see above):
https://nouveau.freedesktop.org/KernelModuleParameters.html#config
I believe this is the correct engine to pass as kernel module parameter.
Did I misread the documentation ? What should be the correct way to track to gather some meaning full information about this bug (in case I reproduce it) ?
|
The actual issue was that nouveau is starting from initramfs.
To change load options for this kind of modules one need to run
sudo update-initramfs -u
to get the setting applied, otherwise no change are seen.
| Is PFIFO an engine in nouveau kernel? |
1,492,509,841,000 |
For the past week, I was working on a simplistic kernel module that creates a character device driver that allows the passing of messages between user and kernel space.
All good and nice, I found KEDR (https://github.com/euspectre/kedr) and I can now detect memory leaks.
However, the question stands: Is there a way to detect out of bounds accesses and any other errors such as Uninitialized Memory etc? In userspace programs, we might sometimes see a segfault, or we can use valgrind to try and detect most of these errors.
I tried to artificially write out of the bounds of an array and the OS does not complain.
|
KASAN is a close equivalent to memcheck, which is what you mean when you say valgrind.
It is The kernel address sanitizer [LWN.net 2014]. See also Software-tag-based KASAN [LWN.net 2018].
| How to detect memory safety errors in a linux kernel module? |
1,492,509,841,000 |
Is it possible to cause kernel panic by removing a device driver and then making a system call that uses that driver so that kernel goes in panic?
|
It is possible when driver is not properly removed and application tried to use. If driver is removed properly kernel will give error like driver not found but never crash(In 99.99% cases until it hit any bug).
| How to cause kernel panic by deleting a device driver (module)? |
1,492,509,841,000 |
I accidentally deleted my /lib/modules/<kernel version directory>.
Here's the full output of sudo rm -rfv /lib/modules/4.14.98+ : pastebin
Is there a way to restore the modules keeping the system online?
It is a raspberry pi sitting on an internal network.
|
You can use dpkg --search /lib/modules/<kernel version directory> to find what packages this directory (and inside) belong to, then use apt-get --reinstall install <list from before> to reinstall any affected package missing, thus restoring missing content.
In one liner this should be (remove the -d once sure of the effect):
apt-get -d --reinstall install $(dpkg -S /lib/modules/4.14.98+ | tr ',:' '\n\n' | head -n -1)
As I don't know well if RPi follows the usual kernel installation method (depmod etc.) you should then check that after this you can modprobe any random module (eg: the dummy module) not already loaded before considering everything is fine.
PS: in case of additional dkms modules, above won't track it, but you can then continue the "restoration" with dkms status to get a list and dkms install module/module-version -k 4.14.98+ to put back what's missing etc.
| Deleted /lib/modules/<kernel version> by mistake. How to recover? |
1,492,509,841,000 |
I run on Debian Stretch,my linux-kernel version is 4.14.13
Is this module never used(real loaded) in initramfs for desktop PC?
The context is for initramfs and I have a very slow usb storage device(3.7M vmlinuz take about 60s to loaded),If it never use in desktop PC,I want remove it from my initramfs.
Note simple test on my machine is not work bacause I want my initramfs work in most desktop PC.
$ sudo modinfo acard-ahci
filename: /lib/modules/4.14.13/kernel/drivers/ata/acard-ahci.ko
version: 1.0
license: GPL
description: ACard AHCI SATA low-level driver
author: Jeff Garzik
srcversion: 54FB6F53A7A13A663E876F4
alias: pci:v00001191d0000000Dsv*sd*bc*sc*i*
depends: libahci,libata
intree: Y
name: acard_ahci
vermagic: 4.14.13 SMP mod_unload modversions 686
$
|
ACard is the manufacturer of the ATP 8620 which this driver supports. The kernel module is automatically loaded on systems which require it.
Determining how likely your initramfs is to encounter one is rather difficult. I get the impression the ACard controller wasn’t particularly popular, but I wouldn’t go as far as saying it was never used in a desktop PC. However it seems safe to say you won’t find one in a PC built in the last four or five years.
| What do "ACard AHCI SATA low-level driver" meaning? What is "ACard"? [closed] |
1,492,509,841,000 |
I'm writing a kernel module. I can easily create a character device in /dev/ but I want to have 3 devices available to my user and it would be nice to put them all under a /dev/ subdirectory.
Possible example (exists on my openSUSE box):
# ls -l /dev/bsg
total 0
crw-rw---- 1 root root 252, 0 Jul 17 14:28 0:0:0:0
crw-rw---- 1 root root 252, 1 Jul 17 14:28 0:0:1:0
crw-rw---- 1 root root 252, 2 Jul 17 14:28 0:0:2:0
crw-rw---- 1 root root 252, 3 Jul 17 14:28 0:0:3:0
crw-rw---- 1 root root 252, 4 Jul 17 14:28 0:0:4:0
crw-rw---- 1 root root 252, 5 Jul 17 14:28 1:0:0:0
(I have looked at the bsg.c code but am at a loss to what "parent" the character devices are added to).
How can I do something similar?
|
I found a way that works for me, one that doesn't use udev rules (I'd rather do it programmatically). This is easier than I thought earlier.
alloc_chrdev_region for number of devices.
Create classes for each device (each with different names)
Set the classes' devnode field with your custom function ex: return kasprintf(GFP_KERNEL, "name/%d", global++);. This is where the naming happens. Udev should honor this function.
Create cdevs with cdev_init && cdev_add and set their fops.
Create devices with device_create (parent is NULL)
Note that there is no device hierarchy here, just independent devices which happen to be in the same /dev/ directory. The names specified in steps 2-5 will end up in /sys/.
| How to create multiple devices in a /dev/ subdirectory (kernel driver) |
1,492,509,841,000 |
I am using the following Kernel Device Driver.
/**
* @file ebbchar.c
* @author Derek Molloy
* @date 7 April 2015
* @version 0.1
* @brief An introductory character driver to support the second article of my series on
* Linux loadable kernel module (LKM) development. This module maps to /dev/ebbchar and
* comes with a helper C program that can be run in Linux user space to communicate with
* this the LKM.
* @see http://www.derekmolloy.ie/ for a full description and follow-up descriptions.
*/
#include <linux/init.h> // Macros used to mark up functions e.g. __init __exit
#include <linux/module.h> // Core header for loading LKMs into the kernel
#include <linux/device.h> // Header to support the kernel Driver Model
#include <linux/kernel.h> // Contains types, macros, functions for the kernel
#include <linux/fs.h> // Header for the Linux file system support
#include <asm/uaccess.h> // Required for the copy to user function
#define DEVICE_NAME "ebbchar" ///< The device will appear at /dev/ebbchar using this value
#define CLASS_NAME "ebb" ///< The device class -- this is a character device driver
MODULE_LICENSE("GPL"); ///< The license type -- this affects available functionality
MODULE_AUTHOR("Derek Molloy"); ///< The author -- visible when you use modinfo
MODULE_DESCRIPTION("A simple Linux char driver for the BBB"); ///< The description -- see modinfo
MODULE_VERSION("0.1"); ///< A version number to inform users
static int majorNumber; ///< Stores the device number -- determined automatically
static char message[256] = {0}; ///< Memory for the string that is passed from userspace
static short size_of_message; ///< Used to remember the size of the string stored
static int numberOpens = 0; ///< Counts the number of times the device is opened
static struct class* ebbcharClass = NULL; ///< The device-driver class struct pointer
static struct device* ebbcharDevice = NULL; ///< The device-driver device struct pointer
// The prototype functions for the character driver -- must come before the struct definition
static int dev_open(struct inode *, struct file *);
static int dev_release(struct inode *, struct file *);
static ssize_t dev_read(struct file *, char *, size_t, loff_t *);
static ssize_t dev_write(struct file *, const char *, size_t, loff_t *);
/** @brief Devices are represented as file structure in the kernel. The file_operations structure from
* /linux/fs.h lists the callback functions that you wish to associated with your file operations
* using a C99 syntax structure. char devices usually implement open, read, write and release calls
*/
static struct file_operations fops =
{
.open = dev_open,
.read = dev_read,
.write = dev_write,
.release = dev_release,
};
/** @brief The LKM initialization function
* The static keyword restricts the visibility of the function to within this C file. The __init
* macro means that for a built-in driver (not a LKM) the function is only used at initialization
* time and that it can be discarded and its memory freed up after that point.
* @return returns 0 if successful
*/
static int __init ebbchar_init(void){
printk(KERN_INFO "EBBChar: Initializing the EBBChar LKM\n");
// Try to dynamically allocate a major number for the device -- more difficult but worth it
majorNumber = register_chrdev(0, DEVICE_NAME, &fops);
if (majorNumber<0){
printk(KERN_ALERT "EBBChar failed to register a major number\n");
return majorNumber;
}
printk(KERN_INFO "EBBChar: registered correctly with major number %d\n", majorNumber);
// Register the device class
ebbcharClass = class_create(THIS_MODULE, CLASS_NAME);
if (IS_ERR(ebbcharClass)){ // Check for error and clean up if there is
unregister_chrdev(majorNumber, DEVICE_NAME);
printk(KERN_ALERT "Failed to register device class\n");
return PTR_ERR(ebbcharClass); // Correct way to return an error on a pointer
}
printk(KERN_INFO "EBBChar: device class registered correctly\n");
// Register the device driver
ebbcharDevice = device_create(ebbcharClass, NULL, MKDEV(majorNumber, 0), NULL, DEVICE_NAME);
if (IS_ERR(ebbcharDevice)){ // Clean up if there is an error
class_destroy(ebbcharClass); // Repeated code but the alternative is goto statements
unregister_chrdev(majorNumber, DEVICE_NAME);
printk(KERN_ALERT "Failed to create the device\n");
return PTR_ERR(ebbcharDevice);
}
printk(KERN_INFO "EBBChar: device class created correctly\n"); // Made it! device was initialized
return 0;
}
/** @brief The LKM cleanup function
* Similar to the initialization function, it is static. The __exit macro notifies that if this
* code is used for a built-in driver (not a LKM) that this function is not required.
*/
static void __exit ebbchar_exit(void){
device_destroy(ebbcharClass, MKDEV(majorNumber, 0)); // remove the device
class_unregister(ebbcharClass); // unregister the device class
class_destroy(ebbcharClass); // remove the device class
unregister_chrdev(majorNumber, DEVICE_NAME); // unregister the major number
printk(KERN_INFO "EBBChar: Goodbye from the LKM!\n");
}
/** @brief The device open function that is called each time the device is opened
* This will only increment the numberOpens counter in this case.
* @param inodep A pointer to an inode object (defined in linux/fs.h)
* @param filep A pointer to a file object (defined in linux/fs.h)
*/
static int dev_open(struct inode *inodep, struct file *filep){
numberOpens++;
printk(KERN_INFO "EBBChar: Device has been opened %d time(s)\n", numberOpens);
return 0;
}
/** @brief This function is called whenever device is being read from user space i.e. data is
* being sent from the device to the user. In this case is uses the copy_to_user() function to
* send the buffer string to the user and captures any errors.
* @param filep A pointer to a file object (defined in linux/fs.h)
* @param buffer The pointer to the buffer to which this function writes the data
* @param len The length of the b
* @param offset The offset if required
*/
static ssize_t dev_read(struct file *filep, char *buffer, size_t len, loff_t *offset){
int error_count = 0;
// copy_to_user has the format ( * to, *from, size) and returns 0 on success
error_count = copy_to_user(buffer, message, size_of_message);
if (error_count==0){ // if true then have success
printk(KERN_INFO "EBBChar: Sent %d characters to the user\n", size_of_message);
return (size_of_message=0); // clear the position to the start and return 0
}
else {
printk(KERN_INFO "EBBChar: Failed to send %d characters to the user\n", error_count);
return -EFAULT; // Failed -- return a bad address message (i.e. -14)
}
}
/** @brief This function is called whenever the device is being written to from user space i.e.
* data is sent to the device from the user. The data is copied to the message[] array in this
* LKM using the sprintf() function along with the length of the string.
* @param filep A pointer to a file object
* @param buffer The buffer to that contains the string to write to the device
* @param len The length of the array of data that is being passed in the const char buffer
* @param offset The offset if required
*/
static ssize_t dev_write(struct file *filep, const char *buffer, size_t len, loff_t *offset){
sprintf(message, "%s(%zu letters)", buffer, len); // appending received string with its length
size_of_message = strlen(message); // store the length of the stored message
printk(KERN_INFO "EBBChar: Received %zu characters from the user\n", len);
return len;
}
/** @brief The device release function that is called whenever the device is closed/released by
* the userspace program
* @param inodep A pointer to an inode object (defined in linux/fs.h)
* @param filep A pointer to a file object (defined in linux/fs.h)
*/
static int dev_release(struct inode *inodep, struct file *filep){
printk(KERN_INFO "EBBChar: Device successfully closed\n");
return 0;
}
/** @brief A module must use the module_init() module_exit() macros from linux/init.h, which
* identify the initialization function at insertion time and the cleanup function (as
* listed above)
*/
module_init(ebbchar_init);
module_exit(ebbchar_exit);
When I open the device driver in User Space, the dev_open() function is executed.
static struct file_operations fops =
{
.open = dev_open,
.read = dev_read,
.write = dev_write,
.release = dev_release,
};
static int dev_open(struct inode *inodep, struct file *filep){
numberOpens++;
printk(KERN_INFO "EBBChar: Device has been opened %d time(s)\n", numberOpens);
return 0;
}
I want to know who has open() the Device Driver node (/dev/ebbchar).
When a process calls the dev_open() function of the device driver, I want to debug the process name via printk().
What should I do?
|
Johan Myréen gave me the link below.
https://stackoverflow.com/questions/11915728/getting-user-process-pid-when-writing-linux-kernel-module
So I was able to debug as below.
static int dev_open(struct inode *inodep, struct file *filep){
numberOpens++;
printk(KERN_INFO "EBBChar: Device has been opened %d time(s)\n", numberOpens);
printk(KERN_INFO "Loading Module\n");
printk("The process id is %d\n", (int) task_pid_nr(current));
printk("The process vid is %d\n", (int) task_pid_vnr(current));
printk("The process name is %s\n", current->comm);
printk("The process tty is %d\n", current->signal->tty);
printk("The process group is %d\n", (int) task_tgid_nr(current));
printk("\n\n");
return 0;
}
In User Space, the following confirmation is made.
root@Test:~# ./ebbchar_open
EBBChar: Device has been opened 1 time(s)
Loading Module
The process id is 458
The process vid is 458
The process name is ebbchar_open
The process tty is -294157312
The process group is 458
Johan Myréen Thanks!
| I want to know which process open() the "Kernel Device Driver" |
1,492,509,841,000 |
When I trying this command modinfo fbtft I get this result:
modinfo: ERROR: Module fbtft not found.
But when I do checking, I have fbtft file in this location :
/lib/modules/3.18.1+/kernel/drivers/video/fbdev/fbtft
Do I have kernel support for fbtft or not? if not, how to add it?
My system is an arm-based computer(nanopi-m1) with Allwinner H3 sun8iw7p1 SoC and Debian Jessie OS.
This is the result of uname -r :
3.4.39-h3
|
/lib/modules/3.18.1+/kernel/drivers/video/fbdev/fbtft is a directory. modinfo fbtft or modprobe fbtft looks for a file called fbtft.ko, which should be in that directory.
The fbtft driver can either be compiled as a module or linked into the main kernel binary. If it's in the main kernel binary then there won't be a file under /lib/modules. But at runtime there will be a directory in sysfs, /sys/module/fbtft, containing various information about the driver.
Note that the driver you should be loading is actually fbtft_device. See the wiki for more information.
If the fbtft modules are not included in the kernel you're using, then you'll need to recompile them. But 3.4 is a pretty old kernel; the tbtft drivers were added in 4.0. So you should look for a more recent kernel. Debian jessie, the latest stable release, shipped with 3.16; that's almost recent enough but not quite. There are more recent kernels in the backports.
| Do I have kernel support for fbtft? |
1,492,509,841,000 |
Suppose I have a memory-mapped peripheral which can be read from or written to at some address, say 0x43C00000. I want to be able to read from that same memory location in my Linux OS in order to communicate with that peripheral. Since the address in question would be a physical address, I should be able to write a kernel module that can read from that address location.
In the kernel, if I have something like
#define BASE_ADDR 0x43C00000
#define OFFSET 4
int * mem_addr;
mem_addr = BASEADDR + OFFSET;
That, I think, should give me the pointer to the second writing block of the peripheral, at 0x43C00004. Printing
printk(KERN_INFO "%p\n", mem_addr)
seems to tell me this is right.
Now if I try to do something like
printk(KERN_INFO "%d\n", *mem_addr);
I would have thought that that should therefore read the data that is being written to memory by my peripheral, accomplishing what I was trying to do. But if I try putting a statement like this into a module, Linux kills it. Looking at my /var/log/messages I see this:
Oops: 0000 [#1] SMP
Modules linked in; TEST_MOD(0+) ...
followed by a bunch of information about register states. So I'm apparently not allowed to just read memory like that. Is there some way to grant access to a kernel module to read memory?
|
You need to set up a kernel virtual address mapping for the location e.g.
mem_addr = ioremap_nocache(BASEADDR + OFFSET, SIZE);
(you appear to have asked the same question twice - see enter link description here).
| How to allow access to memory in a kernel module? [closed] |
1,492,509,841,000 |
I'm trying to build IBCS (source here) on Ubuntu 15.10 (Linux 4.2.35).
This module is obviously pretty old, because its CONFIG.i386 file gives gcc an option -m486, which doesn't exist anymore, but changing to -march=native seems to work OK.
The file emulate.c contains #includes like:
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <asm/uaccess.h>
On my system, only linux/version.h exists. The following seems to work, however:
#include "/usr/include/valgrind/config.h"
#include "/usr/include/sepol/module.h"
#include <linux/version.h>
#include </usr/src/linux-headers-4.2.0-35/include/linux/uaccess.h>
(YMMV, of course, if you don't have sepol.)
That works, except for /usr/src/linux-headers-4.2.0-35/include/linux/uaccess.h, the top of which has
#include <asm/uaccess.h>
Which is not found.
I don't seem to have an asm folder in /usr/include or /usr/include/linux. I do have an /usr/include/asm_generic, but it doesn't have uaccess.h.
My questions are:
Why do the modern kernel headers contain references to (apparently) nonexistent files, rather than providing them itself?
Where can I get a version of asm/uaccess.h and the other headers needed for compilation?
|
iBCS is obsolete, has been for a long time. Too much has changed in the Linux innards to there be any chance for this to still compile, even on an early 4.x kernel. Today it is linux-abi, but that is dead since 2013. Perhaps one of the binfmt modules does the job today.
| Why do the Linux kernel headers contain references to nonexistent headers? |
1,492,509,841,000 |
I recently installed debian 8 on my machine, which went fine. When I tried to install the vmware player 2.5.5-328052 the vmware software complains about not being able to find the linux headers matching my running kernel. uname -r yields 3.16.0-4-686-pae.
So I installed the headers (and gcc) and here is how it looks:
olav@carina:~/Downloads$ ls -l /usr/src/
insgesamt 80024
drwxr-xr-x 2 root root 4096 Feb 28 19:43 linux-config-3.16
drwxr-xr-x 4 root root 4096 Mär 1 10:40 linux-headers-3.16.0-4-686-pae
drwxr-xr-x 4 root root 4096 Mär 1 10:40 linux-headers-3.16.0-4-common
lrwxrwxrwx 1 root root 24 Nov 22 20:32 linux-kbuild-3.16 -> ../lib/linux-kbuild-3.16
-rw-r--r-- 1 root root 81928908 Jan 17 20:41 linux-source-3.16.tar.xz
But still, vmware does not find the headers.
What am I doing wrong? What precisely is vmware looking for?
Thank you, Olav
|
The reason is that, in some versions of the Linux kernel, the version.h file needed by the VMware Tools installer have been relocated from /usr/src/linux-headers-$(uname -r)/include/linux to /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux, and the installer has not been updated to handle that.
The solution would be to create a symbolic link to version.h at the location where VMware Tools installer expects it.
ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h
| Linux Headers not found for VMWare Player |
1,492,509,841,000 |
I'm having a weird problem. I've done some hacking based on another person's work to backport support for the internal keyboard on a MacBook Pro 11,5 into kernel 3.19. My GitHub source can be found here.
I've done everything I can to ensure that it's as close to kernel 4.2 as possible while still being able to compile and work as expected on 3.19.
However, while booting into 4.2 gives me perfect functionality working as expected, my module doesn't seem to do anything. Existing Apple devices work as expected, but I'm still having the same problems with my built-in keyboard.
The problems are based around the fact that the function key doesn't work, and therefore I can't use my media keys. I've also done sanity testing to make sure that other Apple keyboards do work (tested with Apple wired and wireless keyboard and both work properly).
Is there a way for me to validate that my keyboard is being bound to the right driver?
The USB id for the device is 05ac:0274, and a config line can be found for that device in hid-ids.h:147 and in hid-apple.c:553-554. I'm convinced that it's just not picking up the device, because even with the hid-apple module removed, my built-in keyboard works though the other ones don't.
How can I debug what's happening and why my built-in keyboard isn't getting bound to the hid-apple module?
EDIT: I was able to get my keyboard bound to the right driver using the following:
# unbind everything matching 05AC:0274 from hid-generic
for dev in `ls /sys/bus/hid/drivers/hid-generic/ | egrep 05AC\:0274`; do
echo -n $dev | sudo tee /sys/bus/hid/drivers/hid-generic/unbind
done
# bind everything matching 05AC:0274 to hid-apple
for dev in `ls /sys/bus/hid/devices/ | egrep 05AC:0274` ; do
echo -n $dev | sudo tee /sys/bus/hid/drivers/hid-apple/bind
done
The problem remains: how do I force a given USB id to associate with a given driver? I'll accept the given answer below, but I'm still looking for a solution...
|
There is an excellent answer here. The short answer is the command usb-devices (available for most distros in a package called usbutils or something similar) will should give you the info you want on the current driver each usb device is using.
| Determine which module is bound by a HID device? |
1,424,048,543,000 |
I've used Buildroot to build a minimal operative system. During the configuration step with the menuconfig utility I specified to install I2C tools. The option was is
Target Package -> Hardware handling -> i2c-tools
But when I load the corresponding module I get the following error:
$sudo modprobe i2c-dev
modprobe: module i2c-dev not found in modules.dep
Furthermore, the list in the modules.dep file is empty.
$ cat /lib/modules/$(uname -r)/modules.dep
$
I have probably missed something important.
Do I have to manually copy the kernel modules from the Buildroot installation folder to the target system? How to make the i2c tools working?
|
From what I understand, Target Package -> Hardware handling -> i2c-tools refers to user space i2c utilities.
What you miss is kernel space i2c modules, you need to add them in make linux-menuconfig.
| Buildroot - missing i2c kernel modules |
1,424,048,543,000 |
I have been a Windows kernel developer for many years. Now I start to develop Linux kernel modules.
To begin with, I installed kernel-devel under /usr/src/kernels/$(uname -r). However, after checking the installation folder, I am confused because there seem a lot of seemingly useless folders and files inside the directory. Many folders are empty except for two files: Kconfig and Makefile.
Under Windows, to develop kernel device drivers, I just need an include folder containing all necessary header files, and an lib folder containing necessary libraries to link.
Under Linux, I can't understand why there are so many seemingly useless folders.
Any explanations?
|
The kernel-devel package in Fedora and other Red Hat derivatives does not contain the full kernel source, just headers for public interfaces and makefiles needed for driver development. Most headers can be found under /usr/src/kernels/$(uname -r)/include/ and some architecture specific headers, e.g. for x86 under /usr/src/kernels/$(uname -r)/arch/x86/include/.
The directories with Kconfig and Makefile are not useless, you only don't see the complete picture because you don't have the entire kernel source (which you typically wouldn't need for driver development anyway).
| Why does kernel-devel contain so many "empty" directories? |
1,424,048,543,000 |
I have to load a few additionals modules. One of them generates /dev/knem file. I have to set the permission to 0666, so a basic chmod 0666 /dev/knem works, but I would like to assign it directly at boot time.
Where shall I write the config so that it is directly set by the kernel when it loads the module?
Thanks in advance
|
I might be wrong, but can't you use udev rules, to assign 0666 permissions when /dev/knem is mounted ?
http://www.reactivated.net/writing_udev_rules.html#syntax
Controlling permissions and ownership
udev allows you to use additional assignments in rules to control ownership and permission attributes on each device.
The GROUP assignment allows you to define which Unix group should own the device node. Here is an example rule which defines that the video group will own the framebuffer devices:
KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"
The OWNER key, perhaps less useful, allows you to define which Unix user should have ownership permissions on the device node. Assuming the slightly odd situation where you would want john to own your floppy devices, you could use:
KERNEL=="fd[0-9]*", OWNER="john"
udev defaults to creating nodes with Unix permissions of 0660 (read/write to owner and group). If you need to, you can override these defaults on certain devices using rules including the MODE assignment. As an example, the following rule defines that the inotify node shall be readable and writable to everyone:
KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666"
A step-by-step on creting UDEV rules can be found in this post: http://ubuntuforums.org/showthread.php?t=168221
| set permission 0666 on /dev files at boot time |
1,424,048,543,000 |
In the german Ubuntu-Wiki it says, that the name of a blacklist in modprobe.d can be chosen as prefered but the filename has to begin with "blacklist-". Is that right? Because in a forum I read a blacklist was named "broadcom.conf". Will this work?
|
From the Red Hat documentation it would appear the name of the file containing "blacklist" is optional.
36.3.2. Blacklisting a driver, specifically step 6:
6) Create a new file under /etc/modprobe.d/ that contains the command blacklist name_of_driver. Give the file a descriptive name that will help you find it in future, and use the filename extension .conf. For example, to continue to blacklist the driver foobar when the root device is mounted, run:
$ echo "blacklist foobar" >> /mnt/sysimage/etc/modprobe.d/blacklist-foobar.conf
Looking through several of my systems I could find no example where the command blacklist was contained in a file other than ones named blacklist-.....
I'd try it but I'd expect it to work in any file name. The command blacklist ... would seem to be what's important.
| Does modprobe.d blacklist always need the prefix "blacklist-"? |
1,424,048,543,000 |
I am using Gentoo, with kernel 2.6.30, and I tried to load a module with modprobe usbcore, but it fails with modprobe: module 'usbcore' not found.
However, I can find a directory with that name in the directory /sys/module/. What is wrong here?
|
You can check whether the module you are trying to insert is present or not using
$ modprobe -l | grep usbcore
Generally all the modules are present in the path /lib/modules/<kernel-version>/kernel/
If present, you can then insert the module using modprobe or insmod command.
$ insmod <complete/path/to/module>
EDIT: If modprobe -l option is not there, you can run the following find command to list all the modules:
root@localhost# find /lib/modules/`uname -r` -name '*.ko'
| How to load a module in Gentoo? |
1,424,048,543,000 |
I have a sony VPCZ12 laptop. It has those dual video cards that are a pain to get working in linux. The new 2.6.35 kernel is supposed to support that with the vga_switcheroo module which is supposed to be located in /sys/kernel/debug on >2.6.35.
The problem is that when I boot my laptop, it freezes at a blackscreen unless I boot with options i915.nomodeset=0. It won't boot into X, but I can get to a terminal which is fine. But then vga_switcheroo isn't in /sys/kernel/debug.
Is this a ubuntu bug on how the kernel is compiled? Or is it because I have to boot with i915.nomodeset?
The livecd boots into X just fine, but I've never found a way to get X working on the installation. There's a lot of information about linux on the z12 but most of it is either outdated, doesn't work, or just plain doesn't make any sense
|
You need to have a kernel with vga_switcheroo enabled and KMS, i.e. kernel mode setting, active (which you haven't as you boot with nomodeset).
To check if vga_switcheroo is enabled in the kernel, have a look into the Ubuntu config of your kernel. You should find it in /boot with a name along the lines of /boot/config-2.6.35-XX-generic with XX some number corresponding to your kernel.
If it is not enabled, you find a custom Ubuntu kernel with vga_switcheroo enabled at http://www.ramoonus.nl/2010/08/linux-kernel-2-6-35-installation-guide-for-ubuntu-linux/
| vga_switcheroo not in /sys/kernel/debug in 2.6.35-22 (kubuntu maverick) |
1,424,048,543,000 |
I'm trying to build KVM and I'm having trouble figuring out where I went wrong. It builds fine, I'm 99% sure I'm cloning the correct kernel tag in git, but it doesn't load.
I'm running Ubuntu 22.04, with HWE. Here's the relevant info:
user@computer$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
user@computer$ hwe-support-status --verbose
Your Hardware Enablement Stack (HWE) is supported until April 2027.
user@computer$ uname -a
Linux computer 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
And no SecureBoot:
$ mokutil --sb-state
SecureBoot disabled
I followed the KernelGitGuide to clone a copy of Jammy and I targeted the tag: Ubuntu-hwe-6.5-6.5.0-28.29_22.04.1 as this is the one that matches my uname -a output and is HWE. My clone command:
git clone --branch Ubuntu-hwe-6.5-6.5.0-28.29_22.04.1 --depth 1 git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy kernel
To build the kernel I run:
cp /boot/config-6.5.0-28-generic ./kernel/.config
cp /usr/src/linux-headers-6.5.0-28-generic/Module.symvers ./kernel/
make -C ./kernel/ prepare
make -C ./kernel/ modules_prepare
make -C ./kernel/ M=arch/x86/kvm/
I install the built files to /lib/modules/6.5.0-28-generic/updates/mykvm Then I run sudo depmod -a 6.5.0-28-generic, sudo rmmod kvm-intel kvm, and sudo modprobe kvm-intel
modprobe output:
$ sudo modprobe kvm-intel
modprobe: ERROR: could not insert 'kvm_intel': Exec format error
Full dmesg error:
module kvm: .gnu.linkonce.this_module section size must match the kernel's built struct module size at run time
Any insight would be greatly appreciated.
|
The answer turned out to be here: https://imil.net/blog/posts/2022/build-a-single-in-tree-linux-kernel-module-debian--clones/
I'll detail the steps below since I targeted linux 6.5.0 instead of 5.4.0 like the article (though that is literally the only change to the commands).
Install sources. apt-get source linux-source- does NOT work apparently.
sudo apt install linux-source-6.5.0 linux-headers-$(uname -r)
tar jxvf /usr/src/linux-source-6.5.0.tar.bz2
cd linux-source-6.5.0
Build
cp /boot/config-$(uname -r) .config
make oldconfig scripts prepare modules_prepare
cp /usr/src/linux-headers-$(uname -r)/Module.symvers .
make -C . M=arch/x86/kvm
Test
sudo rmmod kvm-intel kvm
sudo insmod arch/x86/kvm/kvm.ko
sudo insmod arch/x86/kvm/kvm-intel.ko
After these tweaks to my build system I had KVM loading without the original error. If you see errors unknown symbols in dmesg, make sure your loading kvm.ko first and then kvm-intel.ko.
| Trouble building KVM from source for Ubuntu 22.04. section size must match the kernel's |
1,424,048,543,000 |
I'm trying to load the fuse kernel module but for some reason it seems like it's not getting loaded. But I also don't get any error message. Can someone explain to me what's going on?
root@my-host:~# modprobe fuse
root@my-host:~# echo $?
0
root@my-host:~# lsmod | grep fuse
root@my-host:~# modinfo fuse
modinfo: ERROR: Module fuse not found.
root@my-host:~# ls /lib/modules/$(uname -r)/kernel/fs/fuse/
cuse.ko
root@my-host:~#
I'm on a cloud VM:
root@my-host:~# uname -r
4.15.0-213-generic
root@my-host:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
I also rebooted the host before I ran these commands to make sure the correct kernel is running.
EDIT: In response to the comments I ran these commands:
root@my-host:~# grep fuse /lib/modules/$(uname -r)/modules.builtin
kernel/fs/fuse/fuse.ko
root@my-host:~# systemd-detect-virt
kvm
|
Generally, if loading a module succeeds but that module doesn’t appear in lsmod’s output, it’s because the module is built-in — i.e. it’s part of the main kernel image and is always available¹.
To check whether that’s the case, look in /lib/modules/$(uname -r)/modules.builtin:
grep fuse /lib/modules/$(uname -r)/modules.builtin
If this shows a kernel module path matching the module you expect, it means the corresponding “module” is built-in.
¹ Many built-in modules can still be disabled if necessary, see disable kernel module which is compiled in kernel (not loaded).
| modprobe fuse doesn't seem to load module |
1,424,048,543,000 |
I am having some issues with a DP83826 PHY and therefore I want to read some configuration registers. I have used mdio-tool and mii-diag for it, but I just realized that I can only read the first 32 registers.
mii-diag -v (verbose) displays the first 32 registers (which might not be a coincidence) and if I use mdio-tool with an address beyond 0x1F, the address gets shifted to stay within the 0..1F range. I had a look at the code of mdio-tool and it does not limit the register address at all and I also hacked mii-diag -v a bit to get more than 32 registers and it also returns the first 32 registers again and again. So it seems that the limitation is somewhere else, but I have still not found where. I am now trying to find out if the API or the device driver is causing this issue.
I have also tried ethtool -d eth0 but it only dumps the GMAC and DMA registers.
How to read/writte PHY MII registers beyond 0x1F in Linux?
|
I figured out how it works:
The basic standard MDIO address consists of 5 bits and therefore only the [0..32] range can be accessed directly. For devices that offer additional registers beyond the basic standard, there is an MDIO
Manageable Device (MMD) indirect method (defined in IEEE 802.3ah draft for Clause 22) for accessing the extended register set.
In the end that is nothing else as an indirect access through a couple of registers in the base range. In my particular case (and as pointed by @Murray Jensen), REGCR (0x0D) and ADDAR (0x0E) are used for that purpose. The addresses and the bit fields within the registers may (and probably will) vary from one chip to another, but the mechanism should be rather similar.
| Reading PHY MII registers beyond 0x1F |
1,424,048,543,000 |
I'm currently trying to install netmap, which needs to modify the kernel. However, after installing the kernel headers, I noticed that in /lib/linux-kbuild-5.10/scripts, some of the scripts that are expected to be there are missing. This includes pahole-flags.sh as well as mkmakefile and as a result I get "not found" and "No such file" errors respectively.
I found this recent bug report, stating that this is a regression on stable. It also states, that it has been fixed for a previous version via this commit. However, all this commit does is modifying the make file.
Is there an easy fix like "just copy the script from repo xy into this directory" or do I need to recompile/upgrade parts of the kernel somehow? I'm not so versatile using linux systems yet, so any help is appreciated.
|
The commit you referred to modifies the part of Makefile that is used for building the Debian kernel headers packages (linux-headers-<kernel version>-<package version>_<arch>.deb). In other words, it commit makes the pahole-flags.sh script be included to the appropriate package in future kernel versions.
Since the kernel configuration & build process does not appear to make any changes to the script, you could just grab the script from the Linux kernel source of the appropriate version (e.g. here for 5.10 series kernels) and place it into your /lib/linux-kbuild-5.10/scripts where netmap expects to find it.
The same applies to the mkmakefile script (here for 5.10 series kernels).
However, you should be aware that the mkmakefile's functionality that was needed for building the kernel was merged into the main kernel Makefile at about the 5.15 kernel series (here's the diff) and the mkmakefile ceased to exist as a separate script. So if netmap still relies on that, it will need to implement the functionality it needs on its own. However, it seems that even in kernel version 5.10, mkmakefile just outputs a two-line Makefile, and one of those lines is just a comment, so it should be trivial to replace mkmakefile.
| How can I fix scripts in /lib/linux-kbuild on Debian 11: pahole-flags.sh not found |
1,424,048,543,000 |
we recently have upgraded to a new industry PC from Vecow/Plugin and to Ubuntu 20.04 from 18.04. From the BIOS (build date BIOS ~17.02.2022) and the IO chip according to it is a SuperIO 8786:
https://github.com/huchanghui123/ITE-SuperIO/blob/master/IT8786E-I_B_V0.2.pdf
This port seems to be mapped generic (ACPI/BIOS) as 16550A-compatible COM port PNP0501.
We have a PPS device connected to one (but tried all) serial/COM/RS232 port we have available (DCD Pin, we also connected GND). Which we attach to with ldattach pps /dev/ttyS0 and want to integrate with chrony again.
ldttach works and also ppstest. What happens is that after a short time (30-100 s), which seems to be rather random, it often fails to fetch the time stamps and times out and never recovers. But after deattaching and reattaching the ldisc it works again (for some time).
Instead of our PPS device we also tried a function generater at 1 Hz (pulse or duty cycle 50%, 1ms, 10ms, 100 and 200 ms). The Voltage level of our device which worked on the previous PC is 0 - ~3.7V. We set the function generator to operate within RS-232 at +/-3.7, 5, 6.6 and 10V (upper limit of our generator). Issue is the same.
We are on the HWE generic kernel btw (so 5.13). On the old PC it worked (even live via Ubuntu 20.04). We also tried an Ubuntu 22.04 live image (kernel 5.15) and Fedora 35 but it fails there too. Also on our second identical PC.
Anybody experienced something similar or has a clue how to debug it further? Especially to rule out a driver error (or any other HW error).
Thanks!
|
In our case there was an issue in the BIOS. An update from our vendor fixed it.
| PPS on focal/20.04 timed out and never recovers |
1,424,048,543,000 |
I'm having trouble to compile kernel modules with KBUILD_CFLAGS_MODULE with new kernel. The compiler shows me a weird error. Such builds used to work with my older kernel (5.5) but does not work anymore with my 5.16 kernel.
Here is a minimal reproducible example:
Dummy module:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
static int __init lkm_example_init(void) {return 0;}
static void __exit lkm_example_exit(void){}
module_init(lkm_example_init);
module_exit(lkm_example_exit);
Makefile:
TARGET ?= test
obj-m += ${TARGET}.o
KBUILD_CFLAGS_MODULE := "-O1" "-mcmodel=medium" # Examples
.PHONY: all
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
If I comment out the KBUILD_CFLAGS_MODULE line, my build work.
However, if uncommented my compilation fails with this error message:
make TARGET=test
make -C /lib/modules/5.16.0/build M=/home/user/test modules
make[1]: Entering directory '/home/user/linux'
CC [M] /home/user/test/test.o
In file included from ./include/linux/module.h:22,
from /home/user/test/test.c:2:
./include/linux/module.h:183:39: error: expected ',' or ';' before 'KBUILD_MODFILE'
183 | #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
| ^~~~~~~~~~~~~~
./include/linux/moduleparam.h:26:47: note: in definition of macro '__MODULE_INFO'
26 | = __MODULE_INFO_PREFIX __stringify(tag) "=" info
| ^~~~
./include/linux/module.h:183:21: note: in expansion of macro 'MODULE_INFO'
183 | #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
| ^~~~~~~~~~~
./include/linux/module.h:230:34: note: in expansion of macro 'MODULE_FILE'
230 | #define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license, _license)
| ^~~~~~~~~~~
/home/user/test/test.c:4:1: note: in expansion of macro 'MODULE_LICENSE'
4 | MODULE_LICENSE("GPL");
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:287: /home/user/test/test.o] Error 1
make[1]: *** [Makefile:1846: /home/user/test] Error 2
make[1]: Leaving directory '/home/user/linux'
make: *** [Makefile:6: all] Error 2
Do you know what could be the root cause of this issue?
|
It’s not obvious from the documentation, but you’re supposed to add to KBUILD_CFLAGS_MODULE. Change your declaration to
KBUILD_CFLAGS_MODULE += "-O1" "-mcmodel=medium" # Examples
and the build will work.
The root cause of the build failure is that KBUILD_CFLAGS_MODULE lost its initial -DMODULE contents, which messed up the MODULE_FILE declaration.
| Can't compile Kernel module with KBUILD_CFLAGS_MODULE |
1,424,048,543,000 |
I've modified a kernel module (qcaspi) and recompiled it, however my modifications aren't being called (checked dmesg) when the OS boots up.
Instead, the old kernel module is being run.
If I reload the module with rmmod and modprobe then my changes DO get called.
What's going on there? Where is the OS finding the old module if I modified it and now have a new .ko file?
|
Thanks to the comments I was able to find a solution.
update-initramfs -v -u
This updates the archived kernel modules, the -v is for the verbose option.
Takes a few seconds but once done, I can restart my OS and my new driver gets called right away, instead of the older archived version :).
| Custom Kernel module not being loaded |
1,424,048,543,000 |
Background
I'm trying to download about 150GB to a newly-created Linux box (AWS EC2) with 100gbps network connection at full speed (12.5GB/s) or close to that. The network end is working well. However, I'm struggling to find anywhere on the box that I can put all the data fast enough to keep up, even though the box has 192GB of RAM.
My most successful attempt so far is to use the brd kernel module to allocate a RAM block device large enough, and write into that in parallel. This works at the required speed (using direct io) when the block device has already been fully written to, for example using dd if=/dev/zero ...
Unfortunately, when the brd device is newly created, it will only accept a write rate of around 2GB/s.
My guess is that this is because brd hooks into 'normal' kernel-managed memory, and therefore when each new block is used for the first time, the kernel has to actually allocate it, which it does no faster than 2GB/s.
Everything I've tried so far has the same problem. Seemingly, tmpfs, ramfs, brd, and everything else that provides RAM storage hooks into the normal kernel memory allocation system.
Question
Is there any way in Linux to create a block device out of real memory, without going through the normal kernel's memory management?
I'm thinking that perhaps there is a kernel module out there that will split off an amount of memory at boot time, to be treated like a disk. This memory would not be considered normal memory to the kernel and so there would be no issue with it wanting to use it for anything else.
Alternatively, is there some way to get the kernel to fully initialise a brd ramdisk (or similar) quickly? I tried writing to the last block of the disk alone, but unsurprisingly that didn't help.
Non-RAM alternative
In theory, a RAID of NVMe SSDs could achieve the required write speed, although it seems likely there would be some kind of bottleneck preventing such high overall I/O. My attempts to use mdadm RAID 0 with 8 NVMe SSDs have been unsuccessful, partly I think because of difficulties around block sizes. To use direct io and bypass the kernel's caching (which seems necessary), the only block size that can be used is 4096, and this is apparently far too small to make efficient use of the SSDs themselves. Any alternative here would be appreciated.
Comments
I know 2GB/s sounds like a lot, and it only takes a couple of minutes to download the lot, but I need to go from no EC2 instance at all to an EC2 instance with 150GB loaded in less than a minute. In theory it should be completely possible: the network stack and the physical RAM are perfectly capable of transferring data that fast.
Thanks!
|
On a tmpfs filesystem I can copy 64 files of 1.6 GB (in total 100GB) in 7.8 sec by running 64 jobs in parallel. That is pretty close to your 100 Gbit/s.
So if you run this in parallel (meta code):
curl byte 1G..2G | write_to file.out position 1G..2G
ẁrite_to could be implemented with mmap.
Maybe you can simply write to different files, use loop-devices, and use RAID in linear mode:
https://raid.wiki.kernel.org/index.php/RAID_setup#Linear_mode
If you control both ends, then set up the source as 150 1 GB files used as loop-devices and RAID in linear mode. Then you should copy those in parallel and set up the RAID linear again.
| Allocate RAM block device faster than Linux kernel can normally allocate memory |
1,424,048,543,000 |
I am writing a driver code for first time. I have checked many resources which state that the initialization function for a kernel module is either init_module() or any another function that is specified using module_init() macro. And this initialization function is called when a kernel module is loaded.
But I could not find any information about what happens when initialization function doesn't exist in a Loadable kernel module and is tried to load.
What would be the scenario if the kernel module is in-tree and doesn't have initialization function??
---Thanks in advance..
|
Modules don’t need to have an initialisation function, do_init_module handles its absence:
/* Start the module */
if (mod->init != NULL)
ret = do_one_initcall(mod->init);
Such modules can be unloaded without an exit function either (as opposed to modules with an initialisation function, which are permanent if they don’t have an exit function).
When modules are built-in, initialisation functions become __initcall functions which are identified at link time; their absence doesn’t cause any problem either.
| Will the Kernel module load when there is no initialization function? |
1,424,048,543,000 |
Are the microcodes in /lib/firmware/amd-ucode/ updated live after each boot?
|
How/when
It depends. AMD microcode:
Can be embedded into the kernel image (vmlinuz)
Can be loaded via an initrd
Can be loaded during a normal boot.
This wiki article should answer your question: https://wiki.archlinux.org/index.php/microcode
In all three instances you can reload it manually once you have updated it.
| How/when are files in /lib/firmware/amd-ucode/ loaded and applied? |
1,424,048,543,000 |
So, I'm trying to update the bios of my HP Z230 workstation (don't ask why..).
It comes as a one-two punch: the 'xwbios' kernel module as a source rpm named hp-lxbios-mod..src.rpm and the 'lxbios' application rpm hp-lxbios..rpm that does the actual updating.
Here's the link to downlad the rpm the file sp97093.tgz is under the BIOS tab on that page. After unpacking, under the lxbios folder you'll find the two rpms and the readme file describing rpm install procedure.
I am on Arch and I've given up trying to use some rpm tool and I am trying to install the software (or at least compile it) manually (and maybe build a PKGBUILD later).
Kernel Module
I have unpacked the hp-lxbios-mod..src.rpm which contains the rpm .spec file and another .tz with the actual stuff:
hp-lxbios-mod/mymod.c
hp-lxbios-mod/mymod.mod.c
hp-lxbios-mod/xwbios.c
hp-lxbios-mod/xwbios.mod.c
hp-lxbios-mod/xwbios.h
hp-lxbios-mod/Makefile
hp-lxbios-mod/mkit
The Makefile looks (...) straightforward
#obj-m := mymod.o
obj-m := xwbios.o
clean:
rm -f *.o *.ko
install:
mkdir -p /opt/hp/hp-lxbios/xwkernel
cp xwbios.ko /opt/hp/hp-lxbios/xwkernel/
the mkit is a bash script which finds where the kernel source is and launches make
#!/bin/bash
if [ -d /lib/modules/`uname -r`/build ]; then
ksrc=/lib/modules/`uname -r`/build
elif [ -d /lib/modules/`uname -r`/source ]; then
ksrc=/lib/modules/`uname -r`/source
else
echo "*** mkit: Error - unable to define kernel source location"
exit -1
fi
echo "Kernel source dir is $ksrc"
# Setup kernel build of xwkernel module
rm -f $ksrc/xwkernel
ln -s /opt/hp/hp-lxbios/xwkernel $ksrc/xwkernel
make -C $ksrc M=$PWD modules
make launches fine but I'm immediatly met with a compilation error
Kernel source dir is /lib/modules/5.3.6-arch1-1-ARCH/build
make: Entering directory '/usr/lib/modules/5.3.6-arch1-1-ARCH/build'
CC [M] /home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.o
/home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.c:125:23: error: initialization of ‘long int (*)(struct file *, unsigned int, long unsigned int ’ from incompatible pointer type ‘int (*)(struct inode *, struct file *, unsigned int, long unsigned int)’ [-Werror=incompatible-pointer-types]
125 | .unlocked_ioctl = xwbios_ioctl,
| ^~~~~~~~~~~~
/home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.c:125:23: note: (near initialization for ‘xwbios_fops.unlocked_ioctl’)
/home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.c: In function ‘xwbios_exit’:
/home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.c:666:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
666 | if (pReqPwdBuffer)
| ^~
/home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.c:668:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
668 | if (pRepsetGetInfo != NULL)
| ^~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:281: /home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod/xwbios.o] Error 1
make: *** [Makefile:1626: _module_/home/gls/Downloads/bios_iupdate/lxbios/hp-lxbios-mod] Error 2
make: Leaving directory '/usr/lib/modules/5.3.6-arch1-1-ARCH/build'
that I don't really know how to fix. I am thinking there is some compatibilty issue, maybe a missing flag I might put in there?
Actual flashing of the bios
Coming soon..
|
When I saw it required a custom kernel module and how old it was, I didn't bother trying to get it to compile with a modern kernel.
I decided to try installing it via a FreeDOS USB drive, which turned out to be a waste of time as well.
Instead, after unnecessarily putting together a boot disk, I ended up using the the option in the System Setup utility.
Extract the tarball: tar xvf sp100126.tgz
Place the flash image (eg DOS Flash/J61_0396.bin) at the root of a FAT formatted USB drive. (I actually copied the whole DOS Flash/ directory to the root of the thumb drive, so I'm not sure whether other files like flshuefi.cpu might be necessary as well.)
Boot into the System Setup utility (F10 at boot, or ESC to get the menu first).
Go to File -> Flash System ROM
Select USB drive. On a Z620 at least, the USB drive must be plugged into one of the black USB 2.0 ports. Presumably you could use a FAT formatted partition on an internal hard drive instead if that is more convenient.
Grab a cup of coffee, and come back to find
| Updating HP bios (that comes packaged as rpm) |
1,424,048,543,000 |
I am building a custom Alpine image based on isolinux.
Basically, I am squashing rootfs, and mounting it as overlayfs.
Bootloader does its job fine, kernel loads, but I am stuck at initramfs. Let say I have the following:
#!/bin/sh
export PATH=/sbin:/usr/sbin:/bin:/usr/bin
/bin/busybox --install -s
rescue_shell() {
echo "Something went wrong. Dropping you to a shell."
#/bin/busybox --install -s
/bin/sh || exec /bin/busybox sh
}
mount -t sysfs sysfs /sys
mount -t proc proc /proc
mkdir -p /dev/pts
mount -t devtmpfs -o exec,nosuid,mode=0755,size=2M devtmpfs /dev 2>/dev/null \
|| mount -t tmpfs -o exec,nosuid,mode=0755,size=2M tmpfs /dev
[ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
[ -d /dev/pts ] || mkdir -m 755 /dev/pts
mount -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
# shared memory area (later system will need it)
[ -d /dev/shm ] || mkdir /dev/shm
mount -t tmpfs -o nodev,nosuid,noexec shm /dev/shm
/bin/sh
# other code left for simplicity
So once I enters /bin/sh, I don't have any modules loaded, especially I am meaning for block devices, /dev/sda, /dev/sr0, which I need to mount and then extract squashed image, and mount overlay.
Listing /proc/partitions gives me only ram[0-15] devices, which make sense since after boot it's loaded into RAM.
So, my question would be, is there any way that devices gets probed based on available hardware? I have tried with mdev as well, but still can not get my block devices. Proper mdev.conf is there, and tests are performed in VirtualBox.
Thank you.
|
You could try your luck with modalias as exposed through the sysfs interface.
See for example https://patchwork.openembedded.org/patch/148854/ which suggests:
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
mdev -s
find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
Note that I haven't tested this myself. Also this doesn't seem to be using BusyBox modprobe, which probably does not support -ab. Still, it might be worth checking out what your /sys looks like in early initramfs.
More links regarding modalias:
https://wiki.archlinux.org/index.php/Modalias
http://people.skolelinux.org/pere/blog/Modalias_strings___a_practical_way_to_map__stuff__to_hardware.html
How to assign USB driver to device
| How to autoprobe block devices in initramfs? |
1,424,048,543,000 |
Why do I want this?
I use the pwm-ir-tx kernel module to blast IR signals from my embedded device. However, when the pwm kernel module is loaded during the boot process, the pin is on high. It takes about 10 seconds or so until I can set it to low with a lirc irsend signal. You can in principle 'overload' the IR-LED to make it brighter, if it is only used in PWM mode and not permanently on. The 10 seconds during the boot process undermine this strategy, however.
What is my system doing so far (e.g. what's working, DT-Overlay file, etc)?
I am using Armbian and modified the pwm-ir-tx driver in the mainline kernel, so that the state after a send is guaranteed low (setting duty cycle to 0, it was randomly 1 or 0 when just disabling the pwm channel on my device).
I am using a device tree overlay that activates the pwm and the pwm-ir-tx.
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun4i-a10";
fragment@0 {
target = <&pwm>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>;
status = "okay";
};
};
fragment@1 {
target-path = "/";
__overlay__ {
pwm-ir-transmitter {
compatible = "pwm-ir-tx";
pwms = <&pwm 0 0 0>;
};
};
};
};
When I boot, the pwm-sun4i modules and pwm-ir-tx are loaded and a /dev/lircx character device is available to be used. To turn the LED off, I enabled a systemd service 'lircd-out' with the Unit entry 'After=lircd.service', that turns the led off, but it runs about 10 seconds after the boot process.
Setting modules in the DT Overlay to "disabled" and loading them with modprobe afterwards is not working (not creating pwm or rc devices in sysfs, or a /dev/lircx character device). Maybe since those modules are built in (i.e. configured with 'Y', not 'M' in the .config file), but I must admit my understanding is still a bit fuzzy, here.
What would be ideal?
The ability to control the loading of the modules pwm-sun4i and pwm-ir-tx and thus be able to run a script after pwm-sun4i was loaded that sets the pwm pin to low and then load pwm-ir-tx. But as I mentioned, when I load those modules manually, they are somehow not accessible for the sysfs.
Alternatively, I could pass a parameter in the fragment@0 to the pwm that sets it to low. But I do not know how and do not see anything in the code of pwm-sun4i.c that would allow this. I do not want to modify the kernel source to keep it compatible for updates.
Any suggestions?
|
Create an udev rule to match it.
It shouldn't be necessary to run the script "after a module is loaded" – it deals with a specific device, so it would be better to run it "after the device is detected". Doesn't matter how the device was detected; as long as the kernel reports it as a 'new' device, it'll work.
That said, modules have a presence in /sys just like devices, which means they too can trigger udev rules, and even have systemd .device units generated for them.
For example, to trigger a service as soon as pwm-sun4i loads, use this udev rule:
ACTION=="add", SUBSYSTEM=="module", KERNEL=="pwl-sun4i", \
TAG+="systemd", ENV{SYSTEMD_WANTS}+="fixup-pwl.service"
To run a simple oneshot command:
ACTION=="add", SUBSYSTEM=="module", KERNEL=="pwl-sun4i", RUN+="/etc/fix-pwl.sh"
| Run script after module is loaded due to device tree |
1,424,048,543,000 |
In (or after?) 2.4 the sys_call_table symbol was no longer exported to make it harder to hook system calls.
Ignoring that you can still obtain this information from the IDT or by reading /boot/System.map-<kernel-version>, I was wondering why this address seems to be constant across reboots and machines (with the same kernel version)? Is it just not worth making it dynamic? Is there a reason requiring it to be static?
What I am aiming at is this:
sys_call_table is no longer exported to modules in order to make hooking syscalls a little harder, but modules (i.e. kernel-space programs) can still easily get this info from reading System.map or simply guessing based on the kernel release information as the address seems to be identical for all machines running the same version of the kernel.
|
Since at least version 4.8 of the kernel, at least on x86, the kernel address space is randomised, including the system call table’s address. See RANDOMIZE_BASE in the kernel configuration for the basic details.
This means that the address given in System.map is useless, and the address of the system call table changes at every boot. If you need to debug something and want to use System.map, you need to boot with the nokaslr kernel command-line parameter to disable KASLR.
| Why is sys_call_table predictable? |
1,424,048,543,000 |
I am trying to compile Linux kernel on Odroid C2 and install DVB-T drivers using media_build. I followed steps described on the official wiki and forum. According to the forum, it is necessary to make Device Drivers -> Amlogic Device Drivers -> Multimedia Support compile as modules if I want to use the backported media_build DVB-T drivers.
First, I obtained Linux source:
git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y
Then I set the configuration for Odroid C2:
make odroidc2_defconfig
And finally, I followed the steps for kernel compilation and disabled V4L dependencies as follows:
$make menuconfig
Device Drivers
Amlogic Device Drivers
ION Support
ION memory management support = no
Amlogic ion video support
videobuf2-ion video device support = no
Amlogic ion video devic support = no
V4L2 Video Support
Amlogic v4l video device support = no
Amlogic v4l video2 device support = no
Amlogic Camera Support
Amlogic Platform Capture Driver = no
Multimedia support = m
This configuration compiles without errors, and then I can compile and install media_build drivers. The problem is that with this configuration, Odroid C2 is not capable of playing video files in Kodi with hardware decoding. My impression is that I disabled a dependency which is necessary for amlogic hardware decoding. I tried to modify the config and marked as modules all the dependencies which I previously disabled. Unfortunately, with this configuration, the kernel could not be compiled, and the compilation failed with following error:
drivers/built-in.o: In function `v4l2_device_release':
odroid-battery.c:(.text+0x1731c0): undefined reference to
`media_device_unregister_entity'
odroid-battery.c:(.text+0x1731c0): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_device_unregister_entity'
drivers/built-in.o: In function `__video_register_device':
odroid-battery.c:(.text+0x173c4c): undefined reference to
`media_device_register_entity'
odroid-battery.c:(.text+0x173c4c): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_device_register_entity'
drivers/built-in.o: In function `v4l2_device_register_subdev':
odroid-battery.c:(.text+0x1797b0): undefined reference to
`media_device_register_entity'
odroid-battery.c:(.text+0x1797b0): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_device_register_entity'
drivers/built-in.o: In function `v4l2_device_unregister_subdev':
odroid-battery.c:(.text+0x179a58): undefined reference to
`media_entity_remove_links'
odroid-battery.c:(.text+0x179a58): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_entity_remove_links'
odroid-battery.c:(.text+0x179a60): undefined reference to
`media_device_unregister_entity'
odroid-battery.c:(.text+0x179a60): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_device_unregister_entity'
drivers/built-in.o: In function `subdev_close':
odroid-battery.c:(.text+0x180c10): undefined reference to `media_entity_put'
odroid-battery.c:(.text+0x180c10): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_entity_put'
drivers/built-in.o: In function `subdev_open':
odroid-battery.c:(.text+0x1814f4): undefined reference to `media_entity_get'
odroid-battery.c:(.text+0x1814f4): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_entity_get'
odroid-battery.c:(.text+0x181540): undefined reference to `media_entity_put'
odroid-battery.c:(.text+0x181540): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `media_entity_put'
Makefile:831: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
How can I compile the kernel with Multimedia Support as modules and still be able to use hardware decoding for video files?
|
I finally make it work. I created a git repository with a script, patches, and instructions. If someone is also dealing with this issue please clone this repository and do the following steps (these are also described in the README in the repository):
Linux
Clone Hardkernel Linux repository
git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y
cd linux
Apply patch which allows you to compile aml video driver as a module (I took this step from LibreELEC media_build edition)
patch -p1 < ../odroidC2-kernel/allow_amlvideodri_as_module.patch
Apply default Odroid C2 config
make odroidc2_defconfig
Now modify the config
make menuconfig
And set the following values (press Y to select, N to remove and M to select it as a module)
Device Drivers
Amlogic Device Drivers
ION Support
ION memory management support = Yes
Amlogic ion video support
videobuf2-ion video device support = M
Amlogic ion video devic support = no
V4L2 Video Support
Amlogic v4l video device support = M
Amlogic v4l video2 device support = no
Amlogic Camera Support
Amlogic Platform Capture Driver = no
Multimedia support = M
Compile the kernel
make -j5 LOCALVERSION=""
The LOCALVERSION parameter is only to avoid "+" sign in the name of the kernel.
After the successful compilation, install the modules, kernel and reboot the system
sudo make modules_install
sudo cp -f arch/arm64/boot/Image arch/arm64/boot/dts/meson64_odroidc2.dtb /media/boot/
sudo sync
sudo reboot
Media build
Clone media_build repository and try to build it.
git clone https://git.linuxtv.org/media_build.git
cd media_build
./build
The build command probably fails. Ignore this error and continue with following steps.
Following script is also inspired by LibreELEC media_build edition and it just includes the video driver into media module.
../odroidC2-kernel/add_video_driver_module.sh
To avoid potential issues with compilation, try to disable Remote controller support and all the USB adapter you don't need to.
Try to run:
make menuconfig
It will probably result in an error similar to the following one:
./Kconfig:694: syntax error
./Kconfig:693: unknown option "Enable"
./Kconfig:694: unknown option "which"
You need to edit the file v4l/Kconfig and align with spaces the lines printed in the error. The lines need to be aligned with the previous ones. Then, run the make menuconfig again. Probably, you need to do this step multiple times.
If you see a menu instead of the error, you can modify the config in the following way:
Remote Controller support = no
Multimedia support
Media USB Adapters
## Disable all driver you don't need ##
Apply the following patch
patch -p1 < ../odroidC2-kernel/warning.patch
Make the following change to avoid error and compile kernel
sed -i 's/#define NEED_PM_RUNTIME_GET 1/\/\/#define NEED_PM_RUNTIME_GET 1/g' v4l/config-compat.h
make -j5
Possibly, you need to run previous step (both sed and make) multiple times before it succeeds.
After the compilation, install the modules and reboot the system
sudo make install
sudo reboot
The final step is to add amlvideodri module into /etc/modules to make it load on boot.
sudo echo "amlvideodri" >> /etc/modules
That's all. You can now enjoy your DVB-T TV and HW accelerated videos in Kodi.
| How to compile Linux kernel with multimedia as module on Odroid C2 |
1,424,048,543,000 |
After a fresh install of Fedora 27, the wifi card is not detected after the running the first system update. After some lengthy troubleshooting online I am still no closer to the solution.
uname -r
4.14.5-300.fc27.x86_64
lspci -vnn -d 14e4:
04:00.0 Network controller [0280]: Broadcom Limited BCM4356 802.11ac Wireless Network Adapter [14e4:43ec] (rev 02)
Subsystem: Lenovo Device [17aa:0777]
Flags: bus master, fast devsel, latency 0, IRQ 18
Memory at f1400000 (64-bit, non-prefetchable) [size=32K]
Memory at f1000000 (64-bit, non-prefetchable) [size=4M]
Capabilities: <access denied>
Kernel modules: brcmfmac, wl
rpm -qa | grep -e kernel -e broadcom-wl -e kmod-wl | sort
abrt-addon-kerneloops-2.10.5-1.fc27.x86_64
akmod-wl-6.30.223.271-15.fc27.x86_64
broadcom-wl-6.30.223.271-3.fc27.noarch
kernel-4.13.9-300.fc27.x86_64
kernel-4.14.5-300.fc27.x86_64
kernel-core-4.13.9-300.fc27.x86_64
kernel-core-4.14.5-300.fc27.x86_64
kernel-debug-devel-4.14.5-300.fc27.x86_64
kernel-devel-4.13.9-300.fc27.x86_64
kernel-devel-4.14.5-300.fc27.x86_64
kernel-headers-4.14.5-300.fc27.x86_64
kernel-modules-4.13.9-300.fc27.x86_64
kernel-modules-4.14.5-300.fc27.x86_64
kernel-modules-extra-4.13.9-300.fc27.x86_64
kernel-modules-extra-4.14.5-300.fc27.x86_64
kmod-wl-4.13.9-300.fc27.x86_64-6.30.223.271-15.fc27.x86_64
kmod-wl-4.14.5-300.fc27.x86_64-6.30.223.271-15.fc27.x86_64
libreport-plugin-kerneloops-2.9.3-1.fc27.x86_64
I have installed the correct kernel-devel package:
sudo dnf install kernel-devel-4.13.9-300.fc27.x86_64
Along with enabling RPM-fusion:
sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-27.noarch.rpm https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-27.noarch.rpm
Installed broadcom-wl and kmod-wl
sudo dnf install -y broadcom-wl kmod-wl
Run the akmods command:
sudo akmods --force --kernel 4.13.9-300.fc27.x86_64 --akmod w
Checking kmods exist for 4.13.9-300.fc27.x86_64 [ OK ]
Run depmod:
sudo depmod -a
(No errors)
And finally modprobe on wl:
sudo modprobe wl
(No errors)
All without success. Does anyone know how to solve this problem? I have seen a few older threads documenting similar issues but none of the accepted solutions appear to work in my case.
Edit 1
After some more searching, I've discovered the kernel module I should be loading for my card is brcmfmac4356.
Running:
modprobe -r brcmfmac
And
modprobe brcmfmac
Produces no output but brcmfmac fails to show up after invoking lsmod. Checking dmesg reveals:
[ 8488.780453] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac4356-pcie.bin for chip 0x004356(17238) rev 0x000002
[ 8488.782147] brcmfmac 0000:04:00.0: Direct firmware load for brcm/brcmfmac4356-pcie.txt failed with error -2
[ 8491.291361] brcmfmac: brcmf_msgbuf_query_dcmd: Timeout on response for query command
[ 8491.291376] brcmfmac: brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -5
[ 8491.291383] brcmfmac: brcmf_bus_started: failed: -5
[ 8491.291398] brcmfmac: brcmf_pcie_attach_bus: dongle is not responding
I am not sure what to make of this but will supply a further update when I have time to dig a little deeper.
Edit 2 and ugly fix
I now have a working wireless interface by hunting down the allegedly missing file brcm/brcmfmac4356-pcie.txt here, pasting it into /lib/firmware/brcm/ and running:
modprobe brcmfmac
This feels like a hack and I have to wonder why brcm/brcmfmac4356-pcie.txt was absent. Is this a bug and the wrong file was being sourced?
While I now have a working WiFi connection I would very much like to understand the source of the problem.
Edit 3
The above fix is not persistent after reboot and requires me to execute modprobe brcmfmac before the wireless interface becomes visible.
|
I had the same problem when I upgraded my Thinkpad X260 from Fedora 26 to 27 (the chipset is BCM4356 too). I solved it thanks to this bug report at RH Bugzilla
I downgraded to linux-firmware-20171009-78.gitbf04291.fc27
I had taken before the same steps installing broadcom-wl package. I commented brcmfmac module in the /usr/lib/modprobe.d/broadcom-wl-blacklist.conf file so the module loaded automatically at boot. But I finally removed the broadcom-wl package as it's no needed anymore.
Next optional step would be to fix the linux-firmware version in order to avoid updates until the issue is solved.
Easy steps ;-)
sudo dnf remove broadcom-wl
sudo dnf install linux-firmware-20171009-78.gitbf04291.fc27
And edit /etc/dnf/dnf.com adding the next line:
exclude=linux-firmware*
| Broadcom wireless undetected in Fedora 27 |
1,424,048,543,000 |
I have a Linux system running from a kernel image I compiled off the sources from a Git repository. When I am running Linux, I would like to install a driver for some NI instrument. When I try running the installer, it tells me that it cannot detect the Linux kernel sources, and that those are required for the driver.
I have the sources available, so that's not an issue, but I don't know how to make those available to this installer. Are kernel sources traditionally kept in some specific directory, or is there some environment variable that tells where they are?
Also, what constitutes the kernel sources? There is a large number of files in the Git repo I pulled, but many of those files seem to be build or make files for different platforms. What specifically is needed for a kernel module?
|
The module build system expects to find the configured kernel source (by configured, I mean with the .config file used to build the kernel) in /lib/modules/$(uname -r)/build. The simplest approach for you is to create a symlink there pointing at your source directory:
sudo ln -s /path/to/kernel/source /lib/modules/$(uname -r)/build
| Driver requires Linux Sources |
1,424,048,543,000 |
My system contains 2 Nvidia cards. What i'm trying to achieve is one card driven by nouveau driver while the other by the official nvidia blob driver.
Both drivers successfully cohabit if the nvidia one is launched automatically on boot, using a specific nvidia driver option "nvidia_340.NVreg_AssignGpus=0:02:00." that make the driver to probe only a specific device, and the nouveau driver is launched manually with modprobe, probing the other unused device.
I would like to automate things by making both modules to load on boot but i have not managed to tell nouveau driver to probe only one of the two graphic cards. Loading order of modules seems nondeterministic and when nouveau module is loaded before nvidia module it probes both and prevents the official nvidia to access to the other.
I know i could do a systemd service task to execute modprobe nouveau during boot phase (that is executed well after the load of nvidia module) but i guess there is a better way to do that. I think of udev but as i don't know it much i'm not sure it is the way to go.
What is the proper way to handle this ?
|
So, the path to the solution was not easy, but the solution in itself is
surprisingly straightfoward:
The idea is to use the install directive in a /etc/modprobe.d/ configuration file that redefine the way the nvidia driver is run through modprobe. I set the following inside a file /etc/modprobe.d/nvidia-with-nouveau.conf:
install nvidia_340 /sbin/modprobe --ignore-install nvidia_340; /sbin/modprobe nouveau
which instructs the kernel how to start the module nvidia (mine is version
340). Through this instruction i tell it to start nvidia first, then
nouveau. --ignore-install is needed to prevent the kernel to reuse the
install directive to launch the nvidia module that could result in some
kind of infinite loop i presume.
install and others available directives in /etc/modprobe.d configuration files is well explained in man modprode.d.
It is important to stay the nouveau driver blacklisted to prevent it to be
started by its own. On Ubuntu, Nvidia drivers, when installed through deb
packages from official Ubuntu repositories, blacklist the nouveau module by installing the file /etc/modprobe.d/nvidia-340_hybrid.conf
(it applies for me , it can be different on other OS and driver version).
This file contains the following:
blacklist nouveau
blacklist lbm-nouveau
alias nouveau off
alias lbm-nouveau off
The following lines create an alias for nouveau to off and must be
commented:
#alias nouveau off
#alias lbm-nouveau off
Finally, i guess, updating the initramfs is required for theses changes to
be taken in account:
sudo update-initramfs -u
I can now enjoy a Multi-seat config with one seat on nouveau and the other
on nvidia-driver.
| How to prevent a kernel module video driver to probe a specific graphic card device |
1,458,707,091,000 |
As of this afternoon the wifi on my Dell XPS 13 stopped working (running Debian sid with kernel 4.4.0-1-amd64). lspci detects my wifi card, but ifconfig -a shows only the loopback interface.
I tried plugging in a USB wifi dongle which I have used recently with this laptop, and this also does not get recognized as a network interface. Both during startup and immediately after plugging in a USB wifi dongle, the following message appears in dmesg:
cfg80211: Unknown symbol wireless_nlevent_flush (err 0)
cfg80211 sounds like it would be used for configuring 802.11 (i.e. wifi) so I suspect this kernel module isn't getting loaded correctly. Indeed, if I try to modprobe cfg80211 I receive the following error:
modprobe: ERROR: could not insert 'cfg80211':? Unknown symbol in module, or unknown parameter (see dmesg)
and checking dmesg I see the same message as above.
Googling for "unknown symbol wireless_nlevent_flush" yields zero results, although googling for just wireless_nlevent_flush seems to imply that it relates to wext somehow. One page suggested that rfkill must be loaded before cfg80211, but rfkill is already loaded. I would be very grateful for any advice.
|
Your cfg80211 module and your running kernel are incompatible. The internal programming interfaces in the kernel change rather frequently, so when you upgrade your kernel, you need to keep modules in synch. (The exception is a few out-of-tree modules that are specifically maintained to work across a large range of kernel versions.)
If you upgraded your kernel package since the last reboot, you probably have a running kernel that no longer matches the kernel version(s) on disk, and so modprobe is trying to load a module for a more recent kernel. Make sure not to uninstall a linux-image-… package corresponding to the running kernel. You can check the running kernel version with the command uname -r; with Debian's package naming convention, the package linux-image-$(uname -r) should be installed.
If you've removed the package, then you'll either need to reinstall it or reboot. To reinstall, check if you still have the package in /var/cache/apt/archives. If you don't, look for the package on snapshot.debian.org (with a version matching the version of the linux-image-… package, i.e. the second column of dpkg -l, which is not always exactly the version contained in the name).
| Wifi stopped working, "Unknown symbol wireless_nlevent_flush" |
1,458,707,091,000 |
I try to install tty0tty a null-modem emulatom like in the linked installation guide, but I have a problem at "3. Build the kernel module from provided source":
user@linux-bmne:/run/media/.../Downloads/tty0tty-1.2/module> make
make -C /lib/modules/3.16.7-29-desktop/build M=/run/media/.../Downloads/tty0tty-1.2/module modules
make[1]: Entering directory '/lib/modules/3.16.7-29-desktop/build'
make[1]: *** No rule to make target 'modules'. Stop.
make[1]: Leaving directory '/lib/modules/3.16.7-29-desktop/build'
Makefile:26: recipe for target 'default' failed
make: *** [default] Error 2
Yes, the makefile is in the folder module. Also /lib/modules/3.16.7-29-desktop/build exit (after I mkdir build in 3.16.7-29-desktop). You can have a look at the folder structure of tty0tty here (It is very simple). I also tried out sudo make, but It made no difference.
The problem No rule to make target seems to be common, but I does not found a matching solution in this case. I do not know if this is helpful, but my System is open suse 13.2 x86_64.
I would be thankful for your help.
|
To build a kernel module, you need some header files which are generated during the build of the main kernel image. The makefile expects those headers to be available under /lib/modules/3.16.7-29-desktop/build where the 3.16.7-29-desktop is determined from your running kernel. Together with the header files, there's a makefile which can be used to build third-party modules. The makefile in module calls that makefile, but it isn't present on your system.
You need to install the kernel headers for your system. On OpenSUSE, that's the kernel-devel package. On most distributions, /lib/modules/VERSION/build is a symbolic link to where the kernel header tree is located. I don't know if OpenSUSE does this; if it doesn't, then either create the symbolic link or pass the actual location of the headers (the directory containing files Makefile and Module.symvers and subdirectories include and arch) as an argument to make
make KERNELDIR=/path/to/kernel-headers
The latter method is what you'll need to use if you want to build the module for a kernel version that isn't the one that's currently running.
| "make" stops during installation of tty0tty (null-modem emulator) |
1,458,707,091,000 |
I need to write a script and determining its placement within Debian 7.9 filesystem. The script needs to be executed automatically on startup and, after checking what kernel is currently loaded (2.6.x vs. 3.2.x), unload the incorrect network driver, if loaded, and load the correct one. This question is the follow-up for my prior question and represents the only missing piece of that puzzle, as I've already figured out cross-kernel compiling of network driver by myself.
In terms of the location, I think that the script should be placed into "/etc/rcX.d" directories.
|
The location you guessed is nearly correct. But /etc/rcX.d directories usually contain only links to scripts in /etc/init.d/, so that a script only has to exist once but can be called at different runlevels.
| Autoloading a particular driver, based on a detected specific kernel |
1,458,707,091,000 |
I would like to use full disk encryption in the future and wanted to test if my CPU has AES-NI support so I followed guide on nixcraft.
It turns out that I do have support, but the kernel modules are missing.
$ sort -u /proc/crypto | grep module
module : arc4
module : ccm
module : crc32c_intel
module : crc32_pclmul
module : crct10dif_pclmul
module : kernel
When I try to load the modules (sudo modprobe aesni_intel aes_x86_64) the command exits with 0, but the modules are not listed in the lsmod output.
I have never solved (or pretty much encountered) any problems with kernel modules before.
|
In Fedora, the aesni is build into the kernel. Check this,
# cat /boot/config-4.2.6-301.fc23.x86_64 | grep AES_NI
CONFIG_CRYPTO_AES_NI_INTEL=y
The blog you mentioned works for modules compiled to be loaded externally thats why you do not see it work as described.
The openssl engine command also loads openssl engines loaded externally and openssl also has aes for intel compiled in.
Here is the relevant bug with the exact details but for Fedora 18 and above
| AES-NI module missing in Fedora |
1,458,707,091,000 |
The i915 Kernel module has several "module options" like the infamous enable_rc6.
However, for the xorg config file, there are further options such as TearFree.
I was wondering - why are there two ways to (seemingly?) set options the same module? Why can't I pass the TearFree option to the kernel module? Is this a general case and true for many other modules as well?
Any link to a good explanation is welcome!
|
Because they're two different drivers: the kernel driver and the xorg driver and each driver has its own, specific options.
The i915 kernel driver talks to the hardware device (it does basic, low level stuff like set up resolution, map a framebuffer etc).
The xorg intel driver includes OpenGL, DRI, DDX etc for 2D/3D acceleration and communicates with the gpu via the kernel module. In fact, the i915 kconfig even says
This driver is used by the Intel driver in X.org 6.8 and XFree86 4.4
and above
Further reading:
The Linux Graphics Stack
| Why are there module options AND driver options - e.g. for the i915 module? |
1,458,707,091,000 |
I have my Linux root on an F2FS USB flash drive. The kernel is on another device accessible by the bootloader. I'm trying to start it with the parameters root=/dev/sda1 rootwait rootfstype=f2fs, but I always end up with a kernel panic:
VFS: Cannot open root device "sda1" or unknown-block(8,1): error -19
Please append a correct "root=" boot option; here are the available partitions:
0100 8192 ram0 (driver?)
0101 8192 ram1 (driver?)
0800 3913728 sda driver: sd
0801 3913728 sda1 973c7215-01
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
sda1 is the correct device, and I'm able to mount it with no problems to another computer running Arch Linux. I partitioned it using fdisk and formatted it using mkfs.f2fs from f2fs-tools.
Why does the kernel panic? Am I missing the F2FS module? If so, how can I load it at boot time?
|
As @derobert pointed out, you have to build the kernel with the F2FS module. In my case it wasn't even included as a loadable module.
To build the kernel yourself, grab it from kernel.org. Get the default kernel config for your platform. (I got mine from here for the TI-Nspire calculator series.) Modify it to include F2FS by setting CONFIG_F2FS_FS to y. Save it as .config on the root of the downloaded kernel source, and simply build it using make. You'll then find your fresh kernel stuff in arch/arm/boot.
| Linux root on F2FS |
1,458,707,091,000 |
After upgrading Squeeze to Wheezy my server will no longer boot. I'm only able to boot, by selecting a previous kernel (2.6.32).
linux:~# find /lib/modules/3.2.0-4-amd64/ -maxdepth 2
/lib/modules/3.2.0-4-amd64/
/lib/modules/3.2.0-4-amd64/modules.order
/lib/modules/3.2.0-4-amd64/modules.builtin
/lib/modules/3.2.0-4-amd64/kernel
/lib/modules/3.2.0-4-amd64/kernel/sound
/lib/modules/3.2.0-4-amd64/kernel/net
/lib/modules/3.2.0-4-amd64/kernel/mm
/lib/modules/3.2.0-4-amd64/kernel/lib
/lib/modules/3.2.0-4-amd64/kernel/fs
/lib/modules/3.2.0-4-amd64/kernel/drivers
/lib/modules/3.2.0-4-amd64/kernel/crypto
/lib/modules/3.2.0-4-amd64/kernel/arch
linux:~# uname -rms
Linux 2.6.32-5-amd64 x86_64
linux:~# dpkg -l "linux-image*" | grep ^ii
ii linux-image-2.6.32-5-amd64 2.6.32-48squeeze6 amd64 Linux 2.6.32 for 64-bit PCs
ii linux-image-3.2.0-4-amd64 3.2.68-1+deb7u6 amd64 Linux 3.2 for 64-bit PCs
ii linux-image-amd64 3.2+46 amd64 Linux for 64-bit PCs (meta-package)
So it appears modules.dep is not being created, even though the install worked. I tried depmod -a, I've tried apt-get install --reinstall on the kernel, nothing is fixing this issue.
|
When you are running depmod, it only calculates the dependencies and creates modules.dep for the running kernel as default behaviour unless you provide an alternate kernel version as an argument.
In your case, since you are booting with version 2.6.32-5-amd64, you need to run:
$sudo depmod -a 3.2.0-4-amd64
in order for it to create the file /lib/modules/3.2.0-4-amd64/modules.dep
From : http://www.computerhope.com/unix/depmod.htm
depmod generates a list of kernel module dependences and associated map files.
depmod [-b basedir] [-e] [-E Module.symvers] [-F System.map]
[-n] [-v] [-A] [-P prefix] [-w] [version]
| Upgrade Squeeze to Wheezy now no modules.dep |
1,458,707,091,000 |
I am trying to install DKMS on a Linux system that I made from the Linux from Scratch and Beyond Linux from Scratch books. I've found the package source from here but absolutely no info as to how to install them. There's no configure file in the tar ball and the Makefile seems to expect either Debian or RPM, which I don't have. Any help would be greatly appreciated. Thanks
|
Ok...so there's only one change to be made. This can be done in two ways:
Rename the directory in which the tarball is extracted as dkms instead of dkms-2.2.x.x. The Makefile expects that the tarball is unpacked in a directory called dkms.
Change the Makefile using the below sed:
sed "s@\.\./\$\(RELEASE_NAME\) @\.\.\/\$\(RELEASE_STRING\) @" -i Makefile
Go with option 1 though. Much easier and safer.
After that DKMS can be installed using:
make tarball
sudo make install
sudo make install-doc
| Install DKMS on self-made Linux system |
1,458,707,091,000 |
To what I see the modules for different kernel versions are stored below
/lib/modules, i.e as /lib/modules/{version}/...../...ko
Now, while this makes it evident where to store the modules for each different kernel version, I have currently changed the .config (i.e. what I think is the configuration) of a kernel I have already have.
My question is where would the modules for this new kernel configuration of the now two times existing kernel version go?
Would /lib/modules/{version}_{configsuffix}/...../...ko be the way?
How would a tool like modprobe know where to find those modules?
Additionally I also want to state my suspicion that for a fair share of the modules, even different values in the kernel's configuration .config would lead to the same identical kernel module. Yet even in this case there might be some settings in the .config to make adjust the modules and hence create different modules even for the same kernel version
|
Whenever you change the configuration, add a suffix that succintly describes the configuration to the EXTRAVERSION field of the Makefile.
EXTRAVERSION=-lpae
and another time
EXTRAVERSION=-486
That way different configurations are different versions as far as all the tooling is involved: different output from uname -r, different subdirectories in /lib/modules, etc.
That's what most distributions do.
| Where to put modules for different configurations of same kernel version? |
1,458,707,091,000 |
I have created new module code. And want to compile it for my kernel. But I am not sure about I thing. Should I copy it to some designated directory before I start the compilation? Or I can just compile it wherever I want?
Thank you very much!
|
There isn't anywhere special the source code needs to be. Normally it'd be wherever your repository is.
If you want to leave it somewhere for the next admin to find, the most obvious place would be a company VCS server. /usr/src would also be a reasonable place to look, as well as $HOME.
Eventually, if you decide to submit the module for inclusion in the kernel, you'll have to put it in the proper spot in your linux git checkout.
| Where (the directory) should I put my newly created module in the kernel? |
1,458,707,091,000 |
Background: I am currently in the process of updating a Industrial PC + software from Debian 4 (etch) to Debian 7 (Wheezy) due to hardware obsolescence, one of the few pieces of hardware being shared between the old and new systems is a Sunix 5008 parallel port. We use the parallel port to talk to some custom hardware through the low level driver.
Issue: Although the driver is detected and /dev/parport2 is created and can be successfully opened and written to with our software when we hook a scope up to some of the pins on our parallel port we get no output where as the same application gives output on the older install. We have traced through the driver to the outb() call with no errors reported anywhere.
The following extract from dmesg shows that the port is found and the driver is installed correctly
[ 7.429893] ===================== SUNIX Device Driver Module Install =====================
[ 7.429899]
[ 7.429902] SNX Info : Loading SUNIX Multi-I/O Board Driver Module
[ 7.429908] -- Date : 2011/08/15
[ 7.429915] -- Version : 1.3.3.0
[ 7.429918]
[ 7.431041]
[ 7.431047] SNX Info : Found SUNIX 5008 Series Board (1P),
[ 7.431053] bus number:6, device number:4
[ 7.431056]
[ 7.431079] Trying to free nonexistent resource <000000000000d120-000000000000d127>
[ 7.431087] Trying to free nonexistent resource <000000000000d120-000000000000d122>
[ 7.431094] Trying to free nonexistent resource <000000000000d123-000000000000d127>
[ 7.431101] Trying to free nonexistent resource <000000000000d110-000000000000d117>
[ 7.431108] Trying to free nonexistent resource <000000000000d110-000000000000d112>
[ 7.431115] Trying to free nonexistent resource <000000000000d113-000000000000d117>
[ 7.438603] SNX Info : parport2 - PC-style at 0xd120 (0xd110)
[ 7.438859] SNX Info : lp2 port using parport2 (polling).
[ 7.438866] ================================================================================
The Trying to free nonexistent resource * happens on our older build as well
Interesting observation:
On the older working machine a extract of lsmod gives
Module Size Used by
...
snx 89764 4
parport_pc 22884 0
ppdev 3588 0
parport 19240 2 parport_pc,ppdev
While on the newer machine a extract of lsmod gives
Module Size Used by
...
snx 99449 2
parport_pc 22036 0
ppdev 12651 0
parport 31254 2 ppdev,parport_pc
The key thing to note here is in the newer machine snx is only used by 2 devices rather then 4, so i don't know if this points to a initialization issue
|
Having looked into this further it seems that this is due to the driver only being partially implemented, critical ioctls seem to be stubbed out.
| Sunix Low Level Parallel port driver not working |
1,458,707,091,000 |
GOAL
I want to install the Netis WF2190 wifi dongle linux driver onto my FriendlyARM mini210s.
Environment
FriendlyARM mini210s S5PV210 ARM Cortex-A8 Board
... running Linux 3.0.8-FriendlyARM
Netis WF2190
CROSS compiling with arm/4.3.2/bin/arm-none-linux-gnueabi-
I understand that I need to CROSS COMPILE the Netis WF2190 Linux driver
I am Using a virtual machine for cross-compilation (vagrant box)
$ uname -a
Linux vagrant 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
I have downloaded and copied my driver into my VM
vagrant@vagrant:~/rtl8812AU_linux_v4.3.8_12175.20140902$
In the drivers Makefile, I added these
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_FRIENDLYARM_MINI210S = y <====
and then
ifeq ($(CONFIG_PLATFORM_FRIENDLYARM_MINI210S), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /home/vagrant/friendlyarm/tools/usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-
KVER := 3.0.8
KSRC := /home/vagrant/friendlyarm/linux-3.0.8/kernel
endif
and then tried to compile, but I get this error,
vagrant@vagrant:~/rtl8812AU_linux_v4.3.8_12175.20140902$ make
make ARCH=arm CROSS_COMPILE=/home/vagrant/robot-os/friendlyarm/tools/usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi- -C /home/vagrant/robot-os/friendlyarm/linux-3.0.8/kernel M=/home/vagrant/rtl8812AU_linux_v4.3.8_12175.20140902 modules
make[1]: Entering directory `/home/vagrant/robot-os/friendlyarm/linux-3.0.8/kernel'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/home/vagrant/robot-os/friendlyarm/linux-3.0.8/kernel'
make: *** [modules] Error 2
Worth noting that I am NOT a specialist, I am trying to learn what to do to reach my objective.
At this stage, I just don't understand what the message is telling me, and how I could fix it.
Any help will be well appreciated.
|
Kernel source path was wrong, I corrected it to:
KSRC := /home/vagrant/friendlyarm/linux-3.0.8/
and it compiled
| How do compile Linux Driver for Netis WF2190 Wifi dongle for FriendlyARM mini210s? |
1,458,707,091,000 |
I just recently migrated to Wheezy from Arch, everything has gone very well except I can't seem to get multiple monitors to work. Here is my setup:
machine: Dell Latitude E6540 laptop
graphics:
00:02.0 VGA compatible controller: Intel Corporation Haswell Integrated Graphics Controller (rev 06) (prog-if 00 [VGA controller])
Subsystem: Dell Device 05be
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at f5800000 (64-bit, non-prefetchable) [size=4M]
Memory at e0000000 (64-bit, prefetchable) [size=256M]
I/O ports at f000 [size=64]
Expansion ROM at <unassigned> [disabled]
Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [d0] Power Management version 2
Capabilities: [a4] PCI Advanced Features
When I set up multimonitor on arch I used xrandr, but using that now gives me odd output, namely it doesn't even detect the other monitor
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 1920 x 1080, maximum 1920 x 1080
default connected 1920x1080+0+0 0mm x 0mm
1920x1080 0.0*
1280x1024 0.0
1024x768 0.0
800x600 0.0
640x480 0.0
Any thoughts on what the issue could be? I am assuming it is either driver or kernel related because the hardware should be able to support this functionality.
NOTE: Also posted on debian forums(http://www.debianuserforums.org/viewtopic.php?f=55&t=3115)
|
It's a common Debian problem, you could try the following:
Edit /etc/apt/sources.list
Comment out all sources from /etc/apt/sources.list
Add the following to /etc/apt/sources.list : "deb http://ftp.debian.org/debian wheezy-backports main"
save, exit your editor
from the command line "apt-get update"
launch synaptic package manager
search for and install the latest kernel image from bpo. For me, at this time, it was "linux-image-3.14-0.bpo.2-amd64" (not the RT
version)
exit
Edit /etc/apt/sources.list
Un-do commenting out from above step 3.
save, exit your editor
From the command line "apt-get update"
If you would have problems with the resolution of the 2nd screen, I sugest following the steps of my own question: unlisted screen resolution (intel)
| Debian Wheezy, issue connecting multiple monitors |
1,458,707,091,000 |
So I have a python script that emulates an ESC_KEY on pin 17 (Raspberry Pi).
#!/usr/bin/env python
#Imports for Pins,input
import RPi.GPIO as GPIO
import uinput
from time import sleep
#Setup
key_events=( uinput.KEY_ESC, )
device=uinput.Device(key_events)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#MAIN
while True:
GPIO.wait_for_edge(17,GPIO.FALLING)
device.emit(uinput.KEY_ESC,1)
sleep(2)
device.emit(uinput.KEY_ESC,0)
Is there an "easy" way to set this up as a kernel module, or does anyone have some good documentation to create this kernel module? Do I need to rewrite it using C?
It seems as this is eating alot of resources when running in python, I'm hoping it would be less a strain on the system when run as module.
|
Is there an "easy" way to set this up as a kernel module
Probably not. Also, that might be kind of contra good design principles, because what you have seems like more of a userspace app; there's a kernel driver lurking in the background of it anyway.1
It seems as this is eating alot of resources when running in python
Considering it sleeps most of the time, that's not a good sign; maybe you should be more specific. The stuff I've done with the rpi pins is all I2C based in C or C++ using the kernel interface, and something simple like this wouldn't be more than 1 MB RSS or use any noticeable CPU time.
Do I need to rewrite it using C?
Re-writing it in userspace C might solve your problem, if the problem is resources (WRT kernelspace code, yes, that is C and asm only). However, python should not be all that bad -- there's obviously no performance issue here. Again, you should describe the problem in more detail.
The RPi.GPIO module is written in C, you might want to take a look at that. However, IMO if you don't know the language already and don't have an interest in it otherwise, it is not worth learning just for this.
You could also try using the (language agnostic) existing kernel interface in python directly, instead of RPi.GPIO; it's simply a matter of reading from and writing to file nodes in /sys/class/gpio. You'll find more stuff about that online if you search and at the raspberry pi exchange. The DMA hack mentioned in the footnote may have an advantage over this if you are trying to do things at a very high frequency, but that's not the case here (and I'm dubious as to how useful it really would be in this sense, because it is still a pure userland entity and subject to kernel latency).
1 Actually that's not true in this case -- RPi.GPIO uses a direct memory address hack like this one; I think the C level wiringPi modules also work this way. That's stuff that would make a good kernel module, except the kernel already has a gpio module with a userland interface. I imagine the justification for the DMA hack is that it seems more efficient (and more interesting to write).
| From Python script to Kernel Module [closed] |
1,458,707,091,000 |
Is there a way to get out more out of your limited Ram on a VM?
I have a VM running on a cloud hoster and try to optimize a quite low on RAM mashine.
I heard, there is a way to compress parts in the memory if all free memory is in use called zram
How do I get this running?
|
As explained on the Zram Wiki:
zram (previously called compcache) can create RAM based block devices. It is an experimental (staging) module of the Linux kernel since 3.2.
So If you are using a kernel before 3.2 you need to copy the following script (taken from here) to /etc/init.d/zram:
### BEGIN INIT INFO
# Provides: zram
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: Use compressed RAM as in-memory swap
# Description: Use compressed RAM as in-memory swap
### END INIT INFO
# Author: Antonio Galea <[email protected]>
# Thanks to Przemysław Tomczyk for suggesting swapoff parallelization
FRACTION=75
MEMORY=`perl -ne'/^MemTotal:\s+(\d+)/ && print $1*1024;' < /proc/meminfo`
CPUS=`grep -c processor /proc/cpuinfo`
SIZE=$(( MEMORY * FRACTION / 100 / CPUS ))
case "$1" in
"start")
param=`modinfo zram|grep num_devices|cut -f2 -d:|tr -d ' '`
modprobe zram $param=$CPUS
for n in `seq $CPUS`; do
i=$((n - 1))
echo $SIZE > /sys/block/zram$i/disksize
mkswap /dev/zram$i
swapon /dev/zram$i -p 10
done
;;
"stop")
for n in `seq $CPUS`; do
i=$((n - 1))
swapoff /dev/zram$i && echo "disabled disk $n of $CPUS" &
done
wait
sleep .5
modprobe -r zram
;;
*)
echo "Usage: `basename $0` (start | stop)"
exit 1
;;
esac
give it executable rights with
chmod +x /etc/init.d/zram
then instruct you system to start it at boot time, with the command
insserv zram
After the next reboot you will see the swap with
swapon -s
which will look like:
Filename Type Size Used Priority
/dev/zram0 partition 381668 380716 10
| Compress memory on low Ram VM |
1,458,707,091,000 |
I've been through dependency issues, but, finally, have my application running. The problem is I need to force install of some old libraries with dpkg to achieve this, which, in turn, breaks my package manager (apt-get).
If I can find what .sos are called on load I can extract them (alien + tar) and symlink them within the working directory of this application.
Thus, keeping my package manager and achieving what I need. I wish multiarch did what it was meant to so I wouldn't be here in the first place :(
|
For the majority of cases, you can use ldd to determine the libraries an executable is linked against.
For example:
# ldd /usr/bin/xz
linux-vdso.so.1 (0x00007fff06358000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fd6a1358000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd6a1138000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd6a0d88000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd6a1590000)
Now if I wanted to I could copy these libs into a custom path. In your case it sounds like you plan to put them in the application's own directory. However you have to tell the system to look there since looking in the application's directory is not a default behavior when loading libraries. And since the loading happens before the app starts, the app can't change that behavior.
To accomplish this you need to use LD_LIBRARY_PATH. Just do LD_LIBRARY_PATH=/foo/bar /foo/bar/appname. This will tell ld-linux to look in /foo/bar for the libs.
Exception:
Note that ldd will only show libs which the application is linked against. It is also possible for programs to load libraries at runtime. This isn't very common behavior, and is mostly used as a kind of plugin system, or to keep the memory footprint low by not loading libs unless they're truly needed (perhaps as determined by configuration).
| Is there a way to monitor the Shareable Objects (.so) loaded on launch of a specific application? |
1,458,707,091,000 |
I have a 3rd party device driver which I am trying to cross-compile. When I build the driver everything goes smooth but I don't see any driver.ko file, however driver.o file is generated fine and I don't see any error during the build process. I have also tried with the option V=1 and I see following error
echo;
echo " ERROR: Kernel configuration is invalid.";
echo " include/generated/autoconf.h or include/config/auto.conf are missing.";
echo " Run 'make oldconfig && make prepare' on kernel src to fix it.";
echo;
But my kernel configuration is correct and I have tried a simple hello world module with this configuration, in that case I can build my module but still see this error message. Also I can see both the files include/generated/autoconf.h and include/config/auto.conf in the kernel sources. Still why I am unable to build my driver module.
I am cross-compiling the driver for ARM platform so /lib/modules will not be good in this environment. Secondly here is the output of the build.
LD [M] /home/farshad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca3.1RC_553/imx6build/host/os/linux/ar6000.o
Building modules, stage 2.
MODPOST 0 modules
make[2]: Leaving directory `/home/farshad/Work/CSP/projects/phase_1/farshad/cspbox/platform/imx6/mel5/fs/workspace/linux-2.6.38-imx6'
As you can see above ar6000.o is built properly without any error, but why ar6000.ko is not being built otherwise it should report "MODPOST 1 modules".
Since ar6000.ko is not being built at the end of the complete build process I also get the following error
cp: cannot stat `/home/farshad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca3.1RC_553/imx6build/host/os/linux/ar6000.ko': No such file or directory
2404 make[1]: *** [install] Error 1
Which is obvious. My problem is why I am not getting a ar6000.ko in the first place. Searching over google someone also faced this issue and mentioned that running make with sudo resolved it but it brought no luck for me!
I am wandering is there any problem in my kernel configuration (i.e the driver is looking for some configuration setting which I haven't enabled in my kernel, but in that case it should give compiler error looking for required #define), the other point can be that there is a problem with the driver build system, which I am trying to figure out. My cross-compile environment is good as I am seeing exactly the same issue while building the same driver for my (Ubuntu x86) machine!
Update # 1
Its a 3rd party driver package which also build other utilities along with the driver module. Here is the output of the driver module build process
make CT_BUILD_TYPE=MX6Q_ARM CT_OS_TYPE=linux CT_OS_SUB_TYPE= CT_LINUXPATH=~/Work/CSP/projects/phase_1/farshad/cspbox/platform/imx6/mel5/fs/workspace/linu x-2.6.38-imx6 CT_BUILD_TYPE=MX6Q_ARM CT_CROSS_COM PILE_TYPE=~/bin/mgc/CodeSourcery/Sourcery_CodeBench_for_ARM_GNU_Linux/bin/arm-none-linux- gnueabi- CT_ARCH_CPU_TYPE=arm CT_HC_DRIVERS=pci_std/ CT_MAKE_INCLUDE_OVERRIDE= CT_BUILD_OUTPUT_OVERRIDE=/home/far shad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca3.1RC_553 /imx6build/host/.output/MX6Q_ARM-SDIO/image -C /home/farshad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux _release_[posted_2011_8_19_olca3.1RC_553/imx6build/host/sdiostack/src default
make[3]: Entering directory `/home/farshad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olc a3.1RC_553/imx6build/host/sdiostack/src'
make -C ~/Work/CSP/projects/phase_1/farshad/cspbox/platform/imx6/mel5/fs/workspace/linux-2.6.38-imx6 SUBDIRS=/home/farshad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca 3.1RC_553/imx6build/host/sdiostack/src ARCH=arm CROSS_COMPILE=~/bin/mgc/CodeSourcery/Sourcery_CodeBench_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- EXTRA_CFLAGS="-DLINUX -I/home/farshad/Work/CSP/board s/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca3.1RC_553/imx6build/host/sdiostack/src/include -DDEBUG" modules
make[4]: Entering directory `/home/farshad/Work/CSP/projects/phase_1/farshad/cspbox/platform/imx6/mel5/fs/workspace/linux-2.6.38-imx6'
Building modules, stage 2.
MODPOST 0 modules
make[4]: Leaving directory `/home/farshad/Work/CSP/projects/phase_1/farshad/cspbox/platform/imx6/mel5/fs/workspace/linu x-2.6.38-imx6'
Here is the Makefile of the driver module.
ifdef CT_MAKE_INCLUDE_OVERRIDE
-include $(CT_MAKE_INCLUDE_OVERRIDE)
else
-include localmake.$(CT_OS_TYPE).inc
-include localmake.$(CT_OS_TYPE).private.inc
endif
export CT_OS_TYPE
export CT_OS_SUB_TYPE
export CT_OS_TOP_LEVEL_RULE
export CT_PASS_CFLAGS
export CT_SRC_BASE
export CT_BUILD_SUB_PROJ
# this makefile can only be invoked from the /EMSDIO/src base
CT_SRC_BASE :=$(shell pwd)
# export flags for which HCDs to build. Set the hcd driver name in hcd/ in your localmake.*.inc file.
export CT_HC_DRIVERS
export PDK_BUILD
export HDK_BUILD
export ALL_BUILD
export ATHRAW_FD_BUILD
export BUS_BUILD
# For Linux
ifeq ($(CT_OS_TYPE),linux)
#make a copy for linux 2.4
EXTRA_CFLAGS += -DLINUX -I$(CT_SRC_BASE)/include
ifneq ($(CT_RELEASE),1)
EXTRA_CFLAGS += -DDEBUG
endif
export EXTRA_CFLAGS
CT_SRC_OUTPUT :=$(CT_SRC_BASE)/../output
ifdef CT_BUILD_OUTPUT_OVERRIDE
_CT_COMPILED_OBJECTS_PATH :=$(CT_BUILD_OUTPUT_OVERRIDE)
_MAKE_OUTPUT_DIR :=
_CLEAN_OUTPUT_DIR :=
else
_CT_COMPILED_OBJECTS_PATH := $(CT_SRC_OUTPUT)/$(CT_BUILD_TYPE)
_MAKE_OUTPUT_DIR := mkdir --parents $(_CT_COMPILED_OBJECTS_PATH)
_CLEAN_OUTPUT_DIR := rm -R -f $(CT_SRC_OUTPUT)
endif
ifeq ($(CT_OS_SUB_TYPE),linux_2_4)
CT_PASS_CFLAGS := $(EXTRA_CFLAGS)
_CT_MOD_EXTENSION :=o
ifeq ($(ALL_BUILD),1)
subdir-m += busdriver/ lib/ hcd/ function/
else
ifeq ($(BUS_BUILD),1)
subdir-m += busdriver/ lib/ hcd/
else
ifeq ($(PDK_BUILD),1)
subdir-m += function/
else
ifeq ($(HDK_BUILD),1)
subdir-m += hcd/ function/
endif
endif
endif
endif
# add in rules to make modules
CT_OS_TOP_LEVEL_RULE :=$(CT_LINUXPATH)/Rules.make
include $(CT_OS_TOP_LEVEL_RULE)
else
#2.6+
_CT_MOD_EXTENSION :=ko
ifeq ($(ALL_BUILD),1)
obj-m += busdriver/ lib/ hcd/ function/
else
ifeq ($(BUS_BUILD),1)
obj-m += busdriver/ lib/ hcd/
else
ifeq ($(PDK_BUILD),1)
obj-m += function/
else
ifeq ($(HDK_BUILD),1)
obj-m += hcd/ function/
endif
endif
endif
endif
endif
ifdef CT_BUILD_SUB_PROJ
_CT_SUBDIRS=$(CT_BUILD_SUB_PROJ)
else
_CT_SUBDIRS=$(CT_SRC_BASE)
endif
ifdef CT_CROSS_COMPILE_TYPE
CT_MAKE_COMMAND_LINE=$(CT_OUTPUT_FLAGS) -C $(CT_LINUXPATH) SUBDIRS=$(_CT_SUBDIRS) ARCH=$(CT_ARCH_CPU_TYPE) CROSS_COMPILE=$(CT_CROSS_COMPILE_TYPE)
else
CT_MAKE_COMMAND_LINE=$(CT_OUTPUT_FLAGS) -C $(CT_LINUXPATH) SUBDIRS=$(_CT_SUBDIRS)
endif
makeoutputdirs:
$(_MAKE_OUTPUT_DIR)
default: makeoutputdirs
echo " ************ BUILDING MODULE ************** "
$(MAKE) $(CT_MAKE_COMMAND_LINE) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" modules
echo " *** MODULE EXTENSION = $(_CT_MOD_EXTENSION)"
$(CT_SRC_BASE)/../scripts/getobjects.scr $(CT_SRC_BASE) $(_CT_COMPILED_OBJECTS_PATH) $(_CT_MOD_EXTENSION)
ifeq ($(CT_OS_SUB_TYPE),linux_2_4)
# on 2.4 we can't invoke the linux clean with SUBDIRS, it will just clean out the kernel
clean:
find $(_CT_SUBDIRS) \( -name '*.[oas]' -o -name core -o -name '.*.flags' -o -name '.ko' -o -name '.*.cmd' \) -type f -print \
| grep -v lxdialog/ | xargs rm -f
$(_CLEAN_OUTPUT_DIR)
else
clean:
$(MAKE) $(CT_MAKE_COMMAND_LINE) clean
find $(_CT_SUBDIRS) \( -name '*.[oas]' -o -name core -o -name '.*.flags' \) -type f -print \
| grep -v lxdialog/ | xargs rm -f
$(_CLEAN_OUTPUT_DIR)
endif
endif
# For QNX
ifeq ($(CT_OS_TYPE),qnx)
LIST=VARIANT
EARLY_DIRS=lib
##ifndef QRECURSE
QRECURSE=./recurse.mk
##ifdef QCONFIG
###QRDIR=$(dir $(QCONFIG))
##endif
##endif
include $(QRDIR)$(QRECURSE)
endif
|
Ok, I have figured out the problem. I am having square bracket character "[" in the module source directory
LD [M] /home/farshad/Work/CSP/boards/imx6q/ar6k3/ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca3.1RC_553/imx6build/host/os/linux/ar6000.o
Removing this from the path worked well and I got my kernel module object files. I have renamed
ar6003_3.1_RC_Linux_release_[posted_2011_8_19_olca3.1RC_553
to
ar6003,
and also tested with
ar6003_3.1_RC_Linux_release_posted_2011_8_19_olca3.1RC_553
Both worked fine. I was building on Ubuntu 10.04. A colleague of mine has built from the same sources having "[" character in his path on Ubuntu 11.04 and kernel module object file was building nicely, this also suggest the changed behavior of grep / find / awk or such utility among their different versions, which kernel build system is using, resulting in this issue.
Regards,
Farrukh Arshad.
| Building kernel module |
1,458,707,091,000 |
Is there a way to insert/load a module at the boot menu in Suse? I'm referring to the menu in the screenshot below (this isn't from my machine, just a similar screenshot I took from the web).
I know you add modules to boot via INITRD_MODULES in /etc/sysconfig/kernel, but I'm unable to get into my root partition, even in rescue mode. I did an in-place upgrade to SLES 11 SP2 and this new service pack seems to have an issue with booting my iSCSI HBA.
The proper qla4xxx driver loads fine, but no disks are found. I've been through hours of troubleshooting and found that two drivers need to be loaded in SP2 that I previously never needed: iscsi_boot_sysfs and libiscsi. I want to see if I can specify these two at the main menu and force them to load during boot. Thanks.
|
As far as I know, there is no way to load any module at boot. The kernel first needs to be loaded ... which will not happen if I understand correctly your problem. All you can do from a boot menu is sent parameters to the kernel, but that's all. If you can't load the kernel itself you do not really have any option.
However, maybe you could boot into a live session, load the required modules after you boot into live session with modprobe, than mount your disk, chroot into it an install the missing modules...
Still these are just speculations because I have no way to test your setup.
| Load module from the boot menu |
1,458,707,091,000 |
I have a bug in a driver (iwlwifi/iwlagn), which I have reported, and the developers are asking me to "build the driver with debug options enabled." More specifically:
Debugging output is enabled when compiling the driver with CONFIG_IWLWIFI_DEBUG set to "y".
I do have the source. How do I put that option in when compiling?
|
This debugging option i.e. CONFIG_IWLWIFI_DEBUG is used for enabling the debugging of your WiFi card.
You have to enable this option by adding a line in the .config file in the /usr/src/linux-headers-(kernel-version) directory.
CONFIG_IWLWIFI_DEBUG=y
This .config file contains all the kernel options which you want to use while compiling the kernel.
| Compiling a kernel module with some options |
1,458,707,091,000 |
I'm trying to compile a custom kernel with BTRFS support under Ubuntu 18.04. When I compile and install 4.20.70-generic everything's fine and the system starts without any problem. Btw, I can't use anything newer, because I also need a custom driver (later) that won't compile on anything newer than 4.x.
When I compile the same kernel source using a customized Kernel config file for 4.17.4 (make oldconfig) and answer all the questions, then the same system can't find the BTRFS root volume. Showing the following error:
Begin: Running /scripts/init-premount ... done
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done
Begin: Running /scripts/local-premount ... Btrfs loaded, crc32c=crc32c-generic
Scanning for Btrfs filesystems
done.
Begin: Waiting for root file system ... Begin: Running /scripts/local-block ... done
done.
Gave up waiting for root file system device
ALERT! UUID=a7ff8aa1-5518-4cd3-992f-eab4ed909443 does not exist. Dropping to a shell!
The kernel cmdline is the same for both kernel and the UUID is valid and both .config files (make menuconfig -> make install) have the same BTRFS module included:
CONFIG_BTRFS_FS=m
CONFIG_BTRFS_FS_POSIX_ACL=y
linux /@/boot/vmlinuz-4.18.0-15-generic root=UUID=a7ff8aa1-5518-4cd3-992f-eab4ed909443 ro rootflags=subvol=@
linux /@/boot/vmlinuz-4.18.0-15-mykernel root=UUID=a7ff8aa1-5518-4cd3-992f-eab4ed909443 ro rootflags=subvol=@
So there must be something else that needs to be enabled when compiling the kernel. What am I missing?
|
I finally figured it out based on trial and error, and also cross-verified the issue. The kernel was missing:
CONFIG_FUSION: Fusion MPT device support
Incidentally, I'm running the installation under VMware Fusion (MacOS), and for the last 10 years it used to stay out of the picture, but when building your own kernel, the above is required. Also required is SCSI support.
| Custom Kernel requirements for BTRFS root volume |
1,458,707,091,000 |
I just installed debian bullseye on a lenovo Thinkpad X1 Carbon Gen 10.
The installation process was pretty straightforward. Except for one part: networking. During the installation, it said the wifi card was not recognized.
Apparently this is a known case. I am just supposed to install the firmware-iwlwifi package and everything is supposed to be fine.
Thanks to an usb driver I uploaded this file ftp.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-iwlwifi_20210315-3_all.deb to the laptop and ran dpkg -i.
apt search iwl
firmware-iwlwifi/now 20210315-3 all [installed,local]
Binary firmware for Intel Wireless cards
However, lsmod | grep iwl initally doesn't show that the iwlwifi module, suggesting it's not loaded.
After modprobe iwlwifi, lsmod | grep iwl displays:
iwlwifi 299008 0
cfg80211 983040 1 iwlwifi
I interpret the third column being at 0 as "the driver is not being used".
Finally, lspci -nnkv | sed -n '/Network/,/^$/p' doesn't show the line Kernel driver in use: iwlwifi Kernel modules: iwlwifi like on this page https://wiki.debian.org/InstallingDebianOn/Thinkpad/X1%20Carbon%20Gen%2810%29/bullseye.
Even after rebooting, making sure the kernel module is loaded at boot time (adding iwlwifi in /etc/modules), I don't have a wifi network interface (ip a show).
At this point I'm lost. I feel something's wrong but can't identify what. The installation guide on the debian wiki I linked above proposes some commands to run but none of them seem to be about wifi.
Isn't the iwlwifi module supposed to load automatically after installing the firmware-iwlwifi package?
What am I missing to make the Intel network device use that module?
Note: I don't have access to internet via ethernet. I tried plugging an USB-C to ethernet adapter and an RJ45 cable but for some reason the ethernet interface doesn't go up either.
|
I solved my issue by sharing an internet connection with my phone via USB.
I installed the latest kernel and it seemed to have fixed the issue.
The best hypothesis I have is, as @Peregrino69 mentioned, that my driver version was not aligned with my kernel version.
| Intel wifi card not using iwlwifi module |
1,458,707,091,000 |
Each new release of openZFS has a range of supported linux kernel versions (for example openZFS v2.1.9 supports kernels versions between 3.10 and 6.1)
But when I run zfs version I get:
root@pve:~# zfs version
zfs-2.1.9-pve1
zfs-kmod-2.1.6-pve1
PVE it's because I'm running proxmox virtual environment distribution, but at the end of the day it's debian (11) with some virtualization glitter on top.
So my question is, what linux kernel versions can I install? Because zfs version returns two different versions that have different linux support. For example, zfs 2.1.6 only supports up to linux 5.19. So, what's the important version, zfs or zfs-kmod?
EDIT: Also, should those two versions, zfs and zfs-kmod, be the same?
|
I have found out.
As zfs-kmod it's a kernel module, it gets embedded into the kernel package. So it's the maintainer of the kernel package who should place a compatible version of the zfs-kmod in their kernel package (if they want to support zfs).
To check the zfs-kmod version of installed kernels without having to boot from them I have used strings /usr/lib/modules/*/zfs/zfs.ko | grep -e ^version= -e vermagic= | grep -v % that returns the kernel versions and their associated zfs kernel module version. In my case:
version=2.1.9-pve1
vermagic=5.15.102-1-pve SMP mod_unload modversions
version=2.1.6-pve1
vermagic=5.15.74-1-pve SMP mod_unload modversions
version=2.1.9-pve1
vermagic=5.15.85-1-pve SMP mod_unload modversions
version=2.1.6-pve1
vermagic=5.19.17-1-pve SMP preempt mod_unload modversions
version=2.1.9-pve1
vermagic=6.1.15-1-pve SMP preempt mod_unload modversions
| OpenZFS and Linux Kernel versions compatibility question |
1,666,350,915,000 |
In a minimal Busybox-based Linux system, which commands must be invoked as part of the init script to ensure all kernel modules for the current hardware are loaded?
|
After going down the rabbit hole, assuming a minimal initramfs with some drivers built into the kernel and others present as kernel modules along with all relevant depmod-generated metadata, here is what I found:
Drivers built into the kernel are loaded before /init is invoked.
Drivers built as modules must be loaded by /init as follows:
first /sys and /proc must be mounted
then the existing hardware should be scanned and the relevant kernel modules should be loaded
The hardware scanning and module loading should normally be accomplished by a simple mdev -s invokation.
Unfortunately that doesn't work as it should. One must thereforce force this process to occur by invoking find /sys/ -name modalias | xargs sort -u | xargs -n 1 modprobe instead.
After that all the drivers for the current hardware (and their dependencies) will have been loaded and initialized.
| How to load kernel modules for current hardware in init of minimal Busybox-based system |
1,666,350,915,000 |
I've update my kernel version from 4.11 to 5.4.3-g9c2490ac8-dirty #3 SMP PREEMPT Sun Aug 8 12:11:16 UTC 2021 armv7l GNU/Linux
I have an issue with brcmfmac kernel module. I have enabled brcmfmac debug and enables all messages types in debug message.
you can see the dmesg output when I put this command insmod /<path to ko file>/brcmfmac.ko debug=0x1FFFF
:
[ 2526.159218] brcmfmac: brcmfmac_module_init No platform data available.
[ 2526.168959] brcmfmac: brcmf_ops_sdio_probe Enter
[ 2526.168979] brcmfmac: brcmf_ops_sdio_probe Class=0
[ 2526.168991] brcmfmac: brcmf_ops_sdio_probe sdio vendor ID: 0x02d0
[ 2526.169001] brcmfmac: brcmf_ops_sdio_probe sdio device ID: 0xa962
[ 2526.169011] brcmfmac: brcmf_ops_sdio_probe Function#: 1
[ 2526.169347] brcmfmac: brcmf_ops_sdio_probe Enter
[ 2526.169362] brcmfmac: brcmf_ops_sdio_probe Class=0
[ 2526.169372] brcmfmac: brcmf_ops_sdio_probe sdio vendor ID: 0x02d0
[ 2526.169383] brcmfmac: brcmf_ops_sdio_probe sdio device ID: 0xa962
[ 2526.169392] brcmfmac: brcmf_ops_sdio_probe Function#: 2
[ 3249.364285] brcmfmac: brcmf_sdio_exit Enter
I don't see wlan0 name when execute ifconfig -a !
I have placed appropriate .bin and .txt files in path /lib/firmware/brcm/
ls /lib/firmware/brcm/ -l
-rwxr--r-- 1 root root 219557 Jun 2 12:28 brcmfmac43362-sdio.bin
-rwxr--r-- 1 root root 1121 Jun 2 12:28 brcmfmac43362-sdio.txt
|
the issue resolved.
I have add compatible property to usdhc in dts file.
&usdhc1 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
max-frequency = <50000000>;
pinctrl-0 = <&pinctrl_usdhc1_alt>;
bus-width = <4>;
no-1-8-v; /* force 3.3V VIO */
non-removable;
pm-ignore-notify;
cap-power-off-card;
// /delete-property/ wakeup-source;
status = "okay";
brcmf: bcrmf@1 {
reg = <1>;
compatible = "brcm,bcm4329-fmac";
};
};
as I remember the older version of brcmfmac was not sensitive to this property.
| brcmfmac, brcmfmac_module_init No platform data available |
1,666,350,915,000 |
I am relatively new to Linux and I was reading a book for LPIC-1. Reading the module part I was checking my modules and noticed that some modules don't have a description.
ac97_bus, autofs4, cdrom, crc32_pclmul, crypto_simd, glue_helper, hid, jbd2, sunrpc, usb_common, usbcore
I tried Google but I didn't find any answer there, or on this site either.
So, can you tell me why those modules don't have a description?
Best regards,
me
|
It's not mandatory for a Linux kernel module to have a description filled in. If one does have it, you can find it in the module source code as a MODULE_DESCRIPTION declaration like this:
MODULE_DESCRIPTION("Intel HDA driver");
which you can inspect via modinfo on the .ko object:
$ modinfo snd_hda_intel
filename: /lib/modules/5.3.0-40-generic/kernel/sound/pci/hda/snd-hda-
intel.ko
description: Intel HDA driver
license: GPL
But to make it short - as that's just for documentation purposes, some modules simply don't have it.
| Linux Module descriptions missing |
1,666,350,915,000 |
I'm setting up an embedded system that is built using the Yocto project. This outputs a root file system, kernel, u-boot, etc. I have an installer script that I run from an SD card that configures the eMMC on the board with partitions, copies in the rootfs, uboot, etc. It produces a bootable system when I boot from eMMC.
The problem I'm having is with the ethernet driver. Is isn't installed on the system by default. The installation script copies it to /lib/modules/4.14.98-imx8mq+gea48c83/kernel/drivers/net/ethernet/freescale/fec.ko and I can log in over serial and manually load it with insmod, and that works fine. But I'm not sure how to get it to load automatically.
Systemd looks in /etc/modules-load.d/ for lists of modules to load, but this process seems to use modprobe and not insmod. The modprobe system doesn't really know about the ethernet driver because I haven't run depmod on it. But I can't run depmod from the installer because it would install it on my SD card installation, not on the eMMC.
What is my best approach here? Do I need to find some way to run depmod during the installation? Maybe it could be done with chroot?
Or is there a good way to get my module to load automatically without using the depmod/modprobe system?
Any insight here would be very appreciated.
|
User icarus was correct in their comment to my post.
I am issuing the following command from my installation script and that seems to be working:
depmod -b /mnt/root1 -a 4.14.98-imx8mq+gea48c83
The last argument is because the kernel version on the SD card system I'm booting from is different than the system I am modifying.
| How can I install kernel modules on a mounted file system? |
1,574,247,603,000 |
I am loading a kernel module at boot time, I added it to a config file in /etc/modules-load.d/, the module is loading correctly.
In my module I am using the wait_for_random_bytes() function from linux/random.h, so my module can have some delay in loading.
The modules are loaded sequentially? This module of mine can delay the loading of other modules?
Thanks!
|
What the OS does ?
In my Debian (but i would bet that your CentOS just do the same), the module loading part of initialization is done by /etc/init.d/kmod.
Below is an extract of this script:
files=$(modules_files)
if [ "$files" ] ; then
grep -h '^[^#]' $files |
while read module args; do
[ "$module" ] || continue
load_module "$module" "$args"
done
fi
Where:
modules_files is a shell function that parses various file and directories (including /etc/modules-load.d) and built a list of modules to be loaded.
load_module is a shell function that do the modprobe work + some logging if verbose flag is set.
So i would say that yes, modules are loaded sequentially and if one blocks, then it will block the other ones....
but ...
What kernel does ?
When reading the source code of linux/modules.c we can see that:
The syscall is probably implemented by the function load_module(). We can see that it performs a lot of stuff (initialization, memory allocation, sanity checks, signature checks, etc..) and it returns with return do_init_module(mod); (line 3927
The do_init_module() function do at line 3574 the following operation and, if everything went ok, return 0.
if (mod->init != NULL)
ret = do_one_initcall(mod->init);
if (ret < 0) {
goto fail_free_freeinit;
}
My conclusion is the syscall will return only when:
1. The module has been loaded in memory.
2. Its init() function has ran successfully.
So if your call to wait_for_random_bytes() is part of the init function of your module, then yes, it may block others modules loading.
| Loading a kernel module at boot time is blocking? |
1,574,247,603,000 |
I was reading about how TCP congestion variants are implemented in Linux. Each variant is implemented as a separate module.
When I had read this question: Add TCP congestion control variant to Linux Ubuntu
I understood that the variant can be loaded using modprobe.
Does that mean when lsmod is running, TCP cubic must show as default-loaded? When I run lsmod, I cannot find the loaded module associated with congestion control. Are there specific types of kernel modules are listed under lsmod?
|
There's the question to address and a little clarification for this specific case (congestion).
A kernel module is a part of the kernel that is optional and doesn't have to be present at kernel initial start nor later if not needed. It's a kind of plug-in. This allows to have most functionalities available on-demand, without using memory if never used. Most modules can be compiled as modules or built-in. If built-in, it implies you won't find a .ko module file because it's already in the initial kernel.
You can check what was done:
either by knowing the configuration option (here CONFIG_TCP_CONG_CUBIC), having access to the configuration used, usually as a file in /boot/config-$(uname -r), and verifying what option was used:
grep CONFIG_TCP_CONG_CUBIC /boot/config-$(uname -r)
or by knowing the module name and checking if the module is in the list of built-in modules:
fgrep tcp_cubic.ko /lib/modules/$(uname -r)/modules.builtin
Examples of likely results for your case since you didn't find the module, but with cubic the likely default it probably means it was built-in:
$ grep _CUBIC /boot/config-$(uname -r)
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_CUBIC=y
$ fgrep tcp_cubic.ko /lib/modules/$(uname -r)/modules.builtin
kernel/net/ipv4/tcp_cubic.ko
So this answers the question: consider you have the module always loaded, because it's built-in. It makes sense to have the default be built-in (it's often required).
The list of built-in module files you might expect to find somewhere in /lib/modules/$(uname -r) and be displayed with lsmod but that you won't, can be displayed with cat /lib/modules/$(uname -r)/modules.builtin. They are not special, but were chosen so (by your Linux distribution) often but not always because a default had to be chosen among a list of choices, to be built-in, including all related module dependencies.
Now about the little clarification: of course a module has to be loaded (or built-in) to have its functionality available. But the Q/A you linked to didn't say you only had to load the tcp congestion module to have it activated. Quote:
To try one of these you need to install it using modprobe -a
tcp_westwood or whatever you want. You can then test it using this
echo "westwood" > /proc/sys/net/ipv4/tcp_congestion_control
Since this pseudo-file is read/write, you can just query it to know what congestion is in use with probably this result:
$ cat /proc/sys/net/ipv4/tcp_congestion_control
cubic
Now to change the algorithm:
# lsmod | grep tcp_westwood
# echo westwood > /proc/sys/net/ipv4/tcp_congestion_control
# lsmod | grep tcp_westwood
tcp_westwood 16384 1
The module was auto-loaded and is now in use (some systems might not auto-load).
Anyway the adequate information for this specific case is in /proc/sys/net/ipv4/tcp_congestion_control, not lsmod's output.
| TCP variants under lsmod |
1,574,247,603,000 |
I'm trying to run VBoxClient --clipboard, but I keep getting an error message,
VBoxClient: Failed to connect to the VirtualBox kernel
I see that systemctl is showing the process loaded,
UNIT LOAD ACTIVE SUB DESCRIPTION
virtualbox-guest-utils.service loaded active exited Virtualbox guest utils
virtualbox.service loaded active exited LSB: VirtualBox Linux kernel module
I also see with lsmod that vboxdrv, vboxvideo, vboxpci, vboxnetadp, and vboxnetflt are all loaded.
What's going on here?
|
VBoxClient is a guest-extension. It's made for guests, not hosts. If you're not running a version Linux as the guest in which you're launching VBoxClient, it won't do anything. This is the equivalent to adding the guest-additions CD to Windows guest.
To clarify matters, you can purge the guest packages entirely from the host,
sudo apt --purge remove 'virtualbox-guest-*'
| VBoxClient: Failed to connect to the VirtualBox kernel |
1,574,247,603,000 |
I am trying to understand what I am doing wrong here. I was under the impression that make savedefconfig would be the way to go to reduce one config to the (equivalent) bare minimum.
So here are my step, take a config file from the Debian package directly:
$ dpkg -S /boot/config-4.14.0-3-powerpc
linux-image-4.14.0-3-powerpc: /boot/config-4.14.0-3-powerpc
$ apt-cache policy linux-image-4.14.0-3-powerpc
linux-image-4.14.0-3-powerpc:
Installed: 4.14.13-1
Candidate: 4.14.13-1
Version table:
*** 4.14.13-1 500
500 http://ftp.fr.debian.org/debian sid/main powerpc Packages
100 /var/lib/dpkg/status
Copy it over to my main machine:
$ scp macminig4:/boot/config-4.14.0-3-powerpc ./arch/powerpc/configs/my_defconfig
Verify the option I want to play with is still there:
$ grep CONFIG_SSB_B43_PCI_BRIDGE ./arch/powerpc/configs/my_defconfig
CONFIG_SSB_B43_PCI_BRIDGE=y
Now let's update it since it is not in perfect sync with git v4.14:
$ git checkout v4.14
$ make ARCH=powerpc my_defconfig
$ diff -u .config ./arch/powerpc/configs/my_defconfig | diffstat
my_defconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
So some minor change occurred, but nothing bad, at least I can still see my option:
$ grep CONFIG_SSB_B43_PCI_BRIDGE .config
CONFIG_SSB_B43_PCI_BRIDGE=y
Now let's try a savedefconfig:
$ make ARCH=powerpc savedefconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/bin2c
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --savedefconfig=defconfig Kconfig
If I now check my option is now lost forever:
$ grep CONFIG_SSB_B43_PCI_BRIDGE defconfig
-> nothing !
Why are some options disappearing? Is there a way to control savedefconfig to preserver some option?
|
Turns out that this was simply bad timing. The git/master (actually 4.15) is affected by:
https://patchwork.kernel.org/patch/10185397/
After upgrading an old laptop to 4.15-rc9, I found that the eth0 and
wlan0 interfaces had disappeared. It turns out that the b43 and b44
drivers require SSB_PCIHOST_POSSIBLE which depends on
PCI_DRIVERS_LEGACY, a config option that only exists on Mips.
| Does `make savedefconfig` lose configuration options? |
1,574,247,603,000 |
I use the rtl8812au driver for my wifi adapter. I have dkms setup so that after each kernel upgrade, it gets compiled. Here are the commands I ran to set that up:
DRV_NAME=rtl8812AU
DRV_VERSION=4.3.14
mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive driver-${DRV_VERSION} | tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
Now, after each reboot, my wifi adapter is disabled and to get it working again, I have to go back to the source directory of rtl8812au driver (I go to the original dir, not the dkms-made one), ensure that make has been run for this kernel, and run insmod 8812au.ko. At this point, my adapter fires up and works until the next boot.
How to fix dkms for this driver?
|
cat /usr/src/8812au-4.3.14/dkms.conf
PACKAGE_NAME="rtl8812AU"
PACKAGE_VERSION="#MODULE_VERSION#"
BUILT_MODULE_NAME[0]="8812au"
MAKE="'make'"
CLEAN="'make' clean"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="YES"
But I use git clone. And I rename /usr/src/rtl8812AU to /usr/src/8812au-4.3.14/
sudo dkms add -m 8812au -v 4.3.14
sudo dkms install -m 8812au -v 4.3.14
sudo depmod -a
sudo update-initramfs -u -k $(uname -r)
The drivername is 8812au not rtl8812AU. You need depmod -a because modinfo 8812au | grep dep
depends: cfg80211
The modul needs another modul as dependency.
| Have to run insmod for rtl8812au after each boot |
1,574,247,603,000 |
I'm using an NXP embedded linux board and I compiled u-boot, the kernel and am using a linaro rootfs.
On it I installed freeswitch and loaded mod_gsmopen with a Huawei module and it didn't work. After a little bit of reading the conf file I found that it was trying to read ttyUSB3, so I tried finding the correct ttyUSB but I can't find any /dev/ttyUSB modules, even though it detects the module.
I've tried using lsusb, lsblk and lsmod but only lsusb gives me something about the USB module.
After some reading and trying to find a similar problem, I saw some posts telling me to try
modprobe usbserial
depmod
Modprobe command gives me the result:
modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.1.15/modules.dep.bin'
And depmod gives me:
depmod: ERROR: could not open directory /lib/modules/4.1.15: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
I found on a post to do something likes this:
apt-get install --reinstall linux-image-`uname -r\`
But it doesn't find the package. When I do an apt-cache search linux-image I get many results, ranging from linux-image-4.4 to 4.9, which leads me to believe that there isn't any linux-image available for my version of the kernel and I don't know if I can install something from a newer version of the kernel.
My solution so far has been downloading kernel 4.9.34 which is longterm and recompile it from scratch again, but there is a chance that the problem persists and also this tkes a long time in my machine. Does anyone have any easier solutions?
PS: I'm on armhf, i.MX6ULL module from NXP. Also, /lib/modules does not exist on my machine
|
Ok. So I had many problems, so let's start from the beginning.
At that time I was trying to compile the drivers builtin into the kernel and not as a module. For some reason that didn't work so I decided to compile them as modules separately and installing them later.
The main problema I wasn't finding any package when doing apt-get was because I wasn't using a kernel version that had the linux image ready for installation. Basically I needed to install compile and install it myself.
One other thing that made everything start working was when I started compiling the linux headers, without doing that I'd probably still be trying to get my board to work.
| Can't find /lib/modules/ |
1,493,001,709,000 |
After updating Arch Linux xfce4 has been crashed and When I reboot the machine I got this message
Failed to start loading kernel modules
This is the output of uname -a
Linux NasserLaptop 4.8.4-1ARCH #1SMP PREEMPT Sat Oct 22 18:26:57 CEST 2016 x86_64 GNU/Linux
Output of `pacman -Q Linux
linux 4.8.6-1
I have tried pacman -S linux and remount the /boot but still have the same problem
|
I have solved ,Thank to u guys
I have booted from USB then remounting the partitions as in installation then generate fstab file and edit it to add /boot then arch-chroot and
pacman -S linux
The problem was that boot partition didn't mount correctly and I have to edit fstab file to add it
My post and more details here in the Arch forums
| Failed to start loading kernel modules |
1,493,001,709,000 |
I am trying to use the device driver for a TI battery monitor BQ76PL536 on my beaglebone black(BBB). The driver code is located here: https://github.com/tommessick/bq76pl536 .
Although, the author had tested for a cross-compile Ubuntu toochain, I tried to compile the kernel module directly on my BBB.
I did
sudo apt-get install linux-headers-4.4.9-ti-r25
to install the relevant kernel headers, and then using the following Makefile
DRIVER = bq76pl536
ifneq ($(KERNELRELEASE),)
obj-m += $(DRIVER).o
else
PWD := $(shell pwd)
default:
ifeq ($(strip $(KERNELDIR)),)
$(error "KERNELDIR is undefined!")
else
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
and I defined KERNELDIR=/lib/modules/4.4.9-ti-r25/build/ . I am following the instructions as here: http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/
and my output of make is :
make
make -C /lib/modules/4.4.9-ti-r25/build/ M=/var/lib/cloud9/bq76_driver/bq76pl536 modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.9-ti-r25'
Building modules, stage 2.
MODPOST 1 modules
WARNING: "crc8_populate_msb" [/var/lib/cloud9/bq76_driver/bq76pl536/bq76pl536.ko] undefined!
WARNING: "crc8" [/var/lib/cloud9/bq76_driver/bq76pl536/bq76pl536.ko] undefined!
make[1]: Leaving directory '/usr/src/linux-headers-4.4.9-ti-r25'
While the .o, .ko etc. files are created. When I try to load the module using insmod I get an error:
sudo insmod ./bq76pl536.ko
insmod: ERROR: could not insert module ./bq76pl536.ko: Unknown symbol in module
My dmesg output is as under
dmesg | tail
[ 21.564768] eqep 48304180.eqep: failed to get clock
[ 21.605265] c_can_platform 481cc000.can: c_can_platform device registered (regs=fa1cc000, irq=207)
[ 21.661309] c_can_platform 481d0000.can: c_can_platform device registered (regs=fa1d0000, irq=208)
[ 21.768584] eqep: probe of 48304180.eqep failed with error -2
[161381.366409] bq76pl536: Unknown symbol crc8 (err 0)
[161381.366768] bq76pl536: Unknown symbol crc8_populate_msb (err 0)
[162501.175612] bq76pl536: Unknown symbol crc8 (err 0)
[162501.175973] bq76pl536: Unknown symbol crc8_populate_msb (err 0)
I cannot understand the origin of this error - compiler not being able to find functions: crc8 and crc8_populate_msb, when they are defined in crc8.h, which is accessible in the headers: /linux/crc8.h
|
The error isn't coming from the compiler, it's coming from the linker. Header files only contain the declaration of functions, they don't contain the function's code, so having the function declared in a header isn't sufficient to execute it. The build-time linker warns you that it hasn't found a place where the function is defined. When you try to load the module, the kernel performs the last linking steps. At that stage, all functions used by the loaded module must be defined by the running kernel. In your case, crc8 is required by the module but not defined by the kernel so the module cannot be loaded.
The crc8 function is an optional feature that must be enabled with CONFIG_CRC8 (“CRC8 function” under “Library routines”) at build time. It may be loaded as a module also called crc8. Try
modprobe crc8
If this works then your installation has the crc8 module. After compiling the bq76pl536 and installing it under /lib/modules, run depmod -a; this generates a dependency file and after this loading the bq76pl536 normally (i.e. with modprobe bq76pl536, not directly with insmod) will also load the crc8 module.
If this doesn't work, then your installation doesn't have the crc8 module, and you'll need to recompile a kernel with it. Use Ubuntu's packaging and configuration (except for changing that one configuration item). See the Ubuntu wiki for a walkthrough. Since you've modified the configuration, make sure to add a version modifier in debian.master/changelog as explained on the wiki. Then reboot under the new kernel and recompile the bq76pl536 module against the new kernel.
| crc8 undefined while compiling linux kernel module on Beaglebone black/Debian |
1,493,001,709,000 |
I've done some work backporting the kernel modules for hid-apple and bcm5974 (with lots of help from SicVolo) and writing DKMS scripts for them so I can maintain compatibility across kernel upgrades:
rfkrocktk/hid-apple-3.19
rfkrocktk/bcm5974-3.19
The patches are pretty straightforward, they just add support for these new USB product ids.
The problem I'm having is that even after installing these new kernel modules using DKMS, my devices are never bound to the right drivers, they're always bound to usbhid and then to hid-generic, where they should be going to be bound by hid-apple and bcm5974 for the keyboard and trackpad respectively.
The changes are really simple and as far as I can tell, they should tell the kernel enough to bind the right devices to the right drivers.
Is there a step I'm missing in order to tell the kernel that it really should bind these devices to these drivers? Am I installing the modules in the wrong place in DKMS?
If I go through the hassle of rebinding the devices to the right drivers (ie: locate, lookup, unbind, bind), they work great and the patches are functioning as expected. But how do I get the kernel to bind things the right way by default?
|
My problem was that I was installing the packages into the wrong directories in DKMS.
It's important to set DEST_MODULE_LOCATION to point to the directory within the kernel drivers in which your module is supposed to live. I was installing into /updates, but this was the wrong place. I had to move it to /kernel/drivers/hid to get it recognized.
The weird thing is that DKMS seems to still install the driver into /extras no matter what you pass here, but somehow this fixes it.
| Kernel not recognizing new devices from DKMS module? |
1,493,001,709,000 |
I am currently getting this error message:-
iptables v1.4.12: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
I have tried insmod, updating the kernel from apt-get but I am really at a loss they are just not working and I have no idea why. what should I do? recompile the kernel? when I was installing the modules when first installing the kernel all IPV4 related modules failed to install. help me people of the internet!
I am using -> Linaro 14.04 (GNU/Linux 3.15.0+ armv7l)
apt-get install linux-image-$(uname -r)
I have already tried the above and update everything I still get the same error and I try running this again and it tells me everything is upto date (yes I did update the apts)
edit -- some information from dmesg
[ 60.551189] init: tty1 main process (1534) killed by TERM signal
[ 65.094650] init: lxdm main process (1463) terminated with status 1
[ 182.391322] ip_tables: Unknown symbol xt_free_table_info (err 0)
[ 182.391378] ip_tables: Unknown symbol xt_alloc_table_info (err 0)
[ 182.391422] ip_tables: Unknown symbol xt_check_match (err 0)
[ 182.391467] ip_tables: Unknown symbol xt_request_find_target (err
0)
[ 182.391497] ip_tables: Unknown symbol xt_unregister_matches (err 0)
[ 182.391534] ip_tables: Unknown symbol xt_request_find_match (err 0)
[ 182.391584] ip_tables: Unknown symbol xt_unregister_targets (err 0)
[ 182.391606] ip_tables: Unknown symbol xt_recseq (err 0)
[ 182.391701] ip_tables: Unknown symbol xt_register_targets (err 0)
[ 182.391798] ip_tables: Unknown symbol xt_register_table (err 0)
[ 182.391819] ip_tables: Unknown symbol xt_proto_init (err 0)
[ 182.391855] ip_tables: Unknown symbol xt_replace_table (err 0)
[ 182.391882] ip_tables: Unknown symbol xt_find_table_lock (err 0)
[ 182.391925] ip_tables: Unknown symbol xt_table_unlock (err 0)
[ 182.391945] ip_tables: Unknown symbol xt_proto_fini (err 0)
[ 182.391964] ip_tables: Unknown symbol xt_register_matches (err 0)
[ 182.391984] ip_tables: Unknown symbol xt_check_target (err 0)
[ 182.392018] ip_tables: Unknown symbol xt_find_revision (err 0)
[ 182.392045] ip_tables: Unknown symbol xt_unregister_table (err 0)
|
I solved this issue in the end, I recompiled the kernel, recopied over the modules and created a symlink between 3.15.0 to 3.15.0+ ... this + was not added to a file for some reason which messed up alot of things adding this I was able to make and install modules
| module issues with kernel |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.