Skip to content

Instantly share code, notes, and snippets.

@laanwj
Last active October 4, 2024 06:17
Show Gist options
  • Save laanwj/cddb2ec7d18e71066d21e5ee993fe971 to your computer and use it in GitHub Desktop.
Save laanwj/cddb2ec7d18e71066d21e5ee993fe971 to your computer and use it in GitHub Desktop.
Getting guix to work with apparmor on Ubuntu 24.04

The standard assumption up to now has been that applications that don't have a specific apparmor profile run in the "unconfined" profile, which essentially doesn't forbid anything. However, in 24.04, everything using unprivileged namespaces automatically ends up in the "unprivileged_userns" profile, which does add rules. Disabling this profile doesn't work, because that seems to block use of unprivileged namespaces completely.

What does work is to create a specifc apparmor profile for guix, that is really unconfined and allows user namespaces:

Create a file /etc/apparmor.d/guix:

abi <abi/4.0>,
include <tunables/global>

profile guix /usr/bin/guix flags=(unconfined) {
  userns,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/guix>
}

(you might have to specify a different path instead of /usr/bin/guix when the binary is somewhere else, e.g. sometimes it's something like /gnu/store/c9a2snygcp9iywbncwky5jcjp29x3hsw-guix-command where the chain of symlinks points)

Then do:

/etc/init.d/apparmor reload

See:

@laanwj
Copy link
Author

laanwj commented Oct 4, 2024

Removed the mention of aa-enforce. It appears that this only updates the configuration file, and not always in the right way, and shouldn't be needed when having updated the configuration correctly manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment