Read Only File System error when adding integration in Home Assistant

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version |
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=0
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    (also happens with 9.0.2 beta on another system with different hardware)
  • Distro version | bookworm
  • Kernel version | Linux DietPi 6.5.0-0.deb12.4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.10-1~bpo12+1 (2023-11-23) x86_64 GNU/Linux
  • Architecture |
  • SBC model | amd64 (Intel Nuc 11 Essential, same issue on Intel NUC 8i3BEH
  • Power supply used | OEM power supply
  • SD card used | M.2 nvme drive (Samsung EVO 870)

Additional Information (if applicable)

  • Software title | Home Assistant
  • Updated
  • Replicable on 2 separate instances

Steps to reproduce

  1. Update DietPi and Home Assistant
  2. Install Midea Air Appliances (LAN) through HACS
  3. Try to add Midea Dehumidifier integration (which used to work before, but stopped due to changes in Home Assistant)
  4. Check logs

Expected behaviour

  • Midea Dehumidifier integration should work

Actual behaviour

HA cannot load the integration, and 2 errors are found in the logs, both linked to a ‘Read Only file system’ issue:

Logger: homeassistant.loader
Source: loader.py:822
First occurred: 11:38:41 (1 occurrences)
Last logged: 11:38:41

Unexpected exception importing component custom_components.midea_dehumidifier_lan
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 822, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/midea_dehumidifier_lan/__init__.py", line 29, in <module>
    from midea_beautiful.cloud import MideaCloud
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/__init__.py", line 7, in <module>
    from midea_beautiful.lan import LanDevice, appliance_state
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/lan.py", line 13, in <module>
    from midea_beautiful.appliance import Appliance
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/appliance.py", line 8, in <module>
    from midea_beautiful.command import (
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/command.py", line 17, in <module>
    _order_lock = RLock()
                  ^^^^^^^
  File "/usr/local/lib/python3.11/multiprocessing/context.py", line 73, in RLock
    return RLock(ctx=self.get_context())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/multiprocessing/synchronize.py", line 194, in __init__
    SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1, ctx=ctx)
  File "/usr/local/lib/python3.11/multiprocessing/synchronize.py", line 57, in __init__
    sl = self._semlock = _multiprocessing.SemLock(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system

and

Logger: homeassistant.setup
Source: setup.py:251
First occurred: 11:38:41 (1 occurrences)
Last logged: 11:38:41

Setup failed for custom integration 'midea_dehumidifier_lan': Unable to import component: Exception importing custom_components.midea_dehumidifier_lan
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 822, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/midea_dehumidifier_lan/__init__.py", line 29, in <module>
    from midea_beautiful.cloud import MideaCloud
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/__init__.py", line 7, in <module>
    from midea_beautiful.lan import LanDevice, appliance_state
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/lan.py", line 13, in <module>
    from midea_beautiful.appliance import Appliance
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/appliance.py", line 8, in <module>
    from midea_beautiful.command import (
  File "/usr/local/lib/python3.11/site-packages/midea_beautiful/command.py", line 17, in <module>
    _order_lock = RLock()
                  ^^^^^^^
  File "/usr/local/lib/python3.11/multiprocessing/context.py", line 73, in RLock
    return RLock(ctx=self.get_context())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/multiprocessing/synchronize.py", line 194, in __init__
    SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1, ctx=ctx)
  File "/usr/local/lib/python3.11/multiprocessing/synchronize.py", line 57, in __init__
    sl = self._semlock = _multiprocessing.SemLock(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 830, in get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.midea_dehumidifier_lan

For info, both systems have either a 256 or a 512GB drive of which literally about 1GB is used.
Adding other integrations also works, and adding and removing e.g. folders in the CLI also works.

Hi

Following this as it’s happening something similar to my dietpi installation.
I basically sometimes find samba and pihole unreachable also dietpi dashboard not displying anything in services and programs tab.

I just checked dietpi-drivemanager and I got the read only error for rootfs, a reboot fixes it but it happened quite a few times.

My setup also hans’t changed since november and everything was greet before.

1 Like

Thanks for the reminder @guniens . Just did a check of the drive and got the following results:

Log of fsck -C -a -T -t ext4 /dev/nvme0n1p2
Sun Jan 28 13:11:56 2024

/dev/nvme0n1p2: clean, 486698/15261696 files, 5338772/61033001 blocks

Sun Jan 28 13:11:56 2024

Drive_Manager also indicates that read only is disabled

Looks like your device you are booting of has some issues. This can be a SD card dying or an USB device with insufficient power.

Take a look at the kernel error messages if you have encountered the problem.

dmesg -l 0,1,2,3
1 Like

[ 0.062311] x86/cpu: SGX disabled by BIOS.

Hi @Joulinar

My system boots off a Patriot PEF64GEP31MCX 64 GB EP A1 bought on November 6 2023 so pretty new and did everything possible to tweak and optimize wear and tear of sd card.

I also had a suspect about dietpi-backup, I’ve set a daily backup (little useless as my setup is the same from the beginning of november :sweat_smile:) and noticed my recent problem always happened after the daily backup.
Dietpi-backup stops and restarts services, could be it wasn’t restarting correctly some services or these services weren’t restarting correctly? In my case, samba and pihole weren’t even in dietpi-dashboard’s services tab running.
Dietpi-backup maybe put the system to read-only before doing backup and to read-write once did, maybe a problem prevented that?

Just thinking, anyway I tried disabling my daily dietpi-backup yesterday and as of now everything’s good, will report if my problems happen again.

Yes, it will stop and start services

this would indicate an issue with the service itself and you would need to check service logs why it is not starting.

PiHole will not be stopped by dietpi-backup. It’s excluded from this procedure by default and should never go down during a backup.

no we don’t set any r/o option. We just do a simple rsync. Probably the I/O load is causing issues on your SD card.

for testing, enable backup again or do it manually and check kernel as well as system logs afterwards.

Shoud I run dmesg -l 0,1,2,3?

I just don’t understand why it’s happening now, my daily dietpi-backup was set since november when I got the sd card and never had a problem till recently.

Another thing I started doing is powering off the Pi from dietpi-dashboard and unplugging from psu for a couple of minutes once a week but doubt it could be this.

Do sd cards have something like S.M.A.R.T like ssds?

best is to do this as soon as you are facing the r/o issue.

I guess my dmesg output doesn’t show clear issues, anything else I can do @Joulinar?

check the log once issue happen. as well have a look to service log. From your log it is not clear which file system should be r/o. Maybe you can ask for additional assistance within HA forum or developer of this integration.

This topic was automatically closed 178 days after the last reply. New replies are no longer allowed.