bedrocklinux / bedrocklinux-userland

This tracks development for the things such as scripts and (defaults for) config files for Bedrock Linux
https://bedrocklinux.org
GNU General Public License v2.0
597 stars 62 forks source link

brl status fail - /tmp is bound for all strata #283

Closed sol-fieldman closed 1 year ago

sol-fieldman commented 1 year ago

Boot: EFISTUB via dracut and initramfs

Hijacked Strata: Void Linux

FS: BTRFS with subvolumes

Relevant Files: fstab, mtab, brl report output, dmesg

Things I have tried doing:

At this point, my hypothesis is that this error might have something to do with BTRFS and the way subvolumes are handled. Previously had to drop into rescue mode post-hijack to manually create a mountpoint for my snapshots subvolume. Have not come across any day-to-day issues because of this error save for the failed check. Any and all suggestions are welcome.

paradigm commented 1 year ago

brl status' error message here isn't very good. Some background to help you understand what it's complaining about:

At one level of abstraction, pretty much all Bedrock does is redirect requests for resources to the appropriate stratum. This is mostly configuration driven so that users can customize it as need be. The [global] section of /bedrock/etc/bedrock.conf has (effectively) three options for file paths:

Bedrock defaults to /tmp being configured to be shared, but the self-check code sees/tmp set up to be bound instead. So long as you don't mount anything in there, there's no effective difference. If for whatever reason you mount a DVD to /tmp/dvd, that dvd will only be visible at that path to processes from whatever stratum ran the mount system call.

I recommend checking that all strata do see the same stuff in /tmp, e.g. by creating files there and running strat <stratum> ls /tmp for all your strata.

It's not immediately obvious to me why this issue is occuring. Your guess that it has to do with subvolumes is plausible, as Bedrock isn't currently subvolume-aware; that's on the to-do list for 0.8.x. That said, Bedrock isn't erroring about /home which you've configured to be a subvolume while /tmp isn't actually configured to be one; the causal chain here isn't straight forward. The fact /tmp is a tmpfs is interesting as a non-default but it isn't obvious to me why that'd be a problem, either, as Bedrock is comfortable with things like /dev/shm and /bedrock/run being tmpfs mounts without any issues.

I can try to reproduce this when time allows, but it may be a bit; I'm getting increasingly backlogged with other issues/requests, and since this doesn't appear to be an actual blocker for functionality I can't justify prioritizing over other items.

If you want to debug it yourself, the key thing to know about is the shared:<number> flag in /proc/1/mountinfo. That's how the Linux kernel thinks about this (and why brl status and bedrock.conf call it "shared"). Bedrock wants all instances of share items like /tmp mount point to have the same shared:<number> number. /bedrock/libexec/brl-repair and /bedrock/libexec/brl-status are both shell scripts you can probably work your way through if you know shell and have patience. They've got a bit of tech-debt and aren't the cleanest; 0.8.0 will be a complete re-write of this area.

sol-fieldman commented 1 year ago

Solved it (manually). Was not bedrock.

This turned out to be a dracut/initramfs issue. for anyone looking for a solution for the same problem:

  1. Check /proc/1/mountinfo for instances of the bound directory, if you see a duplicate mount, move on to step 2
  2. Redo the config of your bootloader install (in my case, EFISTUB via dracut/initramfs) using hijacked system
  3. check for any redundant files pertaining to /proc, fstab, or mtab
  4. quietly facepalm, bookmark the manpages for your boot method of choice.