-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
IDE fails to start on Linux due to missing sandboxing #2429
Comments
The issue is with the AppArmor configuration in Ubuntu 24.04, not the AppImage. The change in the configuration is explained in the release notes of Ubuntu 24.04 (security reasons). Because this problem is caused by the OS configuration, I'm not use what the Arduino IDE team can do, except for documenting the installation procedure. You can disable the sandboxing restriction for all program with:
or by adding to /etc/sysctl.d/local.conf:
But that defeats the purpose of the new AppArmor restriction in Ubuntu 24.04. You can also create a new AppArmor profile for the Arduino IDE (that allows a non-root user to use the sandboxing in a specific application). If you copy the AppImage file to /usr/local/bin/arduino (this is the new name of the AppImage file), you can create an AppArmor profile with a configuration file, for example, in /etc/apparmor.d/usr.local.bin.arduino, containing:
and reloading all AppArmor profiles with:
Now you can run the Arduino IDE without the sandboxing error. You could also run the Arduino IDE with the --no-sandbox option, but that is, in my opinion, a potentially very bad idea. |
@mariovaldez Thank you for a good explanation/solution. The /usr/local/bin/arduino you refer to, is that a directory, or is arduino the actual arduino.Appmage? |
@AndKe I don't think this will change with later versions of Ubuntu. My understanding is that allowing normal users to use kernel namespaces has been considered a security risk (the kernel namespaces are used to create the sandbox in some AppImage applications). The change in the AppArmor configuration of Ubuntu is a mitigation for that risk. Regarding the "/usr/local/bin/arduino" path, that's the program name I used. You can use any filename you like (for example, "/usr/local/bin/arduino.AppImage"). I used the "/usr/local/bin" directory just to follow the Linux FHS guidelines but you can install the program anywhere you want (I'm sure lot of people prefer to install in /opt, or even in a per-user ~/opt or ~/bin directory). Currently I'm using some other AppImage applications (ungoogled-chromium, teams-for-linux, upscayl) that also require their own AppArmor profile. |
@mariovaldez Thank you, sorry for asking a vague question, I did not mean to ask is it will change in future Ubuntu releases, but if the future Arduino IDE AppImage releases will require this fix in forseeable future. Or if some changes to the IDE will make this issue be a thing of the past. |
@AndKe The Arduino IDE 2 is really a Typescript/Javascript web application running locally with a Chromium engine (as an Electron app, in this case all packaged in an AppImage). The Chromium engine uses the sandboxing to reduce security risks. There are several ways to implement the sandboxing. On Linux, the Chromium engine currently uses unprivileged kernel namespaces (in the past other ways have been used but I think they are deprecated now). So, as long as the Arduino IDE uses the Chromium engine provided by the Electron framework, and as long as the Chromium engine requires unprivileged namespaces for the sandboxing, and as long as Ubuntu (or any other distribution) restricts the use of the namespaces, the apparmor profile is needed. |
Yes, unpriviliged is deprecated now, but at least Ubuntu, when upgraded to 24.04 is still accepting unprivileged kernel namespaces - while new installations of the same distro enforces this. |
@mariovaldez AFAIK, other applications like VS Code also use the Electron+Chromium+NodeJS combination right? How do they get around this issue? I didn't have to muck around with this when installing VS Code in Ubuntu 24.04 (apologies if I seem ignorant of something, I am not a web developer and do not know about JS/TS-related concepts in depth) |
@eccentricOrange I don't use VS Code but in the default Ubuntu 24.04 installation there are some AppArmor profiles already configured, among those there is one for VSCode (in the file /etc/apparmor.d/code). See Launchpad bug # 2046844, specifically comment 37 about how to handle the installation of AppImage applications. |
Got it, thanks for the explanation! |
Hi @mariovaldez, all, I am using Ubuntu 24.04. I tried to use the AppArmor profile solution, I like the idea of complying with canonical's security decisions rather than working around them. However after following these steps, I still get the same error as in the original post.
Now, when I run
Funnily enough, I am unable to run
I'm not sure if this is related to why the solution did not work as expected and I wonder do you have any advice for what to try next. So far I have tried:
|
@shaw-a the "/usr/local/bin/arduino" path I used in my example is actually the filename, not a directory (I just edited my previous comment to make that clear). So, with your steps, it would be something like:
You can use any filename you want, just make sure the filename in the AppArmor profile (the path after the word "profile") matches the executable filename. Regarding the problem with the search path, the shell path search is not recursive, so normally will only search for executables (or symbolic links) only in the specified directories, not in subdirectories inside. If you really want to have the executable file inside a subdirectory you can create a symbolic link in /usr/local/bin pointing to the executable in the subdirectory. Of course you can do this differently, for example, if you would like to keep different versions of the Arduino IDE available, you could create an AppArmor profile with a wildcard path (so that you can keep the version number in the filename). This is also useful if you want to keep the filename with version number but don't want to keep updating the AppArmor profile every time you install a new version of the IDE. For example (assuming you keep the original filename and the executables are in /usr/local/bin/):
|
Hi @mariovaldez, I really appreciate your response and your explanation. Following this advice the solution works for me as expected and I can launch the arduino IDE from anywhere by typing the command Kind regards! |
Thank you all for the help. My successful set-up with my
I set the My chosen path was My desktop entry shortcut file is: arduino-arduinoide.desktop
[Desktop Entry] |
Why should running an appimage without sandboxing be worse than running any other linux binary (without sudo)? |
Describe the problem
To reproduce
Start Arduino IDE on a Ubuntu 24.04 machine.
Expected behavior
Work as normal.
Arduino IDE version
2.3.2
Operating system
Linux
Operating system version
Ubuntu 24.04
Additional context
The fault occurs with both the AppImage and ZIP packages of Arduino IDE.
Additional reports
Issue checklist
The text was updated successfully, but these errors were encountered: