Skip to content

sync root level changes #150

Open
Open

Description

@ezrizhu

Currently no modified things in the top level are being sync'd. Should we address this in a separate PR/issue? Working on that may require more engineering efforts.

We're also only recreating directories and symlinks (only to directories) in the top level. No files are being recreated.

Originally posted by @ezrizhu in #138 (comment)

Activity

  1. Ioa1 commented on Aug 12, 2025

    @Ioa1
    Contributor

    Here are some notes I have after attempting the problem:

    Main idea and problem:
    The main idea of solving this is using a union file system like mergerfs to merge an empty directory (in this case it will be called root_dir) with /, bypassing permission issues with mounting the actual / directory.

    After creating root_dir (in the sandbox environment) we merger it with /. This works but when try runs the chroot_executable script there are permissions issues at hand with /dev and /proc in the root_dir. When we make an overlay with root_dir, the files in temproot/root_dir are changed. When we make an overlay mount the only permissions we keep the same are of the actual directory we mounted. So in this case we mount “root_dir”, within root_dir are all of the / files (/home, /bin, /etc) which get their user changed from “root” to “nobody”. The problem with this is we need to mount certain devices in /dev and make symlinks in /proc, since the user is “nobody” we cannot do this as there is a permission issue.

    Approach 1:
    The simplest and most straightforward solution would be to exclude /dev and /proc when merging “/” with “root_dir” and creating temproot/dev and temproot/proc after we make the overlay with root user. The issue with this there doesn't appear to be a union filesystem that supports excluding specific dirs when merging.

    Approach 2:
    Similarly to the previous approach, instead of excluding files we could simply remove temproot/root_dir/dev and temproot/root_dir/proc using something like rm -rf. Not only does this require sudo to run and takes a long time, it also deletes the users actual /dev and /proc dirs (I learned this the hard way). Safe to say this is not the correct approach.

    Approach 3:
    The next idea was to use chown to change the user in /dev and /proc to root, once again it faces the same problem as the previous approach as we need to run try in root.

    Approach 4:
    In this approach I tried to build the root_dir myself. I made all of the top level dirs in the root_dir via mkdir and copied their permission, then I populated all of the top level dirs with mergerfs. (so root_dir/home would be merged with /home itself). Then I merged the root_dir with an empty dir to bypass the permission issue. The issue with this approach is that its suffers with the same problem the current version of try has. It wouldn't actually see the top level changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions