Skip to contentSkip to conversation

systemd integration: Problem with modprobe in lm_sensors.service

lm-sensors Dale R. Worley 3 participants 6 messages Oct 8, 2014 – Oct 10, 2014

lore
Share & tools
lore
#0 lore raw

I am running Fedora 16 with kernel 3.14.19-100.fc19.x86_64 and systemd-204-21.fc19.x86_64.

On startup (and sometimes shutdown), I see a message like this in /var/log/messages:

    Oct  6 13:53:37 hobgoblin modprobe[623]: modprobe: ERROR: missing parameters. See -h.

This message appears to be due to invocations of modprobe with these arguments:

/sbin/modprobe -qab
/sbin/modprobe -qabr

Grepping all the system files (and looking in the journal), it seems likely that these invocations are made by systemd, under control of /usr/lib/systemd/system/lm_sensors.service:

[Unit]
Description=Initialize hardware monitoring sensors After=syslog.target

[Service] EnvironmentFile=/etc/sysconfig/lm_sensors Type=oneshot
RemainAfterExit=yes
ExecStart=-/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES ExecStart=/usr/bin/sensors -s ExecStop=-/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES

[Install]
WantedBy=multi-user.target

Which suggests that $BUS_MODULES and $HWMON_MODULES are empty in this context.

I've found the threads "PATCH: systemd integration" and "PATCH:
systemd integration version 2". But they don't deal with the fact that modprobe prints an error message if the list of modules to be loaded is empty. Those error messages go into /var/log/messages, and eventually logwatch sends e-mail to root complaining about them.

There doesn't seem to be a facility in systemd to optionally start a program depending on settings in another file. So maybe what is needed are supporting scripts along these lines:

#! /bin/sh

if [ -n "$BUS_MODULES" -o -n "$HWMON_MODULES" ] then
/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES
fi

exec /usr/bin/sensors -s

and

#! /bin/sh

if [ -n "$BUS_MODULES" -o -n "$HWMON_MODULES" ] then
/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES
fi

Dale

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 55 lines · Dale R. Worley

I am running Fedora 16 with kernel 3.14.19-100.fc19.x86_64 and systemd-204-21.fc19.x86_64.

On startup (and sometimes shutdown), I see a message like this in /var/log/messages:

    Oct  6 13:53:37 hobgoblin modprobe[623]: modprobe: ERROR: missing parameters. See -h.

This message appears to be due to invocations of modprobe with these arguments:

/sbin/modprobe -qab
/sbin/modprobe -qabr

Grepping all the system files (and looking in the journal), it seems likely that these invocations are made by systemd, under control of /usr/lib/systemd/system/lm_sensors.service:

[Unit]
Description=Initialize hardware monitoring sensors After=syslog.target

[Service] EnvironmentFile=/etc/sysconfig/lm_sensors Type=oneshot
RemainAfterExit=yes
ExecStart=-/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES ExecStart=/usr/bin/sensors -s ExecStop=-/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES

[Install]
WantedBy=multi-user.target

Which suggests that $BUS_MODULES and $HWMON_MODULES are empty in this context.

I've found the threads "PATCH: systemd integration" and "PATCH:
systemd integration version 2". But they don't deal with the fact that modprobe prints an error message if the list of modules to be loaded is empty. Those error messages go into /var/log/messages, and eventually logwatch sends e-mail to root complaining about them.

There doesn't seem to be a facility in systemd to optionally start a program depending on settings in another file. So maybe what is needed are supporting scripts along these lines:

#! /bin/sh

if [ -n "$BUS_MODULES" -o -n "$HWMON_MODULES" ] then
/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES
fi

exec /usr/bin/sensors -s

Quoted 9 lines

and

#! /bin/sh

if [ -n "$BUS_MODULES" -o -n "$HWMON_MODULES" ] then
/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES
fi

Not sure if there is anything we can do about that; it is a distribution problem, not a lm-sensors problem.

Jean, any idea ?

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Dale R. Worley
Quoted 4 lines

From: Guenter Roeck <[email protected]>

Not sure if there is anything we can do about that; it is a distribution problem, not a lm-sensors problem.

As long as I know that the lm-sensors people don't maintain the lm_sensors.service file and send it to the people who package Fedora, I can report it to Fedora. I just need feedback on who is responsible for the file.

Dale

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Dale R. Worley
Quoted 10 lines · Dale R. Worley
Quoted 4 lines

From: Guenter Roeck <[email protected]>

Not sure if there is anything we can do about that; it is a distribution problem, not a lm-sensors problem.

As long as I know that the lm-sensors people don't maintain the lm_sensors.service file and send it to the people who package Fedora, I can report it to Fedora. I just need feedback on who is responsible for the file.

I had a look; you are right, the lm-sensors package includes prog/init/lm_sensors.service; it was added last year.

Jean, any idea how to handle this ?

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Dale R. Worley

Hi Dale, Guenter,

Quoted 66 lines · Guenter Roeck
Quoted 55 lines · Dale R. Worley

I am running Fedora 16 with kernel 3.14.19-100.fc19.x86_64 and systemd-204-21.fc19.x86_64.

On startup (and sometimes shutdown), I see a message like this in /var/log/messages:

    Oct  6 13:53:37 hobgoblin modprobe[623]: modprobe: ERROR: missing parameters. See -h.

This message appears to be due to invocations of modprobe with these arguments:

/sbin/modprobe -qab
/sbin/modprobe -qabr

Grepping all the system files (and looking in the journal), it seems likely that these invocations are made by systemd, under control of /usr/lib/systemd/system/lm_sensors.service:

[Unit]
Description=Initialize hardware monitoring sensors After=syslog.target

[Service] EnvironmentFile=/etc/sysconfig/lm_sensors Type=oneshot
RemainAfterExit=yes
ExecStart=-/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES ExecStart=/usr/bin/sensors -s ExecStop=-/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES

[Install]
WantedBy=multi-user.target

Which suggests that $BUS_MODULES and $HWMON_MODULES are empty in this context.

I've found the threads "PATCH: systemd integration" and "PATCH:
systemd integration version 2". But they don't deal with the fact that modprobe prints an error message if the list of modules to be loaded is empty. Those error messages go into /var/log/messages, and eventually logwatch sends e-mail to root complaining about them.

There doesn't seem to be a facility in systemd to optionally start a program depending on settings in another file. So maybe what is needed are supporting scripts along these lines:

#! /bin/sh

if [ -n "$BUS_MODULES" -o -n "$HWMON_MODULES" ] then
/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES
fi

exec /usr/bin/sensors -s

Quoted 9 lines

and

#! /bin/sh

if [ -n "$BUS_MODULES" -o -n "$HWMON_MODULES" ] then
/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES
fi

Quoted 4 lines

Not sure if there is anything we can do about that; it is a distribution problem, not a lm-sensors problem.

Jean, any idea ?

Jaromir Capik (Red Hat / Fedora package maintainer, Cc'd) reported the same problem some time ago:
http://lists.lm-sensors.org/pipermail/lm-sensors/2014-January/040993.html

His proposal looks pretty much the same as what Dale just suggested:
wrapper shell scripts.

My reply is here:
http://lists.lm-sensors.org/pipermail/lm-sensors/2014-July/042145.html

As a summary, I agree that there is a problem, but I am not a big fan of using wrapper shell scripts to solve it, for it defeats the purpose of systemd. Unfortunately I have to admit that I did not take the time to actually implement my idea in openSUSE, so I still don't know for sure if it would work OK.

What really surprises me though is that Dale seems to see the problem on Fedora, while I thought Jaromir had already committed his fix there, regardless of upstream acceptance. This is really a system integration issue so distributions are perfectly free to diverge. The example systemd service files are really only templates to build upon, they can be modified to accommodate distribution specifics as needed.

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Dale R. Worley
Quoted 5 lines

From: Jean Delvare <[email protected]>

What really surprises me though is that Dale seems to see the problem on Fedora, while I thought Jaromir had already committed his fix there, regardless of upstream acceptance.

It's possible that the patch has been put into Fedora 20 but not into Fedora 19 (which is what I'm running). (*Not* Fedora 16 as I mistakenly wrote, ugh.)

Quoted 3 lines

As a summary, I agree that there is a problem, but I am not a big fan of using wrapper shell scripts to solve it, for it defeats the purpose of systemd.

That's true. On the other hand, there's no way in systemd to mark an ExecStart action in a service as "execute this if and only if (some condition)".

(There are Conditional qualifiers you can put on a unit, but they seem to apply to the unit as a whole, and we always want the ExecStart of /usr/bin/sensors to run. If the ExecStart lines were put into Bash, we could use shell conditionals to handle it, but that is precisely what the design wants to avoid. I suppose you could split the modprobe into a separate until that is to be executed before lm_sensors.service, and have the configuration-detector do whatever is needed to tell systemd to ignore the unit if no modules need to be loaded.)

Quoted 3 lines

Unfortunately I have to admit that I did not take the time to actually implement my idea in openSUSE, so I still don't know for sure if it would work OK.

As James Morris said,

Finally, I'll offer eight opinions that computer scientists who venture into the real world should consider:
...
3. Virtual << Real.
...

We have to go with whatever exists.

Dale

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors