<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[`/run/sr-mount` parent directory created 0700 on some hosts, 0755 on others]]></title><description><![CDATA[<p dir="auto">I'm trying to work out why the mode on <code>/run/sr-mount</code> itself (the parent, not the per-SR subdirectories) is inconsistent across hosts in our estate.</p>
<p dir="auto">We monitor SR capacity with Zabbix, which runs as an unprivileged user. Where the parent is 0700 the agent can't traverse it, so the SR checks fail with:</p>
<pre><code>Cannot obtain filesystem information: [13] Permission denied
</code></pre>
<p dir="auto">Two hosts, both on the same XCP-ng version (8.3 LTS). The first works, the second does not.</p>
<p dir="auto">Host A, working:</p>
<pre><code>Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
</code></pre>
<p dir="auto">Host B, broken:</p>
<pre><code>Access: (0700/drwx------)  Uid: (    0/    root)   Gid: (    0/    root)
</code></pre>
<p dir="auto">Nobody has changed it by hand, and <code>/run</code> is tmpfs, so the directory gets recreated on every boot.</p>
<p dir="auto"><code>FileSR.py</code> creates each SR's own mount directory at 0700, which looks like the source of it:</p>
<pre><code>grep -n "makedirs\|mkdir\|chmod\|0o7\|0700\|0755" /opt/xensource/sm/FileSR.py
127:                    util.ioretry(lambda: os.mkdir(self.remotepath))
178:                util.ioretry(lambda: util.makedirs(self.path, mode=0o700))
188:                os.chmod(self.path, mode=0o0700)
</code></pre>
<p dir="auto"><code>self.path</code> is <code>/run/sr-mount/&lt;sr-uuid&gt;</code>, so 0700 on the SR's own directory is intentional. But <code>util.makedirs</code> is recursive and defaults to <code>mode=0o777</code>:</p>
<pre><code>grep -n "def makedirs\|chmod" /opt/xensource/sm/util.py
623:def makedirs(name, mode=0o777):
636:                os.chmod(name, mode)
</code></pre>
<p dir="auto">My reading: if a local EXT SR attaches before <code>/run/sr-mount</code> exists, <code>makedirs(self.path, mode=0o700)</code> creates the parent in the same call and the parent inherits 0700. On hosts where something else creates the parent first at the default mode, whatever attaches later finds it already there and leaves it alone.</p>
<p dir="auto">What we have tried, none of it ideal. A plain <code>chmod 755 /run/sr-mount</code> works but doesn't survive a reboot. An <code>ExecStartPost</code> drop-in on <code>xs-sm.service</code> persists but can lose the race if an SR attaches after the service reports started. We're now testing a systemd <code>.path</code> unit watching <code>/run/sr-mount</code> that re-applies 0755 whenever it changes, which sidesteps the ordering question, but it's a workaround rather than a fix and won't survive a major version upgrade.</p>
<p dir="auto">I'm sure someone else must have come across this issue so I'm hoping there's a better fix.</p>
<p dir="auto">Sudo doesn't help. <code>vfs.fs.size</code> stats the path in-process, and <code>df</code> with no path argument still stats each filesystem, so the SR rows drop with no error for a non-root user.</p>
<p dir="auto">Questions:</p>
<ol>
<li>Is 0755 the intended mode for the parent <code>/run/sr-mount</code>, with the 0700 an unintended side effect of the recursive <code>makedirs</code>? Or is 0700 on the parent deliberate too, making the 0755 hosts the anomaly?</li>
<li>Does anything create the parent or set its mode explicitly, or does it only ever appear as a by-product of the first SR attach?</li>
<li>Has anyone else hit this while monitoring SR capacity with a non-root agent, and how did you handle it?</li>
</ol>
<p dir="auto">Is there a supported way to have the parent set at 0755 consistently, or should this be raised as a bug against <code>sm</code>?</p>
]]></description><link>https://xcp-ng.org/forum/topic/12462/run-sr-mount-parent-directory-created-0700-on-some-hosts-0755-on-others</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 10:07:35 GMT</lastBuildDate><atom:link href="https://xcp-ng.org/forum/topic/12462.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Sep 2026 08:25:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to `/run/sr-mount` parent directory created 0700 on some hosts, 0755 on others on Wed, 09 Sep 2026 09:55:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dan" aria-label="Profile: Dan">@<bdi>Dan</bdi></a> Hello,</p>
<p dir="auto">I can't answer from memory, we'll take a look at this and come back to you <img src="https://xcp-ng.org/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2bdbead4301" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Thanks for the report, I guess it could be considered a bug since even it's one of the other, it's not the expected behaviour to have the mode change between runs.</p>
]]></description><link>https://xcp-ng.org/forum/post/108368</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/108368</guid><dc:creator><![CDATA[dthenot]]></dc:creator><pubDate>Wed, 09 Sep 2026 09:55:02 GMT</pubDate></item></channel></rss>