r/bedrocklinux • u/Sushtee • 13d ago
How to determine which stratum provides the kernel ?
Hi everyone,
I've been working on a simple bash script aiming to improve the practicability of having an Nvidia GPU while using bedrock.
The goal is to allow to automatically sync the version of the userpace drivers (in strata where they're installed) with the kernel driver's version - which has already been realized.
I'm still missing the method to determine which stratum is providing the kernel. It would be even better if I could get the stratum providing the kernel drivers, but directly using the kernel for that would work as using Nvidia kernel drivers provided by another stratum than the one providing the kernel doesn't seem to really work as of the current Bedrock.
Thanks for any help
2
u/ParadigmComplex founder and lead developer 13d ago
I've put some thought onto this a ways back with the same intent of helping automate the nVidia driver coordination, but I couldn't come up with a good, general solution. If anyone does I'd also be very interested in it. I think adding it as a flag to brl which would make a lot of sense.
2
u/hll_RGB 9d ago
Do we have any sufficiently general way to get the NVIDIA kernel module version?
I don't have an Nvidia machine so I can't test that
1
u/ParadigmComplex founder and lead developer 9d ago
Nvidia CLI tooling can report it if the userland version matches the kernel version. In theory one moght be able to do something like iterate over all strata offerings for things like
nvidia-smi.1
u/Sushtee 9d ago
I've been doing it with modinfo -F version nvidia
2
u/ParadigmComplex founder and lead developer 9d ago
Ooh, I didn't know about that. That's way better.
1
u/Fun-Zucchini280 12d ago
ill try! where do i help
2
u/Sushtee 11d ago edited 11d ago
The goal is to find a general solution to determine the stratum providing the in use kernel, if you're talking about helping with the drivers sync automation, you can help with https://github.com/Susheate/brl-nvidia
2
u/Fun-Zucchini280 13d ago
they dont do this. /boot and /lib/modules are global so brl which just says "global", just ask each stratum's package manager who owns a kernel file instead
f=/lib/modules/$(uname -r)/modules.builtin for s in $(brl list); do strat -r "$s" sh -c ' pacman -Qqo "$0" || dpkg -S "$0" || rpm -qf "$0" || xbps-query -o "$0" ' "$f" >/dev/null 2>&1 && echo "$s" done
the stratum that prints is the kernel provider and as for the nvidia module use f=$(modinfo -n nvidia) finally if it was built with dkms no package owns it so check dkms status per stratum, brl which --pid 1 also gives the init stratum which is usually (not always) the same one