{"id":1375,"date":"2022-05-29T12:28:03","date_gmt":"2022-05-29T03:28:03","guid":{"rendered":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/?p=1375"},"modified":"2022-07-17T08:42:20","modified_gmt":"2022-07-16T23:42:20","slug":"read-only-file-system%e3%81%a7%e3%83%ad%e3%82%b0%e3%83%ad%e3%83%bc%e3%83%86%e3%83%bc%e3%83%88%e3%81%8c%e5%a4%b1%e6%95%97%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/archives\/1375","title":{"rendered":"Read-only file system\u3067\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30c8\u304c\u5931\u6557\u3059\u308b"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li>Ubuntu 20.04.4 LTS<\/li><li>logrotate: 3.14.0-4ubuntu3<\/li><\/ul>\n\n\n\n<p>Apache httpd\u3092\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\/usr\/local\/apache2\u306b\u914d\u7f6e\u3057\u305f\u3042\u3068\u3001logrotate\u306e\u8a2d\u5b9a\u3092\u6e08\u307e\u305b\u305f\u3002\u3068\u3053\u308d\u304c\u30ed\u30b0\u306e\u30ed\u30fc\u30c6\u30fc\u30c8\u304c\u70ba\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u306b\u6c17\u304c\u4ed8\u3044\u305f\u3002syslog\u3092\u958b\u304f\u3068\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u73fe\u308c\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ less \/var\/log\/syslog\nMay 29 00:00:00 wordpress logrotate[43538]: error: failed to rename \/usr\/local\/apache2\/logs\/access_log to \/usr\/local\/apache2\/logs\/access_log-20220529: <strong class=\"orange\">Read-only file system<\/strong><\/pre>\n\n\n\n<p>Read-only\u3067\u601d\u3044\u5f53\u305f\u308b\u306e\u306fsystemd\u306e<code>ProtectSystem=<\/code>\u3067\u3042\u308b\u3002\u89e3\u8aac\u3092\u773a\u3081\u308b\u3068true\u3084full\u3001strict\u304c\u8a2d\u5b9a\u3055\u308c\u308b\u3068\/usr\u306fread-only\u3067\u30de\u30a6\u30f3\u30c8\u3055\u308c\u308b\u304b\u3089\u672c\u75c7\u72b6\u3068\u4e00\u81f4\u3059\u308b\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>ProtectSystem=<br>\nTakes a boolean argument or the special values &#8220;full&#8221; or &#8220;strict&#8221;. If true, mounts the \/usr\/ and the boot loader directories (\/boot and \/efi) read-only for processes invoked by this unit.<\/p><cite><a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd.exec.html#ProtectSystem=\" target=\"_blank\" rel=\"noreferrer noopener\">ProtectSystem=<\/a><\/cite><\/blockquote>\n\n\n\n<p>logrotate.service\u306e\u8a2d\u5b9a\u3092\u691c\u3081\u308b\u3068\u3053\u3046\u3044\u3046\u5177\u5408\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ systemctl show logrotate.service --property ProtectSystem\nProtectSystem=full<\/pre>\n\n\n\n<p>full\u3068\u306a\u3063\u3066\u3044\u308b\u304b\u3089\/usr\u306fread-only\u3067\u30de\u30a6\u30f3\u30c8\u3055\u308c\u3066\u3057\u307e\u3046\u3002\u305d\u3053\u3067logrotate.service\u306e[Service]\u30bb\u30af\u30b7\u30e7\u30f3\u306b<code>ReadWritePaths=<\/code>\u3092\u8a2d\u5b9a\u3057\u3066\u3053\u306e\u5236\u5fa1\u3092\u8eb1\u3059\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong class=\"green\">ReadWritePaths=<\/strong>, ReadOnlyPaths=, InaccessiblePaths=, ExecPaths=, NoExecPaths=<br>(snip)<br>Paths listed in ReadWritePaths= are accessible from within the namespace with the same access modes as from outside of it.<\/p><cite><a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd.exec.html#ReadWritePaths=\" target=\"_blank\" rel=\"noreferrer noopener\">ReadWritePaths=, ReadOnlyPaths=, InaccessiblePaths=, ExecPaths=, NoExecPaths=<\/a><\/cite><\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo cp -av \/lib\/systemd\/system\/logrotate.service \/etc\/systemd\/system\/\n'\/lib\/systemd\/system\/logrotate.service' -&gt; '\/etc\/systemd\/system\/logrotate.service'\n\n$ sudo vi \/etc\/systemd\/system\/logrotate.service\n[Service]\n(snip)\nProtectSystem=full\n<strong class=\"orange\">ReadWritePaths=\/usr\/local\/apache2\/logs<\/strong><\/pre>\n\n\n\n<p>\u3042\u3068\u306f\u30e6\u30cb\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u518d\u8aad\u307f\u8fbc\u307f\u3068logrotate\u3092\u518d\u8d77\u52d5\u3057\u3066\u3001\u5b9f\u884c\u6642\u9593\u3092\u5f85\u3061\u69cb\u3048\u3066\u3044\u308b\u3068\u3046\u307e\u304f\u30ed\u30fc\u30c6\u30fc\u30c8\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl daemon-reload\n$ sudo systemctl restart logrotate.service<\/pre>\n\n\n\n<h3 class=\"link\">\u53c2\u8003:<\/h3>\n<ul>\n <li><a href=\"https:\/\/stdworkflow.com\/418\/logrotate-read-only-filesystem-problem\">logrotate read only filesystem problem<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 20.04.4 LTS logrotate: 3.14.0-4ubuntu3 Apache httpd\u3092\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\/usr\/local\/apache2\u306b\u914d\u7f6e\u3057\u305f\u3042\u3068\u3001logrotate\u306e\u8a2d\u5b9a\u3092\u6e08\u307e\u305b\u305f\u3002\u3068\u3053\u308d\u304c\u30ed\u30b0\u306e\u30ed\u30fc\u30c6\u30fc\u30c8\u304c\u70ba\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u306b\u6c17\u304c\u4ed8\u3044\u305f\u3002syslog\u3092\u958b\u304f\u3068\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u73fe\u308c\u3066\u3044\u308b\u3002 $ less \/var\/log\/syslog May 29 &#8230; <a title=\"Read-only file system\u3067\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30c8\u304c\u5931\u6557\u3059\u308b\" class=\"read-more\" href=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/archives\/1375\" aria-label=\"Read-only file system\u3067\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30c8\u304c\u5931\u6557\u3059\u308b \u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8aad\u3080\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":991,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157],"tags":[212,224],"class_list":["post-1375","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-systemd","tag-224"],"views":3066,"_links":{"self":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/posts\/1375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=1375"}],"version-history":[{"count":0,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/posts\/1375\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/media\/991"}],"wp:attachment":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=1375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=1375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=1375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}