module load at bootup

[LEFT]Hello!
How do I load module on boot-up for device that is not detected?

I need to load pata_via for IDE controller that is not detected on bootup.

I tried to enter module manually via (KDE) Administrator Settings -> System -> Kernel Settings … here I add pata_via for VIA IDE controler at 0:0f.0tha
That creates configurarion file /etc/modprobe.d/50-newid.conf:

install pata_via /sbin/modprobe --ignore-install pata_via; echo '8086 7111' > '/sys/bus/pci/drivers/pata_via/new_id'

(that’s how it looks on virtual machine, on real PC numbers are slight different … 5337…)

Then I do (as root) mkinitrd and check:

[/LEFT][LEFT][FONT=Verdana]linux-fdho:~ # lsinitrd |grep pata
-rw-r--r--   1 root     root        26712 Dec  6 18:10 lib/modules/4.12.14-lp151.28.36-default/kernel/drivers/ata/pata_via.ko
[/LEFT][/FONT][LEFT][FONT=Verdana]linux-fdho:~ # lsinitrd |grep 50-newid
-rw-r--r--   1 root     root          118 Dec 30 00:36 etc/modprobe.d/50-newid.conf
[/LEFT][/FONT][LEFT]

Unfortunately, after restart module is not loaded.

After some googling I add /etc/sysconfig/kernel with

[/LEFT][LEFT][FONT=Verdana]MODULES_LOADED_ON_BOOT="pata_via"
[/LEFT][/FONT][LEFT]

Unfortunately it doesn’t get added to initrd and it doesn’t work also.

How to make module loaded at bootup (via initrd)?

BR,
Kuba[/LEFT]

Hi and welcome to the Forum :slight_smile:
You need to add a file /etc/modules-load.d/pata_via.conf

and in that file just have;


pata_via

Then rebuild initrd with the mkinitrd command.

Here is the arch wiki documentation which should work for openSUSE as well

https://wiki.archlinux.org/index.php/Kernel_module

Note that after you have built your kernel modules you do should not need to remake your mkintrd or rebuild your modules, just load your modules as described, your mobules should then load not when GRUB loads but late in the system boot process and be available long before the time you login.

TSU

Hi
There is no module to build, the module exists in the kernel, in this case the OP needs to inject the PCI ID…

If the module already exists, then just load the module as described…
Requires testing but likely won’t require adding to the initrd.

Background info…
Nowadays, kernel modules can be built into the base initrd, and generally those are determined by our openSUSE/SUSE maintainers.
But we Users can modify by dynamically loading additional modules as needed (BTW - I’d be very surprised if the module to support PATA is not already loaded but anything is possible and I haven’t checked) and would not be added to the initrd. Nowadays, I see us mostly running mkinitrd to modify configurations in the initrd, not adding modules. Also, disks can be mounted a few different ways which can afford flexibility if there is some kind of timing issue.

If I were troubleshooting this,
The following assumes the problem disk is a system disk and not a removable disk, which usually means the PATA controller is installed in something like a PCI (or ancient ISA) slot and bus. If the interface/card is installed in something like a USB, PCMCIA or Firewire slot there might be complications.
I’d probably start with a default openSUSE and simply attempt to mount the disk manually, if successful that would indicate that the necessary parts including any kernel module is fully loaded by the time the User logs in.
Assuming that the disk can be mounted by the User without any special system modification (like loading a kernel module), my next step might be try to determine why udev isn’t finding the disk and mounting in fstab during boot… For instance is there a problem with the device vendorid:deviceid?
But even before all of this, of course, you need to verify the BIOS/UEFI is able to find the disk.

TSU

Hi
A better way is to patch the module to add the missing PCI-ID and upstream… :wink: I think there is a file somewhere in /etc that can be added too as well?

Hello!
To clear this case out…
Actually a problem is with stock kernel/initrd not loading proper module on boot-up.
Motherboard is Asus [LEFT]P5VD2-VM that has Via IDE controller and I have IDE HDD for installation.
I did workaround by attaching disk to SATA port via IDE-SATA adapter (taken from other PC) and then I looked for a way to load module during bootup and get rid of this adapter (that’s why my initial post came).

Module pata_via does the job for IDE controller (confirmed after bootup) but it’s somehow not loaded by default auto-magically.
I can post vendor and device strings once I’ll be back from vacation (that means after Jan 6th). Hope this helps to upstream changes to module/kernel.

BR,
Kuba

[/LEFT]

Recommend insert your mount command exactly as you’d do it in a console manually into /etc/sysctl.conf this file is typically read during boot well after your system disks are loaded. In other words your SATA controller which likely is required should already be loaded so your IDE controller can also load. This location is supposedly being deprecated sometime, and your command may need to be inserted into any of the other listed sysctl files that will continue to be supported.

Would be interesting to know what driver is required and implemented by your system, if it’s actually the kernel module you’re trying to load… and yest, your sata to pci controller is likely the complication. I’d expect if you were able to use an IDE controller that connects directly to your PCI bus you probably wouldn’t have this issue, and I’d also guess that your disk isn’t identified by your BIOS.

TSU

In other words, I suspect that your IDE isn’t working during stage 1 boot because it likely requires the SATA controller to be working first.
i describe mounting your IDE disk well after your SATA controller loads first, after which your IDE controller should work just fine.
No need and IMO it’s even questionable whether making your IDE controller kernel module part of the initrd would make it work.

Yes, some speculating but based on what I think is happening…
TSU

Here is some more info you might be able to use,

Thus us a brief Wiki page I wrote several years ago introducing the idea of Loadable Kernel Modules. AFAIK all should still work in today’s openSUSE, only diff is that with all the device drivers that are being implemented as kernel modules people are describing the current Linux kernel as “monolithic” again, but the “loadable” has not changed recently.

https://en.opensuse.org/User:Tsu2/LKM

Even further back,
I wrote an article about optimizing network connections, and it describes how to make changes to kernel default configuration settings as well as how to load a specific kernel module on boot. Although it’s possible to write specific commands that fit specific distros, I chose to recommend methods that should work across all distros.

https://sites.google.com/site/4techsecrets/optimize-and-fix-your-network-connection/linux

TSU

Hello!
I’m back to real PC now.
After preparing /etc/modules-load.d/pata_via.conf as Malcolm advised and moving disk to IDE controller system boots as expected.
Thank you Malcolm!

File /etc/modprobe.d/50-newid.conf on real hardware is

install pata_via /sbin/modprobe --ignore-install pata_via; echo '1106 5337 1043 81cf' > '/sys/bus/pci/drivers/pata_via/new_id'

and related output of lspci:

pedagog:/etc/modprobe.d # lspci -d 1106:5337 -v
00:0f.0 IDE interface: VIA Technologies, Inc. Device 5337 (rev 07) (prog-if 8a [ISA Compatibility mode controller, supports both channels switched to PCI native mode, supports bus mastering])
        Subsystem: ASUSTeK Computer Inc. Device 81cf
        Flags: bus master, medium devsel, latency 32
        [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 000003f0 (type 3, non-prefetchable)
        [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 00000370 (type 3, non-prefetchable)
        I/O ports at fc00 [size=16]
        Capabilities: [c0] Power Management version 2
        Kernel driver in use: pata_via
        Kernel modules: sata_via, pata_acpi, ata_generic

Will it help in improving module auto-loading ?

BR, Kuba[/size][/size][/size]

Hi
I would suggest a bug report against the kernel via openSUSE:Submitting bug reports - openSUSE

Looks like the PCI ID needs to be added… if you do create a bug report, post back the reference ;)[/size][/size][/size]

Sorry for delay. Bug reference https://bugzilla.opensuse.org/show_bug.cgi?id=1160732

BR,
Kuba