Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork65
Display useful message when Linux post-install script has insufficient permissions#138
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
per1234 wants to merge3 commits intoarduino:masterChoose a base branch fromper1234:post-install-message
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
…t permissionsThe Arduino Boards Manager automatically executes the `post_install.sh` script during installation of the platform on aLinux machine.This platform's post-install script is intended to create a udev rules file that gives write permissions for the USBdevices of the platform's boards. These permissions are required in order to upload to the boards.The creation of the udev rules file requires superuser privileges, which are typically not available in the context ofthe post-install script's execution. The script contains code to check whether the necessary privileges are available.If not, it prints a message and skips the udev rules file creation.Previously the message printed when the udev rules file creation was not possible was "Please run as root". This messagewas completely meaningless to the user when printed during the Boards Manager installation. Worse, it might cause themto think they must run the Arduino development software as root user, which is a bad idea and also wouldn't result inthe udev rules file being created since the installation of the platform to the user's account was already completed.The message is hereby updated to provide a meaningful explanation of the potential problem as well as the specificcommand the user can run from the terminal to execute the script as superuser.
… on Linux machineThe Arduino Boards Manager automatically executes the `post_install.sh` script during installation of the platform on anon-Windows machine.The platform's post-install script is Linux-specific, but no provisions were made in the script code for the fact thatit is also executed on macOS machines. Previously, this was fairly innocuous because, although misleading, the messageprinted to the output during the platform installation was short and cryptic and thus easy for the average macOS user toignore:```Configuring platform.Please run as root```Since it is important for Linux users to manually run the script and the previous message did not effectivelycommunicate that, the script was recently modified to print helpful instructions during the Boards Manager installation.The fact that the script is also executed on macOS machines was not considered in that work. This meant that, althoughan improvement for the Linux user experience was accomplished, the macOS user experience was worsened because thoseusers were then presented with more prominent and detailed inappropriate instructions. For example:```Configuring platform.You might need to configure permissions for uploading.To do so, run the following command from the terminal:sudo "/Users/per/Library/Arduino15/packages/arduino/hardware/TODO/42.0.0/post_install.sh"```The problem is fixed by adjusting the script so that the script simply returns silently if it is invoked on a non-Linuxmachine. macOS users will now only see the following benign message in the output during the Boards Managerinstallation:```Configuring platform.```The POSIX-compliant shell code for determining the operating system the script is running under was derived from theArduino CLI application's cross-platform installation script, which has withstood the test of time after years of use bya large user base.
The file permissions were not correctly configured at the time the script was created.
Closed
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Arduino Boards Manager automatically executes the
post_install.shscript during installation of the platform on a Linux machine:https://arduino.github.io/arduino-cli/dev/platform-specification/#post-install-script
This platform's post-install script is intended to create audev rules file that gives write permissions for the USB devices of the platform's boards. These permissions are required in order to upload to the boards.
The creation of the udev rules file requires superuser privileges, which are typically not available in the context of the post-install script's execution by the Arduino development software. The script contains code tocheck whether the necessary privileges are available. If not, it prints a message andskips the udev rules file creation.
Previously the message printed when the udev rules file creation was not possible was "Please run as root":
That "Please run as root" message was completely meaningless to the user when printed during the Boards Manager installation. Worse, it might cause them
to think they must run the Arduino development software as root user, which is a bad idea and also wouldn't result in
the udev rules file being created since the installation of the platform to the user's account was already completed.
The script is here updated to provide a meaningful explanation of the potential problem as well as the specific command the user can run from the terminal to execute the script as superuser:
This is a propagation of a change originally implemented in the
arduino/ArduinoCore-renesasrepo:arduino/ArduinoCore-renesas#334