From e1ae6fa81cc1bc231ec21d74ecc5d2146cd7eb76 Mon Sep 17 00:00:00 2001 From: Georgia Garcia Date: Fri, 7 Feb 2025 11:44:27 -0300 Subject: [PATCH] utils: aa-genprof fails on lxd with OSError: Read-only file system On certain lxc containers, when aa-genprof tries to set printk_ratelimit, it fails with the OSError exception, with the message "OSError: [Errno 30] Read-only file system" instead of PermissionError. Since PermissionError is a subclass of OSError, replace it by broader OSError exception to include both cases in which running aa-genprof fails. Reported-by: Paulo Flabiano Smorigo Signed-off-by: Georgia Garcia --- utils/aa-genprof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/aa-genprof b/utils/aa-genprof index 1c2ab3d21..8d1e69979 100755 --- a/utils/aa-genprof +++ b/utils/aa-genprof @@ -139,7 +139,7 @@ ratelimit_saved = sysctl_read(ratelimit_sysctl) try: sysctl_write(ratelimit_sysctl, 0) -except PermissionError: # will fail in lxd +except OSError: # will fail in lxd warn("Can't set printk_ratelimit, some events might be lost") atexit.register(restore_ratelimit)