0

I have been breaking my head over this the last few hours. On one of my machines the intel-rapl-msr driver is buggy and reloading it fixes the issue. I thought I could trivially create a service that does this on boot. But I can't get the service to load after the driver has loaded.

[Unit]
Description=Reload intel-rapl-msr
Requires=systemd-modules-load.target
WantedBy=multi-user.target

ExecStart=/nix/store/wqjkhyyffqdbx767vlqklzi12ln8j3pv-unit-script-cpu-script-start/bin/cpu-script-start

Where the script in ExecStart simply contains:

rmmod intel_rapl_msr
modprobe intel_rapl_msr

This way the service fails on boot with the message:

mmod: ERROR: Module intel_rapl_msr is not currently loaded

So is it possible to force a service to run after this kernel module is loaded?

Any help is appreciated!

John Smith
  • 101
  • 2

2 Answers2

0

So now I just poll with lsmod it works but it's kind of dirty:

while ! lsmod | grep -q intel_rapl_msr;
do
  echo "intel_rapl_msr not loaded yet... sleeping for 5 seconds"
  sleep 5
done
echo "found intel_rapl_msr"
rmmod intel_rapl_msr
modprobe intel_rapl_msr
John Smith
  • 101
  • 2
0

I solved the modules dependecy of the service I was starting loading these modules with systemd-modules-load.service

In practice: add the modules to: /etc/modules-load.d/modules.conf

https://www.freedesktop.org/software/systemd/man/modules-load.d.html#

fermar
  • 101
  • 2