[BUG] OSS4 disables CPU sensors on ThinkPad laptops

OSS specific Linux discussion (x86/amd64)

Moderators: hannu, dev, cesium

Known Member
Posts: 1256
Joined: Sun Jun 28, 2009 9:31 pm

[BUG] OSS4 disables CPU sensors on ThinkPad laptops

Postby igorzwx » Tue Mar 05, 2013 9:49 pm

PROBLEM: OSS4 prevents the thinkpad_acpi driver from being loaded, and, therefore, CPU temperature cannot be monitored. This means that your processor might be burned (in a few seconds). Example: viewtopic.php?f=3&t=5206

WORKAROUND: "soundon" is an ordinary bash script. You can open it with a text editor and modify it how you want. This will be explained below.

The root cause of troubles is a kind of PulseAlsa conspiracy:

As of kernel 2.6.33 the thinkpad_acpi driver now has a ALSA sub-driver which creates an additional ALSA volume control which represents the volume and mute buttons on the ThinkPad keyboard. Unfortunately no further integration exists at this point with userspace, such as PulseAudio and as such there is no effective change for the end-user...
The driver replaces ibm-acpi... To confuse matters further, it appears that... The current thinkpad-acpi contains essentially the same functionality as ibm-acpi with some added features. Among which are registering of acpi events to the "thinkvantage" and volume/mute buttons which could previously only be accessed through the use of the tpb utility.

It means that all IBM/Lenovo ThinkPad laptops are likely to have this problem with OSS4 and Linux since kernel 2.6.33. It also affects (directly or indirectly) some other hardware monitoring tools.

Why does OSS4 prevent the thinkpad_acpi driver from being loaded?

Because "thinkpad_acpi driver now has a ALSA sub-driver" which tries to load ALSA modules, such as "snd" and "soundcore". However, the thinkpad_acpi driver is disabled indirectly and unintentionally.

What is actually going on?

OSS4 is started with the "soundon" script. It checks whether ALSA drivers are loaded or not.

1. If ALSA drivers are installed but not loaded, soundon does nothing about them.

2. If at least one ALSA driver is loaded, soundon removes all ALSA drivers from the Linux kernel and compresses them into a "secret archive".
Then OSS4 fails to start:

Code: Select all

$ sudo soundon
Failed to disable conflicting sound drivers
Reboot and try running soundon again
Also check that you have not compiled sound support statically
into the kernel.

The reason is simple:

Code: Select all

$ lsmod | grep snd
snd                    62064  1 thinkpad_acpi
soundcore              14635  1 snd
$ sudo rmmod snd
ERROR: Module snd is in use by thinkpad_acpi
$ sudo rmmod soundcore
ERROR: Module soundcore is in use by snd

To unload snd and soundcore, you should first unload thinkpad_acpi:

Code: Select all

$ sudo rmmod thinkpad_acpi
$ sudo rmmod snd
$ sudo rmmod soundcore
$ lsmod | grep snd

Since soundon fails to unload snd and soundcore, you have to reboot the system.
OSS4 is now running without problems. But the thinkpad_acpi driver fails to be loaded, because "snd" and "soundcore" are missing.

WORKAROUND (tested on IBM ThinkPad R40):

It is presumed that all ALSA drivers are already removed by soundon. Otherwise, you may blacklist them all (except for "snd" and "soundcore") and reboot.

1. [Optional] Blacklist thinkpad_acpi

Code: Select all

$ cat /etc/modprobe.d/blacklist-thinkpad_acpi.conf
blacklist thinkpad_acpi

See: https://wiki.archlinux.org/index.php/Ke ... obe.d.2F_2

2. Blacklist all ALSA drivers, except for "snd" and "soundcore".

Code: Select all

$ cat /etc/modprobe.d/blacklist-alsa.conf
blacklist snd-seq
blacklist snd-seq-device
blacklist snd-seq-dummy
blacklist snd-seq-instr
blacklist snd-seq-midi
blacklist snd-seq-midi-emul
blacklist snd-seq-midi-event
blacklist snd-seq-oss
blacklist snd-seq-virmidi
blacklist snd-dummy
blacklist snd-virmidi
blacklist snd-loopback
blacklist snd-ac97-codec
blacklist snd-ad1816a
blacklist snd-ad1816a-lib
blacklist snd-ad1848
blacklist snd-ad1848-lib
blacklist snd-ainstr-fm
blacklist snd-ainstr-gf1
blacklist snd-ainstr-iw
blacklist snd-ainstr-simple
blacklist snd-ak4117
blacklist snd-ak4531-codec
blacklist snd-ak4xxx-adda
blacklist snd-ali5451
blacklist snd-als100
blacklist snd-als300
blacklist snd-als4000
blacklist snd_aoa
blacklist snd_aoa_codec_tas
blacklist snd_aoa_fabric_layout
blacklist snd_aoa_i2sbus
blacklist snd_aoa_soundbus
blacklist snd-armaaci
blacklist snd-asihpi
blacklist snd-atiixp
blacklist snd-atiixp-modem
blacklist snd-au1x00
blacklist snd-au8810
blacklist snd-au8820
blacklist snd-au8830
blacklist snd-azt2320
blacklist snd-azt3328
blacklist snd-bt87x
blacklist snd-ca0106
blacklist snd-cmi8330
blacklist snd-cmipci
blacklist snd-cs4231
blacklist snd-cs4231-lib
blacklist snd-cs4232
blacklist snd-cs4236
blacklist snd-cs4236-lib
blacklist snd-cs4281
blacklist snd-cs46xx
blacklist snd-cs8427
blacklist snd-darla20
blacklist snd-darla24
blacklist snd-dt019x
blacklist snd-echo3g
blacklist snd-emu10k1
blacklist snd-emu10k1-synth
blacklist snd-emu10k1x
blacklist snd-emu8000-synth
blacklist snd-emux-synth
blacklist snd-ens1370
blacklist snd-ens1371
blacklist snd-es1688
blacklist snd-es1688-lib
blacklist snd-es18xx
blacklist snd-es1938
blacklist snd-es1968
blacklist snd-es968
blacklist snd-fm801
blacklist snd-fm801-tea575x
blacklist snd-gina20
blacklist snd-gina24
blacklist snd-gusclassic
blacklist snd-gusextreme
blacklist snd-gus-lib
blacklist snd-gusmax
blacklist snd-gus-synth
blacklist snd-harmony
blacklist snd-hda-intel
blacklist snd-hdsp
blacklist snd-hdspm
blacklist snd-hwdep
blacklist snd-i2c
blacklist snd-ice1712
blacklist snd-ice1724
blacklist snd-ice17xx-ak4xxx
blacklist snd-indigo
blacklist snd-indigodj
blacklist snd-indigoio
blacklist snd-intel8x0
blacklist snd-intel8x0m
blacklist snd-interwave
blacklist snd-interwave-stb
blacklist snd-korg1212
blacklist snd-layla20
blacklist snd-layla24
blacklist snd-maestro3
blacklist snd-mia
blacklist snd-miro
blacklist snd-mixart
blacklist snd-mixer-oss
blacklist snd-mona
blacklist snd-mpu401
blacklist snd-mpu401-uart
blacklist snd-msnd-pinnacle
blacklist snd-mtpav
blacklist snd-mts64
blacklist snd-nm256
blacklist snd-opl3-lib
blacklist snd-opl3sa2
blacklist snd-opl3-synth
blacklist snd-opl4-lib
blacklist snd-opl4-synth
blacklist snd-opti92x-ad1848
blacklist snd-opti92x-cs4231
blacklist snd-opti93x
blacklist snd-page-alloc
blacklist snd-pc98-cs4232
blacklist snd-pcm
blacklist snd-pcm-oss
blacklist snd-pcsp
blacklist snd-pcxhr
blacklist snd-pdaudiocf
blacklist snd-pdplus
blacklist snd-portman2x4
blacklist snd-powermac
blacklist snd-pxa2xx-ac97
blacklist snd-rawmidi
blacklist snd-rme32
blacklist snd-rme96
blacklist snd-rme9652
blacklist snd-rtctimer
blacklist snd-s3c2410
blacklist snd-sa11xx-uda1341
blacklist snd-sb16
blacklist snd-sb16-csp
blacklist snd-sb16-dsp
blacklist snd-sb8
blacklist snd-sb8-dsp
blacklist snd-sbawe
blacklist snd-sb-common
blacklist snd-serialmidi
blacklist snd-serial-u16550
blacklist snd-sgalaxy
blacklist snd-sonicvibes
blacklist snd-sscape
blacklist snd-sun-amd7930
blacklist snd-sun-cs4231
blacklist snd-sun-dbri
blacklist snd-tea575x-tuner
blacklist snd-tea6330t
blacklist snd-timer
blacklist snd-trident
blacklist snd-trident-synth
blacklist snd-usb-audio
blacklist snd-usb-lib
blacklist snd-usb-usx2y
blacklist snd-util-mem
blacklist snd-via82xx
blacklist snd-via82xx-modem
blacklist snd-vx222
blacklist snd-vx-cs
blacklist snd-vx-lib
blacklist snd-vxp440
blacklist snd-vxpocket
blacklist snd-wavefront
blacklist snd-ymfpci

On Ubuntu and Linux Mint this can be easily done with dpkg-reconfigure

Code: Select all

$ sudo dpkg-reconfigure linux-sound-base

See: https://help.ubuntu.com/community/OpenS ... el_Modules

3. [Optional] To avoid troubles, you may also add the nvram driver to /etc/modules

Code: Select all

$ cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.


4. Edit the soundon script with a text editor

Code: Select all

$ whereis soundon
soundon: /usr/sbin/soundon /usr/share/man/man1/soundon.1.gz
$ sudo gedit /usr/sbin/soundon

At the beginning of the soundon script (after #!/bin/sh) add

Code: Select all

rmmod thinkpad_acpi
rmmod snd
rmmod soundcore

It should look like this:

Code: Select all

rmmod thinkpad_acpi
rmmod snd
rmmod soundcore

At the end of the soundon script (before "exit 0") add "modprobe thinkpad_acpi"

It should look like this:

Code: Select all

modprobe thinkpad_acpi
exit 0

5. If ALSA modules are already removed by soundon, restore them:

Code: Select all

$ cd /lib/modules/$(uname -r)
$ sudo tar -xjf sound-preoss.tar.bz2
$ sudo depmod -a

See: viewtopic.php?f=3&t=4772#p18645

6. Load thinkpad_acpi:

Code: Select all

$ sudo modprobe thinkpad_acpi
$ lsmod | grep thinkpad_acpi
thinkpad_acpi          73942  0
snd                    62064  1 thinkpad_acpi
nvram                  14029  1 thinkpad_acpi
$ lsmod | grep snd
snd                    62064  1 thinkpad_acpi
soundcore              14635  1 snd

7. Run "sensors":

Code: Select all

$ sensors
Adapter: Virtual device
temp1:        +44.0°C  (crit = +97.0°C)

Adapter: ISA adapter
fan1:           0 RPM
temp1:        +44.0°C 
temp2:        +46.0°C 
temp3:         +0.0°C 
temp4:         +0.0°C 
temp5:         +0.0°C 
temp6:         +0.0°C 
temp7:         +0.0°C 
temp8:         +0.0°C 

You may also add a sensors applet to panel.

You have now both OSS4 and CPU sensors.
And you can safely perform soundoff/soundon and reboot.

WARNING: If you upgrade or re-install OSS4, you may need to repeat some steps. To avoid problems, you may fix a new soundon, before you run it first time.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 4 guests