Ksensors still not working with hddtemp for normal users

Bug #109472 reported by Dario Teixeira
6
Affects Status Importance Assigned to Milestone
hddtemp (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Binary package hint: ksensors

Back in the Dapper days, ksensors used to work fine with hddtemp, to monitor the hard drive temperature. A regression was introduced in Edgy, and a <a href="https://bugs.launchpad.net/ubuntu/+source/ksensors/+bug/68825">bug report was filed</a>. This bug was quickly flagged with "Fix released", with a promise that it would be fixed in Feisty. Well, it wasn't, at least not completely. Though the output parsing bug that caused the bug in Edgy has indeed been fixed (I checked the source), there is still a problem: ksensors invokes hddtemp directly, but hddtemp requires root permissions to read the hard drive temperature. The result is that ksensors fails.

There is a quick (dangerous) solution: chmod +s to the hddtemp binary. The better solution would be to patch ksensors so that it gets the temperature via the hddtemp daemon. This deamon is listening on port 7634 by default, as the following command can verify:

netcat localhost 7634

Now, I took a brief look at the ksensors code, and changing the hdsensorslist.cpp file so that it instead of invoking "hddtemp", it invokes "netcat localhost 7634" might be enough to do the trick (though you might want to add an option to configure the actual port). Also, don't forget to change the regex that does the parsing, since the output from the hddtemp daemon is different from the command line utility.

Revision history for this message
Dario Teixeira (darioteixeira) wrote :

I am attaching a workaround to this bug which avoids the unpleasantness of setuid-ing the hddtemp binary. The idea: to place a small bash script in the users private bin directory, with the same name as the hddtemp binary. This script invokes "netcat localhost 7634" to get the raw hard drive temperature info from the hddtemp daemon, parses this data, and outputs it in exactly the same format used by hddtemp. When ksensors invokes "hddtemp", this script gets executed instead of the real hddemp binary. It's simple and it works!

Revision history for this message
Ibrahim (ib80) wrote :

Thanks Dario,
I can confirm this bug. No HDD temperature was displayed before I used the script.
However, when I use your script, I get six times the same hard disk displayed. I do have six SATA slots, but only four of them are used. Also, all six readings are exactly the same. Same temperature and same label. Any idea what might be causing this? I had to wget your script. Swiftweasel added a funny character after the degree sign at the end of the script.

Revision history for this message
Ibrahim (ib80) wrote :

I wrote a script of my own that can handle mutli hard drive systems.
It is in Perl. Works fine on my machine. You may do with it whatever you want, but don't blame me if your PC melts when running it ;D .
There is still one issue though, at start, Ksensors does not detect correctly the HDD's names. So you have to rename them by hand :( .

Revision history for this message
Rich Johnson (nixternal) wrote :

It kind of stinks that KSensors is deprecated, as in it has been developed or worked on in 3 years. Another option is to check out Kima in the mean time.

Whatever Debian did to the parsing last year may have caused the issue. I will look into it a little more here. Thanks everyone for your scripts and ideas.

Revision history for this message
Rich Johnson (nixternal) wrote :

AHH! KSensors ran as root works like a charm :) Anyone know of the dangers in doing so?

Rich Johnson (nixternal)
Changed in ksensors:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Rich Johnson (nixternal) wrote :

OK, I just got done speaking with the developer of KSensors.

As for running KSensors as root, this is a bad thing.

As for doing the SUID trick on HDTemp, this is not such a bad thing.

His recommendation was to run 'dpkg-reconfigure hdtemp' and when asked if you want to suid hdtemp, you should go ahead and do so.

So, now the question is, is this a KSensors issue or is it a HDTemp issue?

Revision history for this message
Rich Johnson (nixternal) wrote :

I am going to transfer this over as a "hddtemp" bug now as it isn't KSensors fault for hddtemp not running or configured to run with SUID root, which after speaking with the developers, is a safer alternative than running KSensors as root in order for this to work. The current work around is listed in the post just previous to this one. Thank you!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.