DevHeads.net

ownership of /proc and /sys

Hi,
directories /proc/ and /sys/ are owned by filesystem package. This worked in past where we needed those directories to
exist so we can mount the procfs and sysfs.

However this cause issues in containers:
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1548403" title="https://bugzilla.redhat.com/show_bug.cgi?id=1548403">https://bugzilla.redhat.com/show_bug.cgi?id=1548403</a>
and during building where hacks are needed:
<a href="https://github.com/rpm-software-management/mock/pull/234/commits/d7e0b413c83bec00fd1ed75ee15122a9cc6db62e" title="https://github.com/rpm-software-management/mock/pull/234/commits/d7e0b413c83bec00fd1ed75ee15122a9cc6db62e">https://github.com/rpm-software-management/mock/pull/234/commits/d7e0b41...</a>

I have bunch of ideas, but all of them ugly (e.g., not own that file and create that directories in scriptlet). Do you
have any ideas about this situation?

Comments

Re: ownership of /proc and /sys

By Adam Jackson at 07/23/2019 - 10:56

On Tue, 2019-07-23 at 11:01 +0200, Miroslav Suchý wrote:
Make systemd create them? It has to manage them anyway.

- ajax

Re: ownership of /proc and /sys

By Lennart Poettering at 07/23/2019 - 11:29

It does, if they are missing. In fact, it's totally supported to boot
up with an empty / (for example: tmpfs, which is what
systemd.volatile=yes on the kernel cmdline will do) with the one
exception of a populated /usr and systemd will create all the basic
mount points and symlinks needed to make the system boot.

That said, that only works if / is writable. Which is not a given.

Lennart

Re: ownership of /proc and /sys

By Jun Aruga at 07/24/2019 - 07:14

Make systemd create them? It has to manage them anyway.

On Tue, Jul 23, 2019 at 5:30 PM Lennart Poettering < ... at 0pointer dot de> wrote:

Re: ownership of /proc and /sys

By Jun Aruga at 07/24/2019 - 07:24

Sorry I posted my previous email wrongly.

I see this situation to think about the ownership of /proc happens
when qemu-user-static RPM creates new
/proc/sys/fs/binfmt_misc/qemu-$cpu files by "dnf install
qemu-user-static" through running systemd. [1]
Who is the owner of the /proc/sys/fs/binfmt_misc/qemu-$cpu files?
The possible solution I am considering is "(e.g., not own that file
and create that directories in scriptlet)".

[1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1732178" title="https://bugzilla.redhat.com/show_bug.cgi?id=1732178">https://bugzilla.redhat.com/show_bug.cgi?id=1732178</a>

Re: ownership of /proc and /sys

By Lennart Poettering at 07/24/2019 - 08:44

These directories are runtime objects, i.e. kernel API exposed as a
file system. RPM should not own files below /proc. Something should
own/create /proc itself, since it needs to exist to be overmounted
with procfs, but beyond that stuff below /proc should be off limits
for any package manager I figure.

Lennart