Skip to content
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: Build without root #11224

Merged
merged 3 commits into from
Jan 13, 2022
Merged

Meta: Build without root #11224

merged 3 commits into from
Jan 13, 2022

Conversation

cdfrey
Copy link
Contributor

@cdfrey cdfrey commented Dec 12, 2021

The fuse2fs tool that is part of e2fsprogs-1.46 has a 'fakeroot' mount option. This allows a non-root users to modify file ownership and permissions without actually being root. This package is available in Debian bullseye and buster-backports.

If fuse2fs is available, the script now assumes the user wants to use it. Otherwise, it falls back to the usual root requirements.

@cdfrey cdfrey changed the title Build without root Meta: Build without root Dec 12, 2021
@Sylvyrfysh
Copy link
Contributor

What type of performance impact does this have? If it is significant, maybe consider checking if the user is a sudoer first, and if not, fall back to this?

@cdfrey
Copy link
Contributor Author

cdfrey commented Dec 13, 2021

What type of performance impact does this have? If it is significant, maybe consider checking if the user is a sudoer first, and if not, fall back to this?

Thanks for responding!

I have not noticed a large speed impact, but my computer is not fast, nor does it have an SSD disk, so others may notice it more than me. I'm sure any impact is absorbed by my slow spinning disk.

One advantage to using fuse2fs if it is available is that there is no need to type your password at the sudo prompt anymore. I noticed that even awesomekling does that in some of his videos. That may offset any decrease in performance from running ext2 in userspace.

@cdfrey
Copy link
Contributor Author

cdfrey commented Dec 13, 2021

So I ran a quick test, and on my system, using fuse2fs is nearly one second faster than root.

Using fuse2fs:

time rsync -aH --chown=0:0 --inplace Build/i686/Root/ mnt/
real 0m29.716s
user 0m2.038s
sys 0m2.047s

Using root with a loopback mount:

time rsync -aH --chown=0:0 --inplace Build/i686/Root/ mnt/
real 0m30.388s
user 0m1.872s
sys 0m1.921s

Your mileage may vary.

@stale
Copy link

stale bot commented Jan 3, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jan 3, 2022
@stale
Copy link

stale bot commented Jan 10, 2022

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

@stale stale bot closed this Jan 10, 2022
@bgianfo bgianfo reopened this Jan 11, 2022
@stale stale bot removed the stale label Jan 11, 2022
@bgianfo
Copy link
Member

bgianfo commented Jan 11, 2022

@cdfrey would you mind fixing the conflict?

When calling sub-programs from shell with exec, the useful || die
idiom does not actually do anything, since the first script is gone.
This is a whitespace only commit to avoid confusion with the
next feature commit.
The fuse2fs tool that is part of e2fsprogs-1.46 has a 'fakeroot'
mount option.  This allows a non-root users to modify file ownership
and permissions without actually being root.  This package is
available in Debian bullseye and buster-backports.

If available, the script assumes the user wants to use it.
Otherwise, it falls back to the usual root requirements.

Now that root is not required, the root check in
build-root-filesystem.sh is not necessary.  Since
build-root-filesystem.sh has 'set -e' enabled, removing this check
will not cause a change in functionality.
@cdfrey
Copy link
Contributor Author

cdfrey commented Jan 12, 2022

@cdfrey would you mind fixing the conflict?

@bgianfo Thanks, it is done and pushed up.

@bgianfo bgianfo merged commit 8f3759c into SerenityOS:master Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants