Automatic module detection for needed kernel-modules in manjaro-architect

I'm trying to add automation to kernel module detection in manjaro-architect.

Screenshot%20from%202019-05-28%2000-07-36

KERNEL-spl has been dropped, KERNEL-zfs can be added if zfs volume is present at install time. KERNEL-virtualbox-host-modules can be ignored, KERNEL-virtualbox-guest-modules installed if running in vbox. But what about the rest? How do I know if user needs KERNEL-headers or ndiswrapper? How do I auto-detect broadcom, r8168 and the others?

Any ideas and help is appreciated

also, need for KERNEL-rtl8723bu would be nice to autodetect too. @linux-aarhus, any ideas on how to do that?

I would ask @tbg on this.

2 Likes

I don't understand. Isn't MHWD (more specifically mwhd-kernel) already able to install the right modules according your material? Wouldn't be possible to simply use mhwd-kernel?

r8168 might become depreciated eventually in favor of r8169, which is a module already shipped with the kernel, considering how many problems related to Realtek Ethernet controller get solved by simply removing r8168 and use r8169 instead.

See this thread: R8168 driver causing issues

Mhwd-kernel just copies your current installed modules for the new kernel afaik. I initially tried to install chosen kernels with it, but it turned out to be a little frustrating: to use it, the target system needs to have it installed. But it pulls a kernel as a dependency, so if you have it, kernel installation is already done. So in case of single step net-install, it just didn't make sense. It caused time consuming redundancies in the installation and turned out not to even be that magical.

Maybe I'll just ignore it for now...

1 Like

Use lsusb looking for ID 0bda:b720 and possibly in connection with string Realtek

Bus 001 Device 003: ID 0bda:b720 Realtek Semiconductor Corp.

2 Likes

Thanks!

I now got something like this:

setup_modules() {
    if lsusb | grep -q "0bda:b720"; then
         #
         echo "KERNEL-rtl8723bu"
    fi

    if systemd-detect-virt | grep -q "oracle"; then
         #
         echo "KERNEL-virtualbox-guest-modules"
    fi 

    if dmidecode -t system | grep -q -i "ThinkPad"; then
        #
        echo KERNEL-tp_smapi
    fi

    if lspci | grep -i -q broadcom; then
        #
        echo "KERNEL-broadcom-wl"
    fi

    if findmnt | grep -q "zfs"; then
        #
        echo "KERNEL-zfs"
    fi
}

I still need something for

KERNEL-rt3562sta
KERNEL-headers
KERNEL-acpi_call
KERNEL-ndiswrapper
KERNEL-vhba-modulw

Not sure how to determine if user would need them. Probably disably headers, ndiswrapper and acpi_call by default?

2 Likes

The command below will automatically install the linux-headers for the currently running kernel:

sudo pacman -S linux$(uname -r| grep -o -E '[0-9]+' | head -n 2 | sed 'N;s/\n//')-headers

Personally I would just install the headers by default, regardless of if they are essential or not.

2 Likes

Okay, I added headers by default. Testing version seems to work, uploading the changes

2 Likes

@dalto passed along this snippet to install the headers for all currently installed kernels:

sudo pacman -S $(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-headers"}' ORS=' ') 

I think most people are not installing more than one kernel using Architect. However, I imagine that situation could arise, in which case @dalto 's version would be preferable.

Including the kernel-headers by default is a great decision IMO. I wish more of the Manjaro versions would include it, as it leads to endless help requests when they are missing and a dkms driver is required.

Thanks for all the hard work. :+1:

1 Like

see its simple as only root packages need to add
KERNEL-headers by default.
in iso profiles.

r8168 - I would leave it for manual activation. r8169 included in the kernels is actually far less problematic these days. I'm sure tbg will back my thoughts on this, it should be considered for dropping entirely from installer images and only kept as a repository package for people already running the module.

2 Likes

I absolutely agree, I don't see an issue with including r8168 for those rare cases that might require it. However, I think the majority of people would be far better off using the r8169 kernel module.

1 Like

Okay, this feature is now implemented. Thank you everyone for input!

5 Likes