How to get xfce4-sensors plugin to show HDD temperature in XFCE panel?
Solution 1
I had the same Problem after upgrading to 13.04.
I would prefer a non-dirty solution also.
But This bugreport didn't provide any clean solution either
At least: The mentioned dirty solution worked for me:
set suid bit to hddtemp:
$
sudo chmod u+s /usr/sbin/hddtemp
$
xfce4-sensors
Solution 2
An alternative would be running hddtemp
as a daemon(eg. args: --listen=127.0.0.1 -dF
) listening on some TCP
port(default 7634
) on localhost
(or 127.0.0.1
) and having xfce4-sensors-plugin
query it on every refresh.
BUT, this only works if xfce4-sensors-plugin
was compiled with --disable-netcat
, otherwise(with --enable-netcat
it instead attempts to execute hddtemp
itself on every refresh! here's source code for my claims and I've also tested both ways (suid hddtemp and running hddtemp as daemon via a hddtemp.service).
Caveats:
- you have to specify all the HDD devices, that you want to monitor, when starting the
hddtemp
daemon.
ie.sudo hddtemp --listen=127.0.0.1 -dF /dev/sda /dev/sdb /dev/sdc
.
Only the specified devices will be seen byxfce4-sensors-plugin
. - If any devices specified above(at point 1) aren't present, there will be a
?
entry inxfce4-sensors-plugin
which you can keep visible at all times until the device(s) are present. This may or may not be what you want. But with a suid hddtemp and enabled netcat, it will only list the HDD devices present currently, and probably(untested) won't automatically add new ones in the future, so you'll have to enterProperties
and check/enable them yourself underSensors type: Hard disks
. -
xfce4-sensors-plugin
(latest git for today 27 Sept.2018) will lookuplocalhost
and connect(then disconnect) via TCP from the specified host/port on every refresh (eg. every 1 seconds if you haveUpdate interval (seconds)
set to1
) which means that you'll see(and I tested this) like 150 lines ofTIME_WAIT
in yournetstat -pantuW
command, so it will be hard to see anything else in there unless you pipe it throughgrep -v "127.0.0.1:7634.*TIME_WAIT"
I suppose.
I'm keeping a gist up to date with any further information here
Related videos on Youtube
![Daniel Yuste Aroca](https://i.stack.imgur.com/Cntm7.jpg?s=256&g=1)
Daniel Yuste Aroca
Updated on September 18, 2022Comments
-
Daniel Yuste Aroca almost 2 years
I am running Xubuntu 12.10 in my laptop and I would like to monitor the CPU and HDD temperatures. I have installed lm-sensors, hddtemp and xfce4-sensors-plugin and added the widget into the XFCE panel. Now, when I login or manually run
xfce4-sensors
in terminal, I get the following notification:"hddtemp" was not executed correctly, although it is executable. This is most probably due to the disks requiring root privileges to read their temperatures, and "hddtemp" not being setuid root. An easy but dirty solution is to run "chmod u+s /usr/sbin/hddtemp" as root user and restart this plugin or its panel. Calling "/usr/sbin/hddtemp -n -q /dev/sda" gave the following error: /dev/sda: Permission denied with a return value of 256.
When this happens I do not have any option to show the HDD temperature on the panel. However, if I run
gksudo xfce4-sensors
and enter the password I get no error and can show the HDD temperature on the pannel if I want to.Since root permissions are needed in order to run hddtemp and
chmod u+s /usr/sbin/hddtemp
is not recommended, what alternative do I have to run hddtemp from xfce4-sensors plugin automatically at login?-
John P almost 7 yearsYet another hack, but possibly better: run hddtemp as a daemon on startup, then use a genmon panel item to query it, listen on the daemon port, or grab the tail of the log file, however you configure the daemon. I'm not sure how this panel plugin was supposed to work, honestly, but I agree that you should never chmod things in sbin. As a last resort you could make a script that needs sudo, lock down the permissions, and add it to /etc/sudoers[.d/something] as NOPASSWD. Then it can overwrite a log file that you poll, again with a genmon plugin.
-
John P almost 7 yearsIn fact I'm surprised that this wasn't addressed in the 4 years since you posted it - if it was, no one bothered to reply here, even though it's very high in relevant search results. It's possible that you need to start the panel with gksudo, but if the permissions are inherited by the hddtemp item, that has implications for other plugins and their security, so I wouldn't recommend even trying it without more research.
-
-
loved.by.Jesus over 2 yearsCurrently (27.02.2022), when running the plug-in for the first time, it shows an error message and suggests this "dirty" solution. Anyway thanks for posting. The error message was to quick for me to fully read it. ;)