如何让 xfce4-sensors 插件在 XFCE 面板中显示 HDD 温度?

如何让 xfce4-sensors 插件在 XFCE 面板中显示 HDD 温度?

我的笔记本电脑正在运行 Xubuntu 12.10,我想监控 CPU 和 HDD 温度。我已经安装了 lm-sensors、hddtemp 和 xfce4-sensors-plugin,并将小部件添加到 XFCE 面板中。现在,当我登录或xfce4-sensors在终端中手动运行时,我会收到以下通知:

"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. 

发生这种情况时,我没有任何选项可以在面板上显示硬盘温度。但是,如果我运行gksudo xfce4-sensors并输入密码,则不会出现错误,并且可以根据需要在面板上显示硬盘温度。

由于运行 hddtemp 需要 root 权限并且chmod u+s /usr/sbin/hddtemp不建议这样做,有什么其他方法可以在登录时自动从 xfce4-sensors 插件运行 hddtemp?

答案1

升级到 13.04 后我遇到了同样的问题。

我也希望有一个不肮脏的解决方案。

此错误报告 也没有提供任何干净的解决方案

至少:所提及的肮脏的解决方案对我有用:

将 suid 位设置为 hddtemp:

$sudo chmod u+s /usr/sbin/hddtemp

$xfce4-sensors

答案2

另一种方法是hddtemp作为守护进程(例如 args: )运行,监听(或)--listen=127.0.0.1 -dF上的某个TCP端口(默认7634),并在每次刷新时查询它。 localhost127.0.0.1xfce4-sensors-plugin

但是,这仅在xfce4-sensors-plugin使用 编译时才有效--disable-netcat,否则(使用--enable-netcat反而hddtemp尝试在每次刷新时执行自身!这是我的声明的源代码并且我也测试了这两种方法(suid hddtemp 并通过 hddtemp.service 将 hddtemp 作为守护进程运行)。

注意事项:

  1. 启动守护进程时,您必须指定要监控的所有 HDD 设备hddtemp
    IE。sudo hddtemp --listen=127.0.0.1 -dF /dev/sda /dev/sdb /dev/sdc
    只有指定的设备才能被看到xfce4-sensors-plugin
  2. 如果上面(第 1 点)指定的任何设备不存在,则会有一个?条目,xfce4-sensors-plugin您可以始终将其保持可见,直到设备出现。这可能是您想要的,也可能不是您想要的。但是,使用 suid hddtemp 和启用 netcat 时,它只会列出当前存在的 HDD 设备,并且可能(未经测试)将来不会自动添加新设备,因此您必须Properties在 下输入并自行检查/启用它们Sensors type: Hard disks
  3. xfce4-sensors-plugin2018 年 9 月 27 日今天的最新 git) 将要抬头localhost并在每次刷新时通过 TCP 从指定的主机/端口连接(然后断开连接)(例如,如果您已设置Update interval (seconds)为,则每 1 秒一次),这意味着您将看到(并且我已经测试过)命令中1的 150 行,所以除非您通过管道传输它,否则很难看到其中的任何其他内容。 TIME_WAITnetstat -pantuWgrep -v "127.0.0.1:7634.*TIME_WAIT"

我会及时更新任何进一步的信息这里

相关内容