forked from Mirror/pmbootstrap
Automatically mount binfmt_misc if not mounted already (MR 1923)
This is needed at least on Alpine Linux, and probably on distros like NixOS as well. Fixes: https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1135
This commit is contained in:
parent
e8e560e18e
commit
5b831d899d
1 changed files with 8 additions and 6 deletions
|
@ -48,17 +48,19 @@ def check_binfmt_misc(args):
|
||||||
"""
|
"""
|
||||||
Check if the 'binfmt_misc' module is loaded by checking, if
|
Check if the 'binfmt_misc' module is loaded by checking, if
|
||||||
/proc/sys/fs/binfmt_misc/ exists. If it exists, then do nothing.
|
/proc/sys/fs/binfmt_misc/ exists. If it exists, then do nothing.
|
||||||
Otherwise, raise an exception pointing to user to the Wiki.
|
Otherwise, load the module and mount binfmt_misc.
|
||||||
|
If that fails as well, raise an exception pointing the user to the wiki.
|
||||||
"""
|
"""
|
||||||
path = "/proc/sys/fs/binfmt_misc/status"
|
path = "/proc/sys/fs/binfmt_misc/status"
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
return
|
return
|
||||||
|
|
||||||
link = "https://postmarketos.org/binfmt_misc"
|
pmb.helpers.run.root(args, ["modprobe", "binfmt_misc"])
|
||||||
raise RuntimeError("It appears that your system has not loaded the"
|
pmb.helpers.run.root(args, ["mount", "-t", "binfmt_misc", "none", "/proc/sys/fs/binfmt_misc"])
|
||||||
" module 'binfmt_misc'. This is required to run"
|
|
||||||
" foreign architecture programs with QEMU (eg."
|
if not os.path.exists(path):
|
||||||
" armhf on x86_64):\n See: <" + link + ">")
|
link = "https://postmarketos.org/binfmt_misc"
|
||||||
|
raise RuntimeError(f"Failed to set up binfmt_misc, see: {link}")
|
||||||
|
|
||||||
|
|
||||||
def migrate_success(args, version):
|
def migrate_success(args, version):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue