Draggon / hassio-hdd-tools

27 stars 14 forks source link

S.M.A.R.T. not Work - Smartctl open device - Operation not permitted #35

Closed andrewjswan closed 2 years ago

andrewjswan commented 3 years ago

After HA update i have:

{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      2
    ],
    "svn_revision": "5155",
    "platform_info": "x86_64-linux-5.10.62",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-a",
      "--json",
      "/dev/sda"
    ],
    "messages": [
      {
        "string": "Smartctl open device: /dev/sda failed: Operation not permitted",
        "severity": "error"
      }
    ],
    "exit_status": 2
  }
}
McGiverGim commented 3 years ago

Are you using the latest version of HDD tools? Have you configured it using the UI?

andrewjswan commented 3 years ago

Are you using the latest version of HDD tools?

HDD Tools - Current version: 0.50.1

Have you configured it using the UI?

Yes, Configuration did not change, after updating HA, stopped updating the sensor, I looked at the log, there is an error, turned on the debugging got what is above.

My current config:

sensor_name: sensor.ssd_temp
friendly_name: SSD Temp
hdd_path: /dev/disk/by-id/ata-KINGSTON_RBUSNS8180S3128GJ_50026B76821D0D9B
attributes_format: object
attributes_property: smart_status
check_period: 15
database_update: true
database_update_period: 168
performance_check: false
debug: false
output_file: temp.log
andrewjswan commented 3 years ago

In log:

[Wed Sep 29 10:55:22 EEST 2021][INFO] Updating drives database...
[Wed Sep 29 10:55:25 EEST 2021][INFO] /usr/share/smartmontools/drivedb.h updated from branches/RELEASE_7_2_DRIVEDB
[Wed Sep 29 10:55:25 EEST 2021][INFO] Apply cron tab
[Wed Sep 29 10:55:25 EEST 2021][INFO] Device /dev/sda found - starting CRON
jq: error: syntax error, unexpected '{', expecting $end (Unix shell quoting issues?) at <top-level>, line 2:
{}
jq: 1 compile error
[Wed Sep 29 11:00:00 EEST 2021][INFO] Sensor value: null°
[Wed Sep 29 11:00:00 EEST 2021][INFO] Sensor update response code: 400
andrewjswan commented 3 years ago

HA OS on Intel NUC

andrewjswan commented 3 years ago

@McGiverGim Any ideas?

McGiverGim commented 3 years ago

Not at this moment. I've the latest version of Home Assistant and it's working for me ☹️

andrewjswan commented 3 years ago

Strange, what could have happened? I didn't change the configuration.

Dreffi88 commented 3 years ago

I think I got the same Problem since a few days after a reboot of my Raspberry Pi 4. Before the reboot everything worked fine. Log:

{ "json_format_version": [ 1, 0 ], "smartctl": { "version": [ 7, 2 ], "svn_revision": "5155", "platform_info": "aarch64-linux-5.10.17-v8", "build_info": "(local build)", "argv": [ "smartctl", "-a", "--json", "/dev/sda" ], "messages": [ { "string": "Smartctl open device: /dev/sda [SAT] failed: Operation not permitted", "severity": "error" } ], "exit_status": 2 } }

andrewjswan commented 3 years ago

Not at this moment. I've the latest version of Home Assistant and it's working for me

Can you try reboot you Host?

McGiverGim commented 3 years ago

Can you try reboot you Host?

True, I rebooted the host and the error is here. I will try to find the culprit. Strange.

McGiverGim commented 3 years ago

I don't know if intended or not... We have this in our config file:

"privileged": ["SYS_ADMIN", "SYS_RAWIO"],

With this and this schema:

"hdd_path": "device(subsystem=block)",

it worked until now.

Now it does not work. I don't know if this is an intended change in Home Assistant or is a bug. But I don't know where to report it because I don't know if it is a Operating System bug or it belongs to other part. I have verified that if I add again full access to the addon:

"full_access": true,

it works, but the addon score goes down to 1 only.

Someone knows where to report this? If we can't get a response I will modify the addon asking for full access, but I want to try if it is a Home Assistant bug first.

McGiverGim commented 3 years ago

If someone has it working, and has the portainer addon installed, I would like to see the "inspect" data to compare with mine that now does not work.

andrewjswan commented 3 years ago

thanks, we will follow the reaction of the developer HA

andrewjswan commented 2 years ago

I didn't quite understand the bottom line on our problem (Issue closed). In the documentation I saw two possible options that could help us, devices and a devicetree. But I understand that we need to make changes to the addon?

McGiverGim commented 2 years ago

The Home Assistant developers usually don't want to discuss anything... They close and ready. This problem happened before: https://github.com/Draggon/hassio-hdd-tools/issues/10

I will push changes when I have some time, adding the more habitual devices to the list and enabling the full access for the others.

andrewjswan commented 2 years ago

Thanks!

McGiverGim commented 2 years ago

I have released version 0.50.2. You will need to disable protected mode.

I continue thinking there is a bug in Home Assistant, I will open a new issue but I don't think it will serve for nothing.