Closed penguinland closed 4 months ago
I installed 2.0.1 via the debian on Ubuntu 24.04 LTS, and when launching via gnome under Wayland, I get a similar error:
2024-06-11T14:17:04.243303-05:00 xxx systemd[2714]: Started app-gnome-devtoys-71305.scope - Application launched by gnome-shell.
2024-06-11T14:17:04.915724-05:00 xxx devtoys.desktop[71349]: bwrap: setting up uid map: Permission denied
2024-06-11T14:17:04.915774-05:00 xxx kernel: audit: type=1400 audit(1718133424.913:395): apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=71348 comm="bwrap" requested="userns_create" target="unprivileged_userns"
2024-06-11T14:17:04.915792-05:00 xxx kernel: audit: type=1400 audit(1718133424.913:396): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=71349 comm="bwrap" capability=8 capname="setpcap"
2024-06-11T14:17:04.915800-05:00 xxx kernel: audit: type=1400 audit(1718133424.913:397): apparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" error=-13 profile="unprivileged_userns" name="proc/71349/uid_map" pid=71349 comm="bwrap" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
2024-06-11T14:17:04.916304-05:00 xxx DevToys[71305]: Failed to fully launch dbus-proxy: Child process exited with code 1```
There is also logs being generated I guess here: ~/.local/share/devtoys-preview/Logs
One log for each run, with an epoch timestamp for a name, each run for me (4 in all) are the same, no errors, just startup text. Here's the tail with the prior ~40 lines snipped:
<snip>
2024-06-11T14:17:04.7979265-05:00 Information [DevToys.Core.Tools.GuiToolInstance] [LogInitialized] Initialized 'Settings' tool instance manager.
2024-06-11T14:17:04.7985013-05:00 Information [DevToys.Core.Tools.GuiToolInstance] [LogInitialized] Initialized 'NoSearchResults' tool instance manager.
2024-06-11T14:17:04.8011967-05:00 Information [DevToys.Core.Tools.GuiToolProvider] [LogToolInstancesCreated] Instantiated 32 tools in 8.4096ms
Could it be that it is resulting from Ubuntus AppArmor configuration (see: https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces)?
You would probably need to configure your system to be able to run the software. You can try the commands mentioned in the linked blog article to verify if it works if you disable the feature temporarily.
This is on my work laptop, so I don't feel comfortable disabling security features even temporarily, sorry. I'm on Ubuntu 24.04, using the XFCE desktop environment and window manager, if that's important.
Like @phiro69, I see logs generated in that directory, but they don't indicate any obvious problems:
2024-06-11T15:44:19.1213375-04:00 Information [DevToys.Core.FileHelper] [0] Cleared temp files in 0.3513ms
2024-06-11T15:44:19.1272374-04:00 Information [DevToys.Core.Mef.MefComposer] [LogDiscoveringPlugin] Discovering plugin in '/home/alan/devtoys/Plugins/DevToys.Tools'...
2024-06-11T15:44:19.1993479-04:00 Information [DevToys.Core.Mef.MefComposer] [LogMefComposition] MEF composed 112 parts from 6 assemblies in 73.3683ms
2024-06-11T15:44:19.2126419-04:00 Information [DevToys.Linux.LinuxProgram] [2] MEF, services and logging initialized in 319.6586 ms
2024-06-11T15:44:19.2126928-04:00 Information [DevToys.Linux.LinuxProgram] [1] App is starting...
2024-06-11T15:44:19.2345329-04:00 Information [DevToys.Core.Tools.GuiToolInstance] [LogInitialized] Initialized 'Base64ImageEncoderDecoder' tool instance manager.
2024-06-11T15:44:19.2345753-04:00 Information [DevToys.Core.Tools.GuiToolInstance] [LogInitialized] Initialized 'Base64TextEncoderDecoder' tool instance manager.
...
2024-06-11T15:44:19.2356517-04:00 Information [DevToys.Core.Tools.GuiToolInstance] [LogInitialized] Initialized 'NoSearchResults' tool instance manager.
2024-06-11T15:44:19.2371463-04:00 Information [DevToys.Core.Tools.GuiToolProvider] [LogToolInstancesCreated] Instantiated 32 tools in 4.3755ms
I'm 99% sure this is an overzealous apparmor issue, I'm working on a unconfined profile for devtoys but I can't quite get it to work. Mixing the case (DevToys vs devtoys) seems - no offense DevToys devs - really stupid.
The answer was right in front of me, it's not DevToys.Linux that's being denied, it's when it invokes bubblewrap.
This "fixes" the issue:
sudo pico /etc/apparmor.d/bwrap && sudo systemctl restart apparmor.service
abi <abi/4.0>,
include <tunables/global>
profile bwrap /usr/bin/bwrap flags=(unconfined) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/bwrap>
}
A reference here: https://etbe.coker.com.au/2024/04/24/ubuntu-24-04-bubblewrap/ and many other askubuntu & other resources.
Hi @phiro69 , Thanks for your investigation and the workaround you found.
I have to admit I'm pretty newbie to Linux. Is this issue something that should be fixed in DevToys, or is it some magic going-on on some people's machine, in which case I can't do much?
Thanks
I'm no linux expert haha ;)
AppArmor is part of Ubuntu, and it keeps getting ratcheted up each release. In 23.10 they enabled the restriction of unprivileged user namespaces, which broke alot of apps. The announcement is here: https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
One of their sorta-temporary mitigations if you need an unprivileged user namespace as part of your app is to create a profile in apparmor's daemon config folder for your app, and you can even submit it to be included in Ubuntu automatically. 24.04 shipped with ~117 pre-canned exceptions/profiles for apps like steam, discord, slack, opera, firefox, chrome, 1password, and many others. Your app is invoking bubblewrap (bwrap) which doesn't have a pre-existing profile, and it's being blocked from creating an unprivileged user namespace.
To answer your question, I don't know if the best solution is to: 1) get bwrap to submit a profile to be included in Ubuntu 2) change the way you are calling bwrap so to not create a namespace like its being asked to so you are compliant/slip under AppArmor's aegis 3) I ran out of ideas 4) ??? 5) profit!
Skipping to # 5 is what generative ai would suggest.
edit: PS - posting on r/linux is for the brave and/or foolhardy; the loudest people there are permanent trolls that hate the world. Ignore all the hate, relish in all the praise. I come from a history of being a windows system admin, and you & your cohorts bringing devtoys to linux is awesome and there's a ton of people who are only discovering your toolkit for the first time and they are loving it. TYVM for all of this.
PPS supplying a debian is chef's kiss, tyvm. I would suggest you add a snap to your build output and put it in the Ubuntu store; your core audience isn't arch users sitting in their mom's basement bemoaning systemd's tentacles taking over the world, despite 90% of the comments on r/linux.
The answer was right in front of me, it's not DevToys.Linux that's being denied, it's when it invokes bubblewrap.
This "fixes" the issue:
sudo pico /etc/apparmor.d/bwrap && sudo systemctl restart apparmor.service abi <abi/4.0>, include <tunables/global> profile bwrap /usr/bin/bwrap flags=(unconfined) { userns, # Site-specific additions and overrides. See local/README for details. include if exists <local/bwrap> }
A reference here: https://etbe.coker.com.au/2024/04/24/ubuntu-24-04-bubblewrap/ and many other askubuntu & other resources.
thank you, using your instructions I successfully launched devtoys on ubuntu 24.04
Hi, Did you try installing DevToys through the deb package? I downloaded the deb file and installed it using GDebi. I am able to start and use DevToys after installing it like that.
Please use this workaround for now:
sudo pico /etc/apparmor.d/bwrap && sudo systemctl restart apparmor.service
abi <abi/4.0>,
include <tunables/global>
profile bwrap /usr/bin/bwrap flags=(unconfined) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/bwrap>
}
Please use this workaround for now:
sudo pico /etc/apparmor.d/bwrap && sudo systemctl restart apparmor.service abi <abi/4.0>, include <tunables/global> profile bwrap /usr/bin/bwrap flags=(unconfined) { userns, # Site-specific additions and overrides. See local/README for details. include if exists <local/bwrap> }
Thank you so much! This is the only workaround that allows me to run bwrap-enabled apps on my LTS24. I even disabled apparmor as a test (stopped it, disabled it, rebooted), with no results. Your solution worked immediately.
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 DevToys instead. Please contact the AppArmor community if you need any assistance.
AppArmor upstream has 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 sudo apparmor_parser /etc/apparmor.d/bwrap-userns-restrict
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/
sudo ln -s /usr/share/apparmor/extra-profiles/bwrap-userns-restrict /etc/apparmor.d/
and load it
sudo apparmor_parser /etc/apparmor.d/bwrap-userns-restrict
.
I'm having the same issue, but with Nix: bwrap: setting up uid map: Permission denied
I added said bwrap file to apparmor.d and restarted the service, still same result.
Current behavior
I downloaded the CLI for x86 Linux, and it works great. I tried downloading the GUI for x86 Linux, and get the following output:
How to reproduce it (as minimally and precisely as possible)
./DevToys.Linux
Expected behavior
The program starts up
Screenshots
Workaround
Use the CLI instead. :shrug:
Affected platforms
Linux
Affected DevToys kind
DevToys (app with GUI)
DevToys Version
v2.0.1.0
Relevant Assets/Logs