oth
Posts: 27
Joined: Thu Nov 14, 2019 11:17 am

[solved*] PiServer and Arduino

Thu Dec 12, 2019 6:45 am

Hello,
my PiServer classroom is constantly improving, thanks to the help from this forum!

One piece missing is the Arduino IDE. Can anyone point me in the right direction on how to install the Arduino IDE ?
I failed - and am aware that this might not be a PiServer issue. This might still interest other PiServer Classroom users.

I chrooted into the Shell of the Buster image and ran the following:

Code: Select all

cd /usr/local/share
mkdir arduino
cd arduino
wget https://downloads.arduino.cc/arduino-nightly-linuxarm.tar.xz
tar xJvf arduino-nightly-linuxarm.tar.xz
arduino-nightly/install.sh
I get the following error:

Code: Select all

Adding desktop shortcut, menu item and file associations for Arduino IDE...

/usr/bin/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
/bin/chown: invalid user: 'pi'

 done!
Last edited by oth on Thu Dec 12, 2019 4:43 pm, edited 1 time in total.

incognitum
Posts: 529
Joined: Tue Oct 30, 2018 3:34 pm

Re: PiServer and Arduino

Thu Dec 12, 2019 9:41 am

Judging by those messages, that install script is only written to install Arduino for just the current user (which happens to be root, when running the script through the Piserver chroot shell), instead of for all users on the system.
Suggest you ask the Arduino guys why they do not offer scripts/instructions to install it globally.

Do not have an Arduino. So don't know if it needs anything special to access the device, or if it's just a matter of tossing the .desktop file (which causes the item to appear in the start menu) in the right global folder (e.g. /usr/share/applications).
and am aware that this might not be a PiServer issue. This might still interest other PiServer Classroom users.
Do keep in mind that there may be more Arduino users, than Piserver users. Not everybody here is responsible for setting up classrooms, and those that do may or may not be using Piserver for it.
The moment they see Piserver in the title, they may think "oh, not using that, no need to see what that post is about"
While it could very well be that they do have experience using Arduino in other multi-user environments, and may be able to help you with this.

hippy
Posts: 8240
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: PiServer and Arduino

Thu Dec 12, 2019 12:05 pm

oth wrote:
Thu Dec 12, 2019 6:45 am
I chrooted into the Shell of the Buster image and ran the following: ... I get the following error:

/bin/chown: invalid user: 'pi'
That does seem to be an issue with how you are doing the install or what you have as it works when installed under Raspbian as the "pi" user. I know nothing of PiServer so can't help beyond that.

incognitum
Posts: 529
Joined: Tue Oct 30, 2018 3:34 pm

Re: PiServer and Arduino

Thu Dec 12, 2019 2:51 pm

hippy wrote:
Thu Dec 12, 2019 12:05 pm
That does seem to be an issue with how you are doing the install or what you have as it works when installed under Raspbian as the "pi" user.
Well, Piserver is a multi-user system for classrooms.
So the user that will eventually run the application will be "name-of-student-that-logged-in", rather than pi.

Any installation script written with the hard-coded presumption that only one user will ever use the application, will not do well in multi-user environments.
Regardless wheter that multi-user environment is piserver, pinet or was simply created by adding an extra user with the standard "adduser" command.
After all, having multiple users is standard Unix functionality...

incognitum
Posts: 529
Joined: Tue Oct 30, 2018 3:34 pm

Re: PiServer and Arduino

Thu Dec 12, 2019 3:01 pm

BTW it did work in the past: https://github.com/raspberrypi/piserver/issues/31 (to the point of being able to start the Arduino IDE. Have not tested if it was able to actually communicate with hardware, given I do not have one)

So if it's only the mime error you are concerned about: that may not be fatal.
It may or may not affect some functionality, like that Arduino is automatically started if you open an Arduino file, but shouldn't affect the ability to start the program through the start menu.
Have you checked if it appeared there?

oth
Posts: 27
Joined: Thu Nov 14, 2019 11:17 am

Re: PiServer and Arduino

Thu Dec 12, 2019 4:41 pm

Doing the manual install through install.sh results in the Arduino IDE appearing in the Menu. But It won't startup fully. It just shows the splash screen and then terminates.

I solved the issue by just installing the Arduino IDE through apt in the chroot. The version is not up to date.

apt install arduino

resulted in a working multiuser Arduino IDE

So I am happy to have something to work with :)

incognitum
Posts: 529
Joined: Tue Oct 30, 2018 3:34 pm

Re: PiServer and Arduino

Thu Dec 12, 2019 9:12 pm

oth wrote:
Thu Dec 12, 2019 4:41 pm
Doing the manual install through install.sh results in the Arduino IDE appearing in the Menu. But It won't startup fully.
Ah, there is indeed a problem there. But that is not related to the installation error you were getting.

Seems Arduino screwed up the file permissions of some of the bundled java library files in the latest nightly releases, so that no other user than the owner of the file can read them.

To fix (in chroot shell):

Code: Select all

cd /usr/local/share/arduino/arduino-nightly/java/lib
chmod 644 *.jar ext/*.jar security/policy/*/*.jar

oth
Posts: 27
Joined: Thu Nov 14, 2019 11:17 am

Re: [solved*] PiServer and Arduino

Fri Dec 13, 2019 4:42 pm

Hi,
thank you so much for the help and suggestions. I will try this next week. Right now the apt-get version worked and our pupils were able to program the Arduino boards.
I will test your fix on a separate image and test before applying it to the classroom image.
I still need to fix my unreliable boot issues ;)

Will update soon

Thanks !!!!!

incognitum
Posts: 529
Joined: Tue Oct 30, 2018 3:34 pm

Re: [solved*] PiServer and Arduino

Mon Dec 16, 2019 11:47 am

oth wrote:
Fri Dec 13, 2019 4:42 pm
thank you so much for the help and suggestions. I will try this next week.
Arduino fixed the permissions inside their tarball (per), so just redownloading without the chmod should work.

Return to “Staffroom, classroom and projects”