-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meta-lxatac-software: distro: tacos: make /srv on the rootfs read-only #208
Conversation
This PR does indeed make root@lxatac-00011:~# mount --mkdir /dev/mmcblk1p1 /tmp/other
root@lxatac-00011:~# cd /tmp/other/
root@lxatac-00011:/tmp/other# ls -ahl | grep srv
dr-xr-xr-x 2 root root 4.0K Nov 12 14:27 srv But that does not stop software running as root from creating files there, as they have
root@lxatac-00011:/tmp/other# touch srv/dac
root@lxatac-00011:/tmp/other# ls srv/dac
srv/dac Having |
Why not use the immutable attribute ( |
Hm … I would prefer if meta-lxatac became less complex and less "special" over time. Fiddling with filesystem attributes is quite special in my opinion (I would not suspect them when something were to behave strangely on a system and look somewhere else first). We do have a labgrid tests that triggers when the |
It looks like leonard@fulladder /tmp> wget "https://github-runner.pengutronix.de/artifacts/forrest-build-18HnwViPU6t38cwc/lxatac-core-bundle-base-lxatac.raucb"
leonard@fulladder /tmp> sudo mount --mkdir lxatac-core-bundle-base-lxatac.raucb /tmp/sqfs
leonard@fulladder /tmp> sudo mount --mkdir /tmp/sqfs/lxatac-core-image-base-lxatac.rootfs.ext4 /tmp/ext4
leonard@fulladder /tmp> ls -ahl /tmp/ext4/
…
drwxr-xr-x 3 root root 4,0K 9. Mär 2018 opt/
dr-xr-xr-x 2 root root 4,0K 9. Mär 2018 proc/
drwx------ 2 root root 4,0K 9. Mär 2018 root/
drwxr-xr-x 2 root root 4,0K 9. Mär 2018 run/
lrwxrwxrwx 1 root root 8 9. Mär 2018 sbin -> usr/sbin/
drwxr-xr-x 2 root root 4,0K 9. Mär 2018 srv/
dr-xr-xr-x 2 root root 4,0K 9. Mär 2018 sys/
-rw-r--r-- 1 root root 0 9. Mär 2018 system-update
… |
I think I found the cause. The (Returning the integer 0 in our case) And whenever it is used it is first checked if it is true-ish: (Which it is not in our case) The intent behind the check is to allow a mode of |
We do not want any service to write to /srv (in the root filesystem) before the /srv partition is set up and mounted. Indicate this intent by reducing permissions for the directory. This will however not stop processes running as root from writing there anyways due to CAP_DAC_OVERRIDE. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
I've set the mode to |
We do not want any service to write to
/srv
(in the root filesystem) before the/srv
partition is set up and mounted.Because if
/srv
is not emptysystemd-gpt-auto-generator
will not generate a mount unit for it.Every now and then however some service changes and writes to
/srv/
before the partition is set up by the first boot.Most recently podman (see #206 for the fix).
This is why we have added the following to the task that lead to tracking down #206:
This PR implements that.
TODO before merging: