Trouble installing Arduino IDE on Raspberry Pi with 2019-09-26 "Buster" OS

FINAL EDIT
I gave up trying to fix this problem because there was another problem with Raspberry Pi’s menu entry of “Python2 (IDLE)” actually being “Python**3** (IDLE)” So I got an old version of their OS and did a trial run through which did what I needed. I hope it doesn’t develop a problem like in the 2nd EDIT. Either way, this ends here.
--------------------------------------------------------------------------------------------------------------------------

2nd EDIT

NOT solved because the problem has returned, so it wasn’t an installation problem.

The problem is when I upload, the button on the Teensy3.2 needs to be pressed and that doesn’t always work. I will try starting from scratch using advice given by Pert below. I will update again if I have any luck


EDIT I had trouble installing Arduino 1.8.10 using the LinuxARM 32 bits download on a Raspberry Pi 2 running a newly flashed operating system (Buster 2019-09-26 ). Three times I went through the procedure below, but had trouble uploading sketches to a Teensy 3.2 (auto mode wouldn’t work, pressing the reset button mostly worked, but the Arduino IDE would freeze or RPi2 would crash altogether) My fourth attempt was on a RPi3 and had no problems at all. I then went back and tried using the original RPi2 and at first seemed to fail, but when I came back to it the Arduino icon was just sitting there where it was supposed to be, like its attitude was, “WHAT?! I’ve been here the whole time.” I proceeded to install the Teensyduino support and all went well.
** THE SOLUTION**
I followed the installation guide, but instead of using ./install.sh I used ./arduino-linux-setup.sh pi, where pi was the user name of my login on the RPi2 (as a parameter being passed to the app/program during start up). This file was always in the extracted arduino-1.8.10 folder (along with install.sh a few other files), so I decided to see what happened and got lucky!


(I have included my entire procedure here, but mostly I’m asking about my installation of Arduino on the Raspberry Pi 2. I had this same board successfully loaded with Arduino and Teensyduino a few years ago when the IDE was first available in the ARM version and had support for Teensy boards as well. So I know the hardware set up works, but I don’t remember exactly each step I did during installation. I thought I would flash the latest Raspbian OS and repeat the install, but it didn’t go well this time. Here’s what happened…)

I flashed Raspbian Buster 2019-09-26 using Balena Etcher without error. After 1st boot setup & updates (and a few apt install: xscreensaver, speedtest-cli, tightvncserver) and a few minor tweaks (panel settings, task bar, appearance settings etc.) I downloaded the 32 bit version:
arduino-1.8.10-linuxarm.tar.xz

which I right-clicked, selected “Extract To…”, and put the folder at:
/home/pi/arduino-1.8.10

Opening a terminal window and navigating:
cd /home/pi/arduino-1.8.10

and finally entering:
sudo ./install.sh

I started the installation process (in basically a pristine state - no internet exposure other than the system updates, no media accessed for docs/music/photos/videos. Nothing - although I don’t know how to verify SHA-256 But I did do the entire process I describe here completely two times). Here’s what I saw:

pi@raspberrypi:~/arduino-1.8.10 $ sudo ./install.sh
Adding desktop shortcut, menu item and file associations for Arduino IDE...

touch: cannot touch '/root/.config/mimeapps.list': No such file or directory
/usr/bin/xdg-mime: 848: /usr/bin/xdg-mime: cannot create /root/.config/mimeapps.list.new: Directory nonexistent

done!
pi@raspberrypi:~/arduino-1.8.10 $

Despite this less than perfect install, I was able to open the IDE which seemed to be OK. I closed the IDE and began the “Teensyduino” installation procedure, adding support for Teensy3.2, which seemed to proceed without incident. Then I loaded up the BLINK example and clicked UPLOAD. Everything seemed OK until the very end:

Opening Teensy Loader...
Teensy Loader could not find the directory /tmp/arduino_build_597513
quitexit status 1
Error compiling for board Teensy 3.2 / 3.1.

(This made me worry because it was looking in the folder which was the default location given in the “Extract To…” box which was /tmp. But I thought I was choosing the final place where Arduino would reside, and the /tmp folder didn’t seem like a spot for long term storage.)
(This was considered by the IDE to be an error because it offered the button to click which would “copy errors into clipboard”)
The thing is, pressing the button on the board got the BLINK to work fine. The normal process is to press the button on the first upload, but then subsequent uploads are normally automatic (no button involved). So I changed the delay time in BLINK to see if a second upload would work:

[--------> I did not include the first part since (I think) it was the same as the first upload <--------]
Opening Teensy Loader...
/home/pi/arduino-1.8.10/hardware/teensy/../tools/arm/bin/arm-none-eabi-size -A /tmp/arduino_build_597513/Blink.ino.elf
Sketch uses 13112 bytes (5%) of program storage space. Maximum is 262144 bytes.
Global variables use 6408 bytes (9%) of dynamic memory, leaving 59128 bytes for local variables. Maximum is 65536 bytes.
/home/pi/arduino-1.8.10/hardware/teensy/../tools/teensy_post_compile -file=Blink.ino -path=/tmp/arduino_build_597513 -tools=/home/pi/arduino-1.8.10/hardware/teensy/../tools -board=TEENSY31 -reboot -port=/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4 -portlabel=/dev/ttyACM0 Everything -portprotocol=Teensy 
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'send': was expecting ('true', 'false' or 'null')
at [Source: (ProcessPipeInputStream); line: 1207, column: 6]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:673)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3526)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2621)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:826)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:723)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2367)
at cc.arduino.packages.discoverers.PluggableDiscovery.run(PluggableDiscovery.java:87)
at java.lang.Thread.run(Thread.java:748)
StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2621)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:826)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:723)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2367)
at cc.arduino.packages.discoverers.PluggableDiscovery.run(PluggableDiscovery.java:87)
at java.lang.Thread.run(Thread.java:748)

After the process hit a snag, I pressed the button on the board and the upload then took effect (different blinking pattern). This time the IDE did not give the option to save the errors to clipboard, so I had to manually highlight and copy to get the above message.

If I only had to press the button every time, I might not have posted this. But the problem is, that after a few times it would crash. Sometimes just the IDE, but then the whole RPi would freeze and I had to kill the power. I have the log for the Teensy Loader, but I didn’t include it here. I mostly wanted to rule out any errors I might have made with the Arduino installation before posting on the Teensy forum. Thanks for your time.

FirstUploadError-SecondUploadMessage.txt (44.3 KB)

Use the official instructions for Linux installations. Note it does not say to run install.sh as root. Also for Raspberry Pi Raspbian, use the 32-bit ARM Linux version of the IDE. It might be easier to try again with a fresh copy of Raspbian and the official instructions.

https://www.arduino.cc/en/guide/linux

@Pagus Although I didn’t mention it in my post, I did try to follow the official instructions you linked to. When I tried using the command ./install.sh I got:

ln: failed to create symbolic link '/usr/local/bin/arduino': Permission denied
Adding symlink failed. Hope that's OK. If not then rerun as root with sudo.
 done!

so that’s why I described using sudo. I was unclear when I referred to the Arduino download using its filename arduino-1.8.10-linuxarm.tar.xz because it doesn’t say 32 or 64, but I did click the download link for the 32 bit version. And just to be triple-sure, I flashed another card and did the whole thing again. This time, the very first thing I did after the initial setup/update/reboot was to install Arduino, but still got the same results. I’ve already planned my fourth attempt, but this time I’ll try using an RPi3 instead of the RPi2 I’ve been using.

didNotWorkWithoutSudo.txt (2.25 KB)

You might try using Arduino IDE 1.8.9 (and I think you'll need the Teensyduino for Arduino IDE 1.8.9 as well). In Arduino IDE 1.8.10, the move to using the new arduino-cli code was started, and there were some bugs introduced. I'm not at all certain this is the cause of your error, but it's worth a try to see if the error is specific to Arduino IDE 1.8.10

@Pert Thanks, I was thinking of using an older version of the RPi's operating system, but I wound up getting the installation to work. After extracting the Arduino download, instead of using the documented ./install.sh I used ./arduino-linux-setup.sh pi instead.

Cheers!

I'm glad to hear it's working now. Thanks for taking the time to post an update with your findings. Enjoy!

I updated my Raspbian and couldn’t get Arduino to install. Then I found this article:

It didn’t work with my distro of 1.8.11 (I didn’t try log in as root and try to install) but does with 1.8.5 (no warnings) at least so far.

The big trick is to sudo mv the extracted folder to /opt and run install.sh there.

key lines, omitting a couple ls … from Home:
cd Downloads/
tar -xf arduino-1.8.5-linuxarm.tar.xz
sudo mv arduino-1.8.5 /opt
sudo /opt/arduino-1.8.5/install.sh

Thanks for the tip, it's good to have options. At some point, I'm sure I will be installing Arduino on a Pi.!

Seeed Studio has RPi 4 2G for $35, 4G for $55 and article on the new boards. Addon RAM is $35/G, I want the 4G but wonder about required power and need for a fan. Seeed says similar power consumption to the 3 B+, is that with 1G RAM as the 3 B+ has?

https://www.seeedstudio.com/Raspberry-Pi-4-Computer-Model-B-2GB-V1.2-p-4299.html

Raspberry Pi 4 Model B is the latest product in the popular Raspberry Pi range of computers. It offers ground-breaking increases in processor speed, multimedia performance, memory, and connectivity compared to the prior-generation Raspberry Pi 3 Model B+ while retaining backward compatibility and similar power consumption. For the end-user, Raspberry Pi 4 Model B provides desktop performance comparable to entry-level x86 PC systems.