hassio-addons: [Scrutiny] Disk list empty - Smartctl cannot access /dev/sda
- Addon name : Scrutiny
- Addon version : 0.3.13-6
Describe the bug
When starting the addon, there seems to be an error in the logs when searching the local disk. In the web interface, nothing appears. I have seen the same error in other issues with an NVMe disk, for my part it is a USB disk that is used. I think it is mounted as /dev/sda.
With Portainer I connected into the container, and here is the output of the command:
I have a second addon “HDD TOOLS” that works is also supposed to provide the smart data, and manages to do so if I made the same command in the container. The major difference in these addons is that yours does not require to be in “unprotected” mode, which may be causing the problem?
Supervisor logs
Full addon log
[migrations] started
[migrations] no migrations found
[cont-init.d] 01-migrations: exited 0.
[cont-init.d] 02-tamper-check: executing...
[cont-init.d] 02-tamper-check: exited 0.
[cont-init.d] 10-adduser: executing...
-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid: 0
User gid: 0
-------------------------------------
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 31-run.sh: executing...
[16:37:03] INFO: Setting permissions
rm: cannot remove '/config/crontabs/*': No such file or directory
[16:37:08] INFO: Hourly updates
[cont-init.d] 31-run.sh: exited 0.
[cont-init.d] 32-nginx.sh: executing...
[cont-init.d] 32-nginx.sh: exited 0.
[cont-init.d] 50-config: executing...
[cont-init.d] 50-config: exited 0.
[cont-init.d] 90-custom-folders: executing...
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2022/03/02 16:37:09 Loading configuration file: /scrutiny/config/scrutiny.yaml
___ ___ ____ __ __ ____ ____ _ _ _ _
/ __) / __)( _ \( )( )(_ _)(_ _)( \( )( \/ )
\__ \( (__ ) / )(__)( )( _)(_ ) ( \ /
(___/ \___)(_)\_)(______) (__) (____)(_)\_) (__)
github.com/AnalogJ/scrutiny dev-0.3.12
Start the scrutiny server
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
Trying to connect to database stored: /data/scrutiny.db
2022/03/02 16:37:09 /app/scrutiny/webapp/backend/pkg/web/middleware/sqlite3.go:27
[103.905ms] [rows:0] CREATE TABLE `self_tests` (`created_at` datetime,`updated_at` datetime,`deleted_at` datetime,`device_wwn` text,`date` datetime,CONSTRAINT `fk_self_tests_device` FOREIGN KEY (`device_wwn`) REFERENCES `devices`(`wwn`))
2022/03/02 16:37:09 /app/scrutiny/webapp/backend/pkg/web/middleware/sqlite3.go:28
[103.487ms] [rows:0] CREATE TABLE `smarts` (`id` integer,`created_at` datetime,`updated_at` datetime,`deleted_at` datetime,`device_wwn` text,`test_date` datetime,`smart_status` text,`temp` integer,`power_on_hours` integer,`power_cycle_count` integer,PRIMARY KEY (`id`),CONSTRAINT `fk_smarts_device` FOREIGN KEY (`device_wwn`) REFERENCES `devices`(`wwn`),CONSTRAINT `fk_devices_smart_results` FOREIGN KEY (`device_wwn`) REFERENCES `devices`(`wwn`))
2022/03/02 16:37:09 /root/go/pkg/mod/gorm.io/driver/sqlite@v1.1.3/migrator.go:242
[105.052ms] [rows:0] CREATE INDEX `idx_smarts_deleted_at` ON `smarts`(`deleted_at`)
[GIN-debug] GET /api/health --> github.com/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Setup.func1 (5 handlers)
[GIN-debug] POST /api/health/notify --> github.com/analogj/scrutiny/webapp/backend/pkg/web/handler.SendTestNotification (5 handlers)
[GIN-debug] POST /api/devices/register --> github.com/analogj/scrutiny/webapp/backend/pkg/web/handler.RegisterDevices (5 handlers)
[GIN-debug] GET /api/summary --> github.com/analogj/scrutiny/webapp/backend/pkg/web/handler.GetDevicesSummary (5 handlers)
[GIN-debug] POST /api/device/:wwn/smart --> github.com/analogj/scrutiny/webapp/backend/pkg/web/handler.UploadDeviceMetrics (5 handlers)
[GIN-debug] POST /api/device/:wwn/selftest --> github.com/analogj/scrutiny/webapp/backend/pkg/web/handler.UploadDeviceSelfTests (5 handlers)
[GIN-debug] GET /api/device/:wwn/details --> github.com/analogj/scrutiny/webapp/backend/pkg/web/handler.GetDeviceDetails (5 handlers)
[GIN-debug] GET /web/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (5 handlers)
[GIN-debug] HEAD /web/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (5 handlers)
[GIN-debug] GET / --> github.com/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Setup.func2 (5 handlers)
[GIN-debug] Listening and serving HTTP on 0.0.0.0:8080
[16:37:10] INFO: Starting NGinx...
2022/03/02 16:37:10 Loading configuration file: /scrutiny/config/collector.yaml
time="2022-03-02T16:37:10+01:00" level=info msg="Verifying required tools" type=metrics
time="2022-03-02T16:37:10+01:00" level=info msg="Executing command: smartctl --scan -j" type=metrics
time="2022-03-02T16:37:10+01:00" level=info msg="Executing command: smartctl --info -j -d sat /dev/sda" type=metrics
time="2022-03-02T16:37:10+01:00" level=error msg="Could not retrieve device information for sda: exit status 2" type=metrics
time="2022-03-02T16:37:10+01:00" level=info msg="Sending detected devices to API, for filtering & validation" type=metrics
time="2022-03-02T16:37:10+01:00" level=info msg="127.0.0.1 - db21ed7f-scrutiny [02/Mar/2022:16:37:10 +0100] \"POST /api/devices/register\" 200 413 \"\" \"Go-http-client/1.1\" (18ms)" clientIP=127.0.0.1 hostname=db21ed7f-scrutiny latency=18 method=POST path=/api/devices/register referer= respLength=413 statusCode=200 userAgent=Go-http-client/1.1
time="2022-03-02T16:37:10+01:00" level=info msg="Collecting smartctl results for sda\n" type=metrics
time="2022-03-02T16:37:10+01:00" level=info msg="Executing command: smartctl -x -j -d sat /dev/sda" type=metrics
time="2022-03-02T16:37:10+01:00" level=error msg="smartctl returned an error code (2) while processing sda\n" type=metrics
time="2022-03-02T16:37:10+01:00" level=error msg="smartctl could not open device" type=metrics
time="2022-03-02T16:37:10+01:00" level=info msg="Publishing smartctl results for \n" type=metrics
2022/03/02 16:37:10 /app/scrutiny/webapp/backend/pkg/web/handler/upload_device_metrics.go:31 WHERE conditions required
[0.264ms] [rows:0] UPDATE `devices` SET `created_at`="2022-03-02 16:37:10.584",`updated_at`="2022-03-02 16:37:10.855",`device_name`="sda",`device_type`="sat"
time="2022-03-02T16:37:10+01:00" level=error msg="An error occurred while updating device data from smartctl metrics WHERE conditions required"
time="2022-03-02T16:37:10+01:00" level=error msg="127.0.0.1 - db21ed7f-scrutiny [02/Mar/2022:16:37:10 +0100] \"POST /api/device//smart\" 500 17 \"\" \"Go-http-client/1.1\" (6ms)" clientIP=127.0.0.1 hostname=db21ed7f-scrutiny latency=6 method=POST path=/api/device//smart referer= respLength=17 statusCode=500 userAgent=Go-http-client/1.1
time="2022-03-02T16:37:10+01:00" level=info msg="Main: Completed" type=metrics
[16:37:10] INFO: Local Devices Added
Full addon config Config by default
System Raspberry Pi 4 with USB boot (SATA SSD)
- Supervisor version: supervisor-2022.01.1
- Host system version: Home Assistant OS 7.4
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (13 by maintainers)
Thanks! Mmh its weird it doesn’t show which apparmor element denies the action… Here is a screenshot from another apparmor degugging I had with @aLTeReGo-SWI where he had clear apparmor messages…
I’m not an expert on that, do you have an idea how to access those apparmor logs?
I’m still trying to use the apparmor path and avoid giving full access to maintain the highest security on the addon… thanks 😃
Of course, here are the requested logs
At the start of the module:
When the module is stopped :
Well sdcard doesn’t have smart capability (as quite a number of ssd), but I see your point
I’ll probably put a version allowing full access then as I can’t see a way around it…
But more basically I don’t understand why you have a apparmor error… I’ve just reinstalled it on rpi4b and it accesses sda1 without issue…