Arduino Yun OpenWrt upgrade, sftp and nodejs

As i get to understand more about the capabilities of Yun, i did some basic house keeping work on the Yun. I expanded the disc space with a micro SD card. Upgraded the OpenWrt-Yun firmware and installed sftp and nodejs.

Expanded Disk Space with micro SD card

The openwrt-yun os running on Yun takes about 9MB of the available 16 MB. So its essential to expand disc space if you want to add more files and packages.Following the instructions here i expanded the memory with an 8 GB micro SD card.

Please note that once you expand the disk space, if you ssh in to your you will see a folder called  /mnt/sda1/arduino/www

Anything you put in to this folder will be served as a static web page. To be able to copy multiple files you would need sftp on the yun. See below.

Installed SFTP

Copying files to Yun would be a pain if you have to do it one by one or by swapping the SD card between computer and yun. So i installed sftp by running the package manager through secure shell (ssh). SSH is going to be your best friend when you are working with Yun. Get familiar with it if you are not already). Here is how to install sftp:

  1. On Mac Os X open Terminal.
  2. ssh root@youryun.local
  3. provide password and then update opkg package manager before installing sftp

opkg update
opkg install openssh-sftp-server

That should allow you to SFTP in to yun and copy multiple files.Here is a reference to using sftp.

Install node js

I am not a python developer. I wanted the flexibility of javascript. So i wanted nodejs. I installed it by running this command after ssh into the Arduino Yun. An expanded disk space is essential to do this:
opkg install node

Upgraded the OpenWrt-Yun image

Please note that if you upgrade the openwrt-yun image, you will be erasing all your settings. I did this and ended up erasing all my configuration and redoing everything again.

    1. This is necessary only if you want to keep up with the latest releases. Otherwise you might be perfectly fine with OpenWrt-Yun that came pre-installed on your yun.
    2. The default configuration dashboard you get when you access the yun using http://youryoun.local provides you a minimal configuration screen. But If you want to see the advanced openwrt-yun dashboard and the configure certain other features on your yun access the it by clicking the “advanced configuration panel(luci)” link that you will see on the top of the “Configure” screen.
    3. There are lot of configuration features here. i was even able to make the leds on the board blink by just updating some config entries.
    4. You can note the latest firmware version. It should be “OpenWRTYun Attitude Adjustment 1 / LucCI 0.11 Branch (0.11 + svn9964)” as of this writing .. If you follow the upgrade steps below, you might see that last part get updated to svn10537 or some such based on the current version.
    5. I used the instructions from here to upgrade the OpenWrt-Yun, http://arduino.cc/en/Tutorial/YunSysupgrade
    6. Update: One thing to be aware of after upgrading the openwrt-yun image is that the host key for the Yun would have changed. If you didn’t change the name of your Yun, then when you try to establish an  ssh connection to the updated yun, your computer may not be able to connect. For example in Mac OS X i got the following error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a4:84:3f:ff:e3:e5:95:59:23:d0:fd:08:8d:5b:f7:03.
Please contact your system administrator.
Add correct host key in /Users/yourusername/.ssh/known_hosts to get rid of this message.

All you have to do is edit the known_hosts file at and remove the entire entry belonging to your old yun name.

/Users/tonystark/.ssh/known_hosts

In later posts i intend to show how i use the nodejs in my WiFi christmas tree project

2 thoughts on “Arduino Yun OpenWrt upgrade, sftp and nodejs”

Leave a Reply

Your email address will not be published. Required fields are marked *