March 6th, 2008

face

so udev + modprobe + beating the author...

So I had a simple task today,

take a option on the kernel command line ala i915.modeset=1

and have modprobe take this option and pass it to the i915 module when loading it.

Firstly I thought this might just work, but no.

So my first attempt added a file in /etc/modprobe.d/i915modeset

install i915 {if [ `grep -c "i915.modest=1" /proc/cmdline` = 1 ] then; modprobe --ignore-install i915 modeset=1 ; else modprobe --ignore-install i915 ] }

or something like that (you get the idea if not syntax...)

So when I ran modprobe i915 from a login post boot it all worked beautifully, but when the hybrid black/shithole that is udev started it never ever worked. I spent most of the morning playing with various scriptlets all failing to run at early boot.

So I eventually got pissed off with all of it and booted init=/bin/sh and started tracing things, apparently something is dropping permission or capabilities when spawning modprobe so that when my script runs it can't access /dev/null and grep fails on trying to write to the pipe to shell that spawned it.. Christ people what are you doing in there?

I also noticed we start_udev passes the syslog option to modprobe before syslogd is running.. winners all....