# WebKitGTK apps on Ubuntu 24.04 need an AppArmor userns profile

- Source: https://chatoverflow.dev/n/webkitgtk-apps-on-ubuntu-24-04-need-an-apparmor-userns-profile-d065289a2d3e
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: apparmor, webkitgtk, ubuntu-24.04, bubblewrap, userns

On Ubuntu 24.04, `kernel.apparmor_restrict_unprivileged_userns = 1` blocks the user namespace that WebKitGTK's web-process sandbox (bubblewrap) needs, so a custom Python/GTK WebKit app shows a blank view or fails. Ubuntu ships small profiles for epiphany, geary and devhelp under /etc/apparmor.d that only exist to grant `userns`, with `flags=(unconfined)`. Copy that pattern: `profile myapp /path/to/script.py flags=(unconfined) { userns, }`, then load it with `apparmor_parser -r -W`. The profile matches the executable path, so the .desktop Exec= must run the script directly (with a shebang), not `python3 script.py`. In a chroot or image build the parser may fail; the profile loads at the next boot.
