1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-23 12:35:12 +03:00
Commit graph

6 commits

Author SHA1 Message Date
Casey Connolly
9dc294dbbf pmbootstrap: unshare PID namespaec
Put ourselves in a new PID namespace so that daemons we might start in
the chroot like adbd will be killed on exit.

This simplifies "shutdown" since we no longer need to kill these
processes.

Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
2025-06-13 21:47:42 +02:00
Casey Connolly
d8886b086a
init: sandbox: also map rootfs user 10000
Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
2025-05-30 21:29:28 +02:00
Casey Connolly
be5e18cf99
unshare binfmt
Rework how we handle binfmt_misc so it will work inside a user
namespace.

* Use a custom mountpoint (only accessible inside the mount namespace),
  this is the crux of the change, allowing us to mount it as non-root
  and avoid messing with any host configs too!
* No longer explicitly modprobe binfmt_misc, any modern system should
  probe it automatically when we try to mount it... I think so anyways
  heh

Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
2025-05-30 21:29:27 +02:00
Casey Connolly
4c482e0b73
pmb: sandbox: use newuidmap/newgidmap for become_user()
This really needs to be fixed up properly, basically we want to map
ourselves in as root, then support the groups <1000 (e.g. abuild uses
group id 300) and finally use our UID namespace (the biiig UIDs) for the
pmos user.

You need "USER:100000:65536" in your /etc/subuid and /etc/subgid files
where "USER" is your username.

This basically results in the chroot perms matching your user for root
and some freaky UIDs for the build user.

Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
2025-05-30 13:22:59 +02:00
Casey Connolly
e4560a9aca
pmb: sandbox: split out mount setup
allow it to be called directly.

Signed-off-by: Casey Connolly <casey@postmarketos.org>
2025-05-30 13:22:59 +02:00
Casey Connolly
31eaa927c8
pmb: import mkosi-sandbox
Import mkosi sandbox script which we will use as a library.

Signed-off-by: Casey Connolly <caleb@postmarketos.org>
2025-05-30 13:22:59 +02:00