Repository navigation
Help users with incorrect / permission bits - #41431
Conversation
|
This is so random... yes, the root dir is an important inode, but it's really not the only relevant inode to keep the system running, hence why give it special treatment? also, why not instead use a tmpfiles.d/ snippet to adjust it? |
351f29b to
a16068f
Compare
|
Yeah I thought about that, but I was worried there was some reason people really would want a 0700 / and be upset if it was changed silently. That was silly of me in hindsight, would adding this to tmpfiles.d/home.conf be appropriate? |
|
|
||
| # See tmpfiles.d(5) for details. | ||
|
|
||
| z / 0755 - - - |
There was a problem hiding this comment.
so i am inclined to merge something like this, for the reason that it's quite common that the root inode is provided/created by a different component than the component that populates it. e.g. people might mount a tmpfs as a future root fs, where the inode is initialized by the kernel, and then they unpack a rootfs into it where the inodes are created by them. hence, there's a good chance that what is right for the rootfs doesn't match with what is right for the original unpopulated dir created for it.
but please, let's do this in a separate .conf file, so that people can easily override/mask it. i.e. rootfs.conf?
also, it should be 555 i think. (i.e. if some code runs as root with all caps dropped it shouldn't still get write access to the root inode)
There was a problem hiding this comment.
" for the reason that it's quite common that the root inode is provided/created by a different component than the component that populates it."
Yes that was the exact problem that got me. I formated a drive, mkfs, then mounted it. Then used a different tool to fill the rootfs with all the fhs stuff. The crazy thing was that somehow the mounted filesystem got its bits set to 700 without me noticing, then the system obviously failed.
A quick question though, if its perm bits are set to 555, that means the root (user) will be unable to mkdir /mnt2 or write anything to the root dir right?
|
might be good to already add an entry to NEWS for this, since this is not just a feature addition, it might break certain (broken, if you ask me) setups. Hence, we should mention this so that downstreams are aware of this change, and can reconsider it. |
|
you also need to register the file in meson.build, or otherwise it's not going to be installed |
done! |
|
This should have been squashed into a single commit. |
|
Hi, this change caused...a fair bit of work for some folks. I think the change is well intentioned but TL;DR I have two recommendations: First: I think we should have a flag for systemd-tmpfiles (
Well...what's broken here? It's not like the difference between 0o755 or 0o555 really matters at all right? I think alternatively (or in addition): A variant like Or we make Backing up though I'm not so sure it should really systemd's job to define this stuff by default. I mean, on a traditional mutable system one can mess up the permissions of literally any arbitrary dir (messing up Or at least...anyone adding systemd to their OS/distro would for sure need to ensure these tmpfiles.d snippets are in sync with whatever other source of truth they had before (like Probably what would make sense for mutable OS's is to have a little bit of code that runs in the initramfs and does these fixups instead? Or really have a "run repair" boot option? The general case of course needs a USB key or at least completely separate fallback partition etc. BTW, this led into a whole side quest in "actually, how are the perms of |
As of systemd 261, bare 'systemd-tmpfiles --create' calls now attempt to
set permissions on / on systems which are not set to 0555 [1]. This
currently fails on Fedora CoreOS systems due to them having the
incorrect permissions (i.e., 0755) set while also having a read-only
root file system [2]. This leads to the following error:
fchmod() of / failed: Read-only file system
Traceback (most recent call last):
File "toolbox/meson_post_install.py", line 26, in <module>
subprocess.run(['systemd-tmpfiles', '--create'], check=True)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.15/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['systemd-tmpfiles',
'--create']'
Since both entries in data/tmpfiles.d/toolbox.conf are under /run, it's
safe to restrict these calls to this directory with '--prefix /run' in
order to avoid that issue on Fedora CoreOS.
[1] systemd commit 7b2a10b594d7ed0f
systemd/systemd@7b2a10b594d7ed0f
systemd/systemd#41431
[2] coreos/fedora-coreos-tracker#2238
containers#1847
containers#1857
Signed-off-by: Rolv Apneseth <[email protected]>
As of systemd 261, bare 'systemd-tmpfiles --create' calls now attempt to
set permissions on / on systems which are not set to 0555 [1]. This
currently fails on Fedora CoreOS systems due to them having the
incorrect permissions (i.e., 0755) set while also having a read-only
root file system [2]. This leads to the following error:
fchmod() of / failed: Read-only file system
Traceback (most recent call last):
File "toolbox/meson_post_install.py", line 26, in <module>
subprocess.run(['systemd-tmpfiles', '--create'], check=True)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.15/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['systemd-tmpfiles',
'--create']' returned non-zero exit status 73.
Since both entries in data/tmpfiles.d/toolbox.conf are under /run, it's
safe to restrict these calls to this directory with '--prefix /run' in
order to avoid that issue on Fedora CoreOS.
[1] systemd commit 7b2a10b594d7ed0f
systemd/systemd@7b2a10b594d7ed0f
systemd/systemd#41431
[2] coreos/fedora-coreos-tracker#2238
containers#1847
containers#1857
Signed-off-by: Rolv Apneseth <[email protected]>
This error causes the computer to pass the emergency.target and go to graphical.target.
Then, your window manager will have problems because it cant access any directories, your network manager wont startup the network. In my case, the screen just goes black. Ideally, you'd get an error message explaining this edge scenario that's occuring to you, and an emergency shell that makes it easy to run the necessary chmod 0755 / to proceed with booting. IDK not sure if this is the correct way to implement this, sorry it's my first contribution.
I ran
meson test -C buildand got
Ok: 1806
Fail: 26
Skipped: 25
on my cloned systemd repo before any changes, and got the same result after my commit ¯_(ツ)_/¯
So I hope I did that right.
Thanks