hassio-addons/addon-mqtt-io

RuntimeError: No access to /dev/mem. Try running as root!

Closed this issue ยท 16 comments

Not Working.....

Home Assistant 2023.1.6

Supervisor 2022.12.1

Operating System 9.4

Interface: 20230110.0 - latest

MQTT IO - Current version: 0.2.1

My config...
/config/mqtt-io/config.yml

mqtt:
host: 192.168.15.200
port: 1883
user: "samuel"
password: "46173106"
topic_prefix: mqtt_io
ha_discovery:
enabled: yes

gpio_modules:

name: rpi_gpio
module: raspberrypi
digital_outputs:

name: Fonte
module: rpi_gpio
pin: 7
on_payload: "on"
off_payload: "off"
initial: high
publish_initial: yes
retain: yes
Log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
Add-on: MQTT IO
Expose GPIO modules and digital sensors via MQTT for remote control and monitoring.
Add-on version: 0.2.1
You are running the latest version of this add-on.
System: Home Assistant OS 9.4 (aarch64 / raspberrypi3-64)
Home Assistant Core: 2023.1.6
Home Assistant Supervisor: 2022.12.1
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mqtt-io: starting
s6-rc: info: service mqtt-io successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[20:14:40] INFO: Starting MQTT IO...
2023-01-20 20:14:53 mqtt_io.main [ERROR] MqttIo crashed!
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mqtt_io/main.py", line 107, in main
mqtt_gpio.run()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 1241, in run
self._init_digital_outputs()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 453, in _init_digital_outputs
gpio_module.setup_pin_internal(PinDirection.OUTPUT, out_conf)
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/init.py", line 208, in setup_pin_internal
return self.setup_pin(
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 56, in setup_pin
self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int)
RuntimeError: No access to /dev/mem. Try running as root!
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.10/site-packages/mqtt_io/main.py", line 115, in
main()
File "/usr/lib/python3.10/site-packages/mqtt_io/main.py", line 107, in main
mqtt_gpio.run()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 1241, in run
self._init_digital_outputs()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 453, in _init_digital_outputs
gpio_module.setup_pin_internal(PinDirection.OUTPUT, out_conf)
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/init.py", line 208, in setup_pin_internal
return self.setup_pin(
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 56, in setup_pin
self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int)
RuntimeError: No access to /dev/mem. Try running as root!
[20:14:53] INFO: Service MQTT IO exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service mqtt-io: stopping
s6-rc: info: service mqtt-io successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Did it work on 0.2.0 or earlier? I have same issue #45

before it worked normally in version 2023.1.1 it stopped working after updating home assistant 2023.1.4

I run mqtt-io upgrade before home assistant (.5->.6) and it stops working. It's probably not related to HA version.

Having same error
Downgrading to 0.1.3 fixes issue

Same issue on my installation:
Add-on version: 0.2.1
You are running the latest version of this add-on.
System: Home Assistant OS 9.4 (armv7 / raspberrypi3)
Home Assistant Core: 2023.1.6
Home Assistant Supervisor: 2022.12.1

Thanks to hauard. Restoring the backup of version 0.1.3 helped.

Same issue also on my instalation - in my case it is connected with output configuration, when i delet it (part of configuration responsible for outputs or raspberry pi, as below), add-on is back to working properly (with only sensor configuration).

I see this issue from update 0.2.0.

Add-on config file - part for output:

gpio_modules:
  - name: raspberrypi
    module: raspberrypi

digital_outputs:
  - name: syrena_alarmowa
    module: raspberrypi
    pin: 14
    on_payload: "ON"
    off_payload: "OFF"
    initial: low
    ha_discovery:
      name: syrena_alarmowa

My logs:

2023-01-22 08:42:21 mqtt_io.__main__ [ERROR] MqttIo crashed!
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/mqtt_io/__main__.py", line 107, in main
    mqtt_gpio.run()
  File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 1241, in run
    self._init_digital_outputs()
  File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 453, in _init_digital_outputs
    gpio_module.setup_pin_internal(PinDirection.OUTPUT, out_conf)
  File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/__init__.py", line 208, in setup_pin_internal
    return self.setup_pin(
  File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 56, in setup_pin
    self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int)
RuntimeError: No access to /dev/mem.  Try running as root!
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.10/site-packages/mqtt_io/__main__.py", line 115, in <module>
    main()
  File "/usr/lib/python3.10/site-packages/mqtt_io/__main__.py", line 107, in main
    mqtt_gpio.run()
  File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 1241, in run
    self._init_digital_outputs()
  File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 453, in _init_digital_outputs
    gpio_module.setup_pin_internal(PinDirection.OUTPUT, out_conf)
  File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/__init__.py", line 208, in setup_pin_internal
    return self.setup_pin(
  File "/usr/lib/python3.10/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 56, in setup_pin
    self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int)
RuntimeError: No access to /dev/mem.  Try running as root!

Hardware

  • Platform: Raspberry Pi 4

System:

  • OS: HASS.IO ver. 9.4
  • Home Assistant 2023.1.6
  • Add-on: MQTT IO ver. 0.2.1
Cr4psy commented

Same issue on my installation too, the issue started on the 21st:
MQTT-IO Add-on version: 0.2.1
Home Assistant 2022.7.5
Supervisor 2022.12.1
Operating System 8.2
Frontend 20220707.1 - latest

Restoring to version 1.3 worked.

For people that are looking for restoring the backup, just go to:
Setting > Systems > Backup
http://homeassistant.local:8123/hassio/backups
Press on the backup and restore.

hauard commented

Same issue on my installation too, the issue started on the 21st: MQTT-IO Add-on version: 0.2.1 Home Assistant 2022.7.5 Supervisor 2022.12.1 Operating System 8.2 Frontend 20220707.1 - latest

Restoring to version 1.3 worked.

For people that are looking for restoring the backup, just go to: Setting > Systems > Backup http://homeassistant.local:8123/hassio/backups Press on the backup and restore.

Great tip Anthony!
Further information about restoring: You are not required to do a full restore; it is possible to restore just a certain addon. When choosing which backup to restore from, choose partial backup, find the (in this case, MQTT-IO-) addon to restore, check it, and hit restore.

itsib commented

I still get same issue. I'm restored my backup 0.1.3 version, it works fine.

I have the same error. Restoring 0.2.0 didn't work but 0.1.3 works fine.

hauard commented

@frenck Maybe consider withdrawing 0.2.1 ?

I didn't make backup of version 0.1.3 before upgrade to 0.2.1. Could somebody post backup of version 0.1.3? Thanks.

Edit: To those, who didn't make backup. I installed version 0.2.1 as local addon, but edited in mqtt-io\config.yaml file:

devices:

  • /dev

to this:

devices:

  • /dev/mem
  • /dev/gpiomem

And it is working now again.

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment ๐Ÿ‘
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

hauard commented

Upgrading to 0.2.1 with core 3.1, but same issue continues to occur, this is not solved.

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment ๐Ÿ‘
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

hauard commented

Tried upgrading to 0.2.1 on core 4.2, same issue.