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

opam init fails building "ocaml-system" : bwrap: Creating new namespace failed: Operation not permitted #27078

Closed
sebma opened this issue Dec 12, 2024 · 3 comments

Comments

@sebma
Copy link

sebma commented Dec 12, 2024

Hi,
opam init fails building ocaml-system because of a bwrap error :

root@pc1:~# opam config report
[WARNING] Running as root is not recommended
# opam config report
# opam-version      2.0.4
# self-upgrade      no
# system            arch=x86_64 os=linux os-distribution=ubuntu os-version=16.04
[ERROR] Opam has not been initialised, please run `opam init'
# read-state        OpamStd.OpamSys.Exit(50)
root@pc1:~# opam init -a
[WARNING] Running as root is not recommended
[NOTE] Will configure from built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.

[WARNING] Recommended dependencies -- most packages rely on these:
  - make
  - m4

<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
[default] Initialised
default (at https://opam.ocaml.org):
    [WARNING] opam is out-of-date. Please consider updating it (https://opam.ocaml.org/doc/Install.html)


User configuration:
  Updating ~/.profile.
[NOTE] Make sure that ~/.profile is well sourced in your ~/.bashrc.


<><> Creating initial switch (ocaml-system>=4.02.3) <><><><><><><><><><><><><><>

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ocaml-system.4.02.3/gen_ocaml_config.ml.in] downloaded from https://opam.ocaml.org/cache
[ocaml-config.1/gen_ocaml_config.ml.in] downloaded from https://opam.ocaml.org/cache
[ocaml-config.1/ocaml-config.install] downloaded from https://opam.ocaml.org/cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed base-bigarray.base
-> installed base-threads.base
-> installed base-unix.base
[ERROR] The compilation of ocaml-system failed at "/root/.opam/opam-init/hooks/sandbox.sh build ocaml gen_ocaml_config.ml".

#=== ERROR while compiling ocaml-system.4.02.3 ================================#
# context     2.0.4 | linux/x86_64 |  | https://opam.ocaml.org#7f1f91d1f6bfe0200f8d27c1a92cb2138f5ff96f
# path        ~/.opam/default/.opam-switch/build/ocaml-system.4.02.3
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml gen_ocaml_config.ml
# exit-code   1
# env-file    /tmp/opam-xxx-30/ocaml-system-30-562576.env
# output-file /tmp/opam-xxx-30/ocaml-system-30-562576.out
### output ###
# bwrap: Creating new namespace failed: Operation not permitted



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build ocaml-system 4.02.3
+-
+- The following changes have been performed (the rest was aborted)
| - install base-bigarray base
| - install base-threads  base
| - install base-unix     base
+-
# Run eval $(opam env) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] y
root@pc1:~# uname -r
4.15.0-142-generic
root@pc1:~# 
@sebma
Copy link
Author

sebma commented Dec 13, 2024

Maybe it's a bubblewrap issue. So I created an issue on the bubblewrap project.

@sebma
Copy link
Author

sebma commented Dec 13, 2024

I solved my problem by disabling sandboxing in my opam call : opam init --disable-sandboxing -a

@sebma sebma closed this as completed Dec 13, 2024
@punchagan
Copy link
Contributor

See also this opam issue

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

No branches or pull requests

2 participants