mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-20 19:15:08 +03:00
remove --as-root
Running pmbootstrap as root doesn't work anymore, and there should never be a need for this. Let's just stop supporting this usecase. Error: Traceback (most recent call last): File "/home/cas/bin/pmbootstrap", line 61, in <module> sandbox.setup_mounts(fsops) File "/home/cas/pmos/pmbootstrap/pmb/init/sandbox.py", line 975, in setup_mounts mount(".", "/", "", MS_MOVE, "") File "/home/cas/pmos/pmbootstrap/pmb/init/sandbox.py", line 170, in mount oserror("mount", dst) File "/home/cas/pmos/pmbootstrap/pmb/init/sandbox.py", line 145, in oserror raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno()), filename or None) OSError: [Errno 22] Invalid argument: '/' Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
This commit is contained in:
parent
0b86a9d2b0
commit
5ddb7d66f7
2 changed files with 4 additions and 5 deletions
|
@ -57,7 +57,7 @@ def print_log_hint() -> None:
|
|||
print(log_hint)
|
||||
|
||||
|
||||
def main(*, original_uid: int) -> int:
|
||||
def main() -> int:
|
||||
# Wrap everything to display nice error messages
|
||||
|
||||
args: PmbArgs
|
||||
|
@ -72,8 +72,6 @@ def main(*, original_uid: int) -> int:
|
|||
|
||||
# Sanity checks
|
||||
other.check_grsec()
|
||||
if not args.as_root and original_uid == 0:
|
||||
raise RuntimeError("Do not run pmbootstrap as root!")
|
||||
|
||||
# Check for required programs (and find their absolute paths)
|
||||
require_programs()
|
||||
|
|
|
@ -11,7 +11,8 @@ from pmb.init import sandbox
|
|||
# Sanitise environment a bit
|
||||
os.environ["SHELL"] = "/bin/sh" if os.path.exists("/bin/sh") else "/bin/bash"
|
||||
|
||||
original_uid = os.geteuid()
|
||||
if os.geteuid() == 0:
|
||||
raise RuntimeError("pmbootstrap can't be run as root, please run it as a regular user.")
|
||||
|
||||
sandbox.acquire_privileges(become_root=False)
|
||||
# Unshare mount and PID namespaces. We create a new PID namespace so
|
||||
|
@ -64,4 +65,4 @@ os.chdir(os.environ["PWD"])
|
|||
# A convenience wrapper for running pmbootstrap from the git repository. This
|
||||
# script is not part of the python packaging, so don't add more logic here!
|
||||
if __name__ == "__main__":
|
||||
sys.exit(pmb.main(original_uid=original_uid))
|
||||
sys.exit(pmb.main())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue