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: image

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 image

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)

Most upvoted comments

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… 322df861ea040d7be006693df35c87bf505e7ad0

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:

[ 8890.119932] hassio: port 14(vethf412c27) entered blocking state
[ 8890.119946] hassio: port 14(vethf412c27) entered disabled state
[ 8890.121145] device vethf412c27 entered promiscuous mode
[ 8890.121233] audit: type=1700 audit(1646638123.005:357): dev=vethf412c27 prom=256 old_prom=0 auid=4294967295 uid=0 gid=0 ses=4294967295
[ 8890.164127] audit: type=1325 audit(1646638123.049:358): table=nat family=2 entries=37 op=xt_replace pid=19074 subj==unconfined comm="iptables"
[ 8890.174496] audit: type=1325 audit(1646638123.061:359): table=filter family=2 entries=41 op=xt_replace pid=19076 subj==unconfined comm="iptables"
[ 8890.187126] audit: type=1325 audit(1646638123.073:360): table=nat family=2 entries=38 op=xt_replace pid=19078 subj==unconfined comm="iptables"
[ 8890.731150] audit: type=1325 audit(1646638123.617:361): table=nat family=2 entries=0 op=xt_register pid=19152 subj==unconfined comm="iptables"
[ 8890.740480] audit: type=1325 audit(1646638123.629:362): table=filter family=2 entries=0 op=xt_register pid=19153 subj==unconfined comm="iptables"
[ 8890.753290] audit: type=1325 audit(1646638123.641:363): table=nat family=2 entries=5 op=xt_replace pid=19156 subj==unconfined comm="iptables"
[ 8890.757971] audit: type=1325 audit(1646638123.645:364): table=nat family=2 entries=7 op=xt_replace pid=19157 subj==unconfined comm="iptables"
[ 8890.768699] audit: type=1325 audit(1646638123.657:365): table=nat family=2 entries=8 op=xt_replace pid=19159 subj==unconfined comm="iptables"
[ 8890.773053] audit: type=1325 audit(1646638123.661:366): table=nat family=2 entries=10 op=xt_replace pid=19160 subj==unconfined comm="iptables"
[ 8890.832559] eth0: renamed from veth1f32d41
[ 8890.855201] IPv6: ADDRCONF(NETDEV_CHANGE): vethf412c27: link becomes ready
[ 8890.855414] hassio: port 14(vethf412c27) entered blocking state
[ 8890.855426] hassio: port 14(vethf412c27) entered forwarding state

When the module is stopped :

[ 8971.865671] kauditd_printk_skb: 4 callbacks suppressed
[ 8971.865678] audit: type=1325 audit(1646638204.747:371): table=nat family=2 entries=39 op=xt_replace pid=19895 subj==unconfined comm="iptables"
[ 8971.878125] audit: type=1325 audit(1646638204.763:372): table=filter family=2 entries=42 op=xt_replace pid=19897 subj==unconfined comm="iptables"
[ 8971.889274] audit: type=1325 audit(1646638204.771:373): table=nat family=2 entries=38 op=xt_replace pid=19899 subj==unconfined comm="iptables"
[ 8971.918269] hassio: port 14(vethf412c27) entered disabled state
[ 8971.920036] veth1f32d41: renamed from eth0
[ 8971.986949] hassio: port 14(vethf412c27) entered disabled state
[ 8971.988454] device vethf412c27 left promiscuous mode
[ 8971.988490] hassio: port 14(vethf412c27) entered disabled state
[ 8971.988777] audit: type=1700 audit(1646638204.867:374): dev=vethf412c27 prom=0 old_prom=256 auid=4294967295 uid=0 gid=0 ses=4294967295
[ 8972.190736] audit: type=1325 audit(1646638205.075:375): table=nat family=2 entries=15 op=xt_unregister pid=15514 subj==unconfined comm="kworker/u8:0"
[ 8972.190765] audit: type=1325 audit(1646638205.075:376): table=filter family=2 entries=4 op=xt_unregister pid=15514 subj==unconfined comm="kworker/u8:0"

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…