AnalogJ / scrutiny

Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds
MIT License
5.26k stars 168 forks source link

[BUG] Podman must run scrutiny with sudo #44

Open Karlthane opened 4 years ago

Karlthane commented 4 years ago

Describe the bug When running using podman, scurtiny-collector-metrics gives error " smartctl returned an error code of 2 while processing sdx type-metrics, and no data is in webpage

Expected behavior Expected is hdd smart data in webpage

Screenshots If applicable, add screenshots to help explain your problem.

Log Files If related to missing devices or SMART data, please run the collector in DEBUG mode, and attach the log file.

docker run -it --rm -p 8080:8080 \
-v /run/udev:/run/udev:ro \
--cap-add SYS_RAWIO \
--device=/dev/sda \
--device=/dev/sdb \
-e DEBUG=true \
-e COLLECTOR_LOG_FILE=/tmp/collector.log \
-e SCRUTINY_LOG_FILE=/tmp/web.log \
--name scrutiny \
analogj/scrutiny

# in another terminal trigger the collector
docker exec scrutiny scrutiny-collector-metrics run

# then use docker cp to copy the log files out of the container.
docker cp scrutiny:/tmp/collector.log collector.log
docker cp scrutiny:/tmp/web.log web.log

collector.log scrutiny smartctl-in-container-results.txt web.log

AnalogJ commented 4 years ago

Hey @Karlthane can you try running Scrutiny with --cap-add SYS_RAWIO and see if that works with podman? and then with --privileged?

Karlthane commented 4 years ago

Will check those, but testing per @Mihlo on the selfhosted discord, running it with sudo allows it to run successfully. Also have been running it with the --cap-add SYS_RAWIO. Will check --privileged.

Karlthane commented 4 years ago

First attempt with --privileged gets me error Error: invalid config provided: CapAdd and privileged are mutually exclusive options

With CapAdd changed out for privileged, starts fine, run the metric collection, and get the following. scrutiny-collector-metrics-run-privileged.txt

I hope this helps you.

AnalogJ commented 4 years ago

Ok, that's good to know. I'll make a note to document that sudo is required to deploy on podman.

zephyros-dev commented 1 year ago

Smartctl does not work without root permission due to https://www.smartmontools.org/ticket/61. I think it's safe to close this issue.