[Errno 30] Read-only file system ONLY with one service

Hi, I’ve been using bazarr for quite a long time without issues and decided to add a post-script that for some reason, insists in giving this error:

File "/opt/subcleaner/subcleaner.py", line 10, in <module> from libs.subcleaner import main 
File "/opt/subcleaner/libs/subcleaner/main.py", line 4, in <module> from .subtitle import Subtitle, ParsingException, FileContentException 
File "/opt/subcleaner/libs/subcleaner/subtitle.py", line 6, in <module> from .settings import args, config 
File "/opt/subcleaner/libs/subcleaner/settings/__init__.py", line 3, in <module> from . import log_config 
File "/opt/subcleaner/libs/subcleaner/settings/log_config.py", line 15, in <module> file_handler = logging.handlers.RotatingFileHandler(config.log_file, maxBytes=10_000_000, backupCount=10, encoding='utf8') 
File "/usr/lib/python3.9/logging/handlers.py", line 153, in __init__ BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding, 
File "/usr/lib/python3.9/logging/handlers.py", line 58, in __init__ logging.FileHandler.__init__(self, filename, mode=mode, 
File "/usr/lib/python3.9/logging/__init__.py", line 1142, in __init__ StreamHandler.__init__(self, self._open()) 
File "/usr/lib/python3.9/logging/__init__.py", line 1171, in _open return open(self.baseFilename, self.mode, encoding=self.encoding, 
OSError: [Errno 30] Read-only file system: '/opt/subcleaner/logs/subcleaner.log'

Already gave 777 permissions and chown to bazarr to all this “subcleaner” folder and subfolders. But issue persists.

If I run the script from the CLI it works perfectly, the problem is when is run by bazarr itself. I’m out of ideas.

If I remove this block from the script source code, it works:

# file handler
# if not args.no_log:
#     file_handler = logging.handlers.RotatingFileHandler(config.log_file, maxBytes=10_000_000, backupCount=10, encoding='utf8')
#     file_handler.setFormatter(time_formatter)
#     file_handler.setLevel(logging.INFO)
#     if args.errors_only:
#         file_handler.setLevel(logging.ERROR)
#     base_logger.addHandler(file_handler)

Specially the line with the logging.handlers.RotatingFileHandler seems ti be the issue.

Looks like it can’t open a file to write within this location but only when ran by the service.

It depends on the user who is executing the service. This one would need read permissions on all folders along the chain /opt/subcleaner/logs/. Best to check all of them

Apparently is the service that is actually running that has permissions:

drwxrwsrwx 2 bazarr dietpi 4096 Mar 26 14:04 .
drwxrwsrwx 7 bazarr dietpi 4096 Mar 26 14:09 ..
-rwxrwxrwx 1 bazarr dietpi    0 Mar 26 14:04 subcleaner.log

Bazarr is the service that is running and trying to access it.

you need to check all folders (/opt/subcleaner/logs/) individually not just ./logs

Actually just execute permissions for all parent dirs.

But IIRC we restrict filesystem access for Bazarr systemd unit-wise to /opt/bazarr /mnt/dietpi_userdata/bazarr and maybe /var/log/bazarr. Check via:

systemctl cat bazarr

Via dietpi-services or systemctl edit bazarr you can edit/override the ReadWritePaths line to add the dir where the post processing script needs to write to.

1 Like