-
Notifications
You must be signed in to change notification settings - Fork 362
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 broken on ubuntu 24.04 (bwrap: operation not permitted
)
#5968
Comments
UPDATE (Oct 15, 2024): Thanks to @gegarcia, there is a safer way to fix this (see discussion below).
It's working for me. ORIGINAL POST, OBSOLETE (June 6, 2024): Thanks @dlesbre, I've experienced the same issue. Upgrade to 24.04, and then
|
I can confirm that the solution posted by @cuihtlauac worked. Might be worthwhile to add it to the docs? |
same here |
Reading the upstream issue https://bugs.launchpad.net/wike/+bug/2046844?comments=all i'm really not sure what we should do and i'm bit lost honestly. However looking at the apparmor sources, they seem to have a profile for opam already https://gitlab.com/apparmor/apparmor/-/commit/89a9f7673368e7d19802fd12ec3717a5477200e0 which was shipped in apparmor 4.0.0. Ubuntu 24.04 seems to have apparmor 4.0.1 so in theory it shouldn't be a problem anymore but if it is i'm not sure what was the point of the profile. Does anyone know anything about apparmor and are willing to work with upstream Ubuntu? |
What you could do (and what I have done with SE Linux policy) is to have bubblewrap run with access to do such things and then transition back to another domain when it runs something. Allowing a program to run another program with different levels of access potentially allows running another program with greater levels of access. But if we allow Bubblewrap to just do the things it needs to do (and not run random other programs with it's privileges) and then run another program in the original security context or a different restricted security context then it should be safe. Forcing programs to be run with ONLY AppArmor and not Bubblewrap restrictions would not be a good thing. A common use of Bubblewrap is for a program to reduce the access of it's child processes which is something it will know about in detail and that AppArmor developers won't necessarily know. Even if AppArmor was configured to restrict child processes (which in many cases could be done) it wouldn't handle the case where an application developer changed their application design and needed matching changes to the restrictions on a child process. |
Is it possible that this profile only works if |
Which is the worse practice here, the above apparmor exception or disabling sandboxing? |
definitely disabling sandboxing |
Please don't create an "unconfined" profile for bwrap. This completely bypasses the unprivileged user namespace creation restriction and makes your machine exploitable by attacks that use it. You should instead create a profile for the application that uses bwrap instead. We have already created one for opam AppArmor upstream has also created a profile for bwrap that does not make your machine vulnerable. You can find the profile here. It is not enabled by default on Ubuntu, but you can enable it by either copying the file from gitlab, installing it on /etc/apparmor.d/, and load it using You can also use the version shipped by the apparmor-profile package, and create a symbolic link from the extra-profiles directory to /etc/apparmor.d/ |
exactly. I had the same problem after installing opam on /usr/local/bin |
So...can this issue be actioned in any way by opam maintainers? Or should it be closed? |
would handling the missing AppArmor profile in the opam install script be enough? This has the advantage of not requiring a fixed version pointing to some documentation to work:
I'm not sure what's best to do for people who install opam manually without the script though in the short term. If that seems reasonable for you all, could you test this script and give me some feedback? I've tested it locally on the Ubuntu 24.04 qemu image and it worked fine. I'll open a PR later in the week if there is no pushbacks |
I've recently upgraded my computer from kubuntu 23.10 to kubuntu 24.04. This lead to errors with opam. Specifically,
opam upgrade
failed at trying to build the first package (dune.3.15.2
), andopam switch create 4.14.1
also failed with the same error message:Doing some digging, it seems to be related to ubuntu deciding to restrict unprivileged user namespaces https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces. I found a fix, detailed here: https://etbe.coker.com.au/2024/04/24/ubuntu-24-04-bubblewrap/ which got opam working again.
Config:
The text was updated successfully, but these errors were encountered: