From cfe33ff7cd321813b03d1bc88a18bffc811dbeb9 Mon Sep 17 00:00:00 2001 From: zerone0x Date: Sat, 28 Feb 2026 17:35:07 +0100 Subject: [PATCH 1/2] fix(qq): disable botpy file log to fix read-only filesystem error When nanobot is run as a systemd service with ProtectSystem=strict, the process cwd defaults to the read-only root filesystem (/). botpy's default Client configuration includes a TimedRotatingFileHandler that writes 'botpy.log' to os.getcwd(), which raises [Errno 30] Read-only file system. Pass ext_handlers=False when constructing the botpy Client subclass to suppress the file handler. nanobot already routes all log output through loguru, so botpy's file handler is redundant. Fixes #1343 Co-Authored-By: Claude --- nanobot/channels/qq.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nanobot/channels/qq.py b/nanobot/channels/qq.py index 50dbbde..41e6ad3 100644 --- a/nanobot/channels/qq.py +++ b/nanobot/channels/qq.py @@ -31,7 +31,13 @@ def _make_bot_class(channel: "QQChannel") -> "type[botpy.Client]": class _Bot(botpy.Client): def __init__(self): - super().__init__(intents=intents) + # Disable botpy's default file handler (TimedRotatingFileHandler). + # By default botpy writes "botpy.log" to the process cwd, which + # fails under systemd with ProtectSystem=strict (read-only root fs). + # nanobot already handles logging via loguru, so the file handler is + # redundant. ext_handlers=False keeps console output but suppresses + # the file log. See: https://github.com/HKUDS/nanobot/issues/1343 + super().__init__(intents=intents, ext_handlers=False) async def on_ready(self): logger.info("QQ bot ready: {}", self.robot.name) From c34e1053f05ec8f96f68904dcd26fbf86e654afd Mon Sep 17 00:00:00 2001 From: Re-bin Date: Sat, 28 Feb 2026 16:45:06 +0000 Subject: [PATCH 2/2] fix(qq): disable botpy file log to fix read-only filesystem error --- nanobot/channels/qq.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/nanobot/channels/qq.py b/nanobot/channels/qq.py index 41e6ad3..7b171bc 100644 --- a/nanobot/channels/qq.py +++ b/nanobot/channels/qq.py @@ -31,12 +31,7 @@ def _make_bot_class(channel: "QQChannel") -> "type[botpy.Client]": class _Bot(botpy.Client): def __init__(self): - # Disable botpy's default file handler (TimedRotatingFileHandler). - # By default botpy writes "botpy.log" to the process cwd, which - # fails under systemd with ProtectSystem=strict (read-only root fs). - # nanobot already handles logging via loguru, so the file handler is - # redundant. ext_handlers=False keeps console output but suppresses - # the file log. See: https://github.com/HKUDS/nanobot/issues/1343 + # Disable botpy's file log — nanobot uses loguru; default "botpy.log" fails on read-only fs super().__init__(intents=intents, ext_handlers=False) async def on_ready(self):