Thursday, January 1, 2009

Installing TinyOS-2.x in Ubuntu intrepid (8.10)

1) add bellow repository to your /etc/apt/sources.list though it is for hardy, it is working for intrepid also

deb hardy main

2) with following commands you can update the apt-cache and search the required packages thin you can install the required version and all.

apt-get update
apt-cache search tinyos
apt-get install tinyos-2.1.0

3) then install python development package (headers)

apt-get install python-dev

4) Edit /opt/tinyos-2.1.0/ and change the CLASSPATH env-variable as bellow


4) Import /opt/tinyos-
2.1.0/ in your .bashrc; include bellow code snippet to ~/.bashrc

if [ -f /opt/tinyos-
2.1.0/ ] ; then
. /opt/tinyos-

5) Now execut bash again or restart the terminal and chech your enviorenment with bellow command. It will check the enviorenment and report you the status. (Ignore the WORNING returned due to graphvis version)


6) Lets compile the first application

cd $TOSROOT/apps/Blink
make micaz

for simulator

make micaz sim

have fun!~


  1. I have tried to install TinyOS 2.1.0 but I got the following error:

    E: /var/cache/apt/archives/avr-gcc-tinyos_4.1.2-20080806_i386.deb:
    trying to overwrite `/usr/lib/libiberty.a', which is also in package
    any help

  2. In my case I have not installed binutils-dev. If you want to keep binutils-dev, rename /usr/lib/libiberty.a (or if you don't need binutils-dev at the moment remove it) and install avr-gcc-tinyos again

  3. getting a warning...

    WARNING: The JAVA version found first by tos-check-env may not be version 1.4 or version 1.5one of which is required by TOS. Please ensure that the located Java version is 1.4 or 1.5

    I have java Tiny OS compatible with it??

  4. Though I'm using 1.5 it is compatible with 1.6 see this link

  5. Worked fine for me! But why do I need the python-dev package?

  6. In tinyos-2.x TOSSIM is a library: you must write a program that configures a simulation and runs it. TOSSIM supports two programming interfaces: Python and C++. Python allows you to interact with a running simulation dynamically, like a powerful debugger. However, since the interpretator can be a performance bottleneck when obtaining results, TOSSIM also has a C++ interface. Usually, transforming code from one to the other is very simple.
    see for more information

  7. Hi, thank U for the post, still I encountered problems. When doing "apt-get install tinyos-2.1.0" I receive an error:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    The repository is the same you are giving and I've tried a lot of things.

    Can you help, please?

  8. Try,
    sudo apt-get --purge autoremove tinyos-2.1.0
    sudo apt-get install tinyos-2.1.0

  9. Hi, thanks for this tutorial but I have some problems. The result of the 'apt-get install tinyos-2.1.0', I have this errors:
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    This is not the same of marina errors.

    Can you help me?

  10. Looks like some packages are broken in given repository probably they will fixed in future.

    Try to install packages manually. Follow the instruction given in this wiki:

    Download and convert rpm packages to deb using alien
    alien -d --scripts package_name.rpm

    Then install all the packages at once using
    dpkg -iRE *.deb

    If you encounter any dependancyy problem us
    apt-get -f install

    to fix them

    you will be fine...

  11. This comment has been removed by the author.

  12. Hi guys!

    Excellents tips, laxaman! Thanks!

    I'm starting on TinyOS, when i was installing it i had a problem with 'avrdude-tinyos_5.4-20080806_i386.deb', so following your tip, i dowloaded and converted the package 'avrdude-tinyos_5.6cvs-2_i386.rpm'. I just installed this package.

    I executed 'sudo apt-get -f install', to ensure that all working.

    My question is:

    "Will i have any problem in the future, because i just installed this package?!?"

    I'm from Brasil.

    Sorry my english, i know a little.


    Rodrigo M. Palheta

  13. there will not be any problem.
    But if you try to upgrade the system, prevent replacing your manually installed packages

  14. Thanx man i have juat started working on ubuntu 8.10 intrepid (iris platform). I followed the above steps n everything came well.

  15. Hi,

    I came across your blog, when i was searching for TOSSIM installation. I am new to UBUNTU and TOSSIM. I have installed Ubuntu 9, following ur steps for TOSSIM instructions, I added the deb http://... to the sources.list. But after that when i type apt-get update, the message i get is "Could not open lock file /var/lib/apt/lists/lock-open (13 Permission Denied).

    I get the same error message for the third command also. How do i proceed, can u help me. I need to get working fast.
    Mohana (

  16. Hi Mohana,

    You have to use "sudo"

    $sudo apt-get install tinyos-2.1

  17. Hi rodrigomp

    Thanks a lot for ur help, i installed TOSSIm and the tos-check-env command too works, except for the warning. But the application blink is giving me error.When i typed cd $TOSROOT/apps/Blink it says no such directory found. what mistake have i done.

    Please help me

  18. Hi,

    I figured out what i should have done, my Tinyos is in /opt....
    so i gave cd /opt/tinyos-2.1.0/apps/Blink
    then i gave make micaz sim but i am getting this error
    make:*** No rule to make target 'micaz'. Stop.

    Please help me

  19. Check whether MAKERULES environment variable is set


    echo $MAKERULES

    otherwise check step 4) above

  20. Hi,

    I checked with echo $MAKERULES, there is no message
    I just get the $ prompt, should i re install.U had said check Step 4 and above. I am new to linux, so can u please elaborate.


  21. MAKERULES is an environment variable which points to a file which contains the generic make rules for many platforms. The make file which is in your project is just a dummy which includes the MAKERULES file.

    What step 4 does is including the file which contain the envirenment setting related stuff from /opt/tinyos-2.1.0/

    In step 4 what you have to do is

    change CLASSPATH= line as

    NOTE: last dot (.) is also required

    include bellow code snippet at the end of .bashrc file which is in you linux home directory (~/.bashrc)

    if [ -f /opt/tinyos-2.1.0/ ] ; then
    . /opt/tinyos-2.1.0/

    Then when your starting a terminal(bash), environment for Tinyos development will be automatically set

  22. hello,

    i have successfully installed tinyos from the repository and included the source file in my bashrc.

    I tried to make a simple example like Blink and i get this kind of errors:

    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:26:20: error: Python.h: No such file or directory
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:296: error: ISO C++ forbids declaration of ‘PyObject’ with no type
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:296: error: expected ‘;’ before ‘*’ token
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:297: error: ‘PyObject’ has not been declared
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:302: error: ‘PyObject_HEAD’ does not name a type
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:306: error: expected initializer before ‘*’ token
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:313: error: ‘FILE’ has not been declared
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx: In function ‘int swig_varlink_print(swig_varlinkobject*, int*, int)’:
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:316: error: ‘fprintf’ was not declared in this scope
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:317: error: ‘struct swig_varlinkobject’ has no member named ‘vars’
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx: At global scope:
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:325: error: expected initializer before ‘*’ token
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:3496: error: expected `}' at end of input
    make: *** [sim-exe] Error 1

    i tried others examples and keep getting errors.What is wrong?

  23. ok i found it....yes that was the problem!

    now i am trying to use tossim.

    For example i try Blink and python and c++ objects are created, what do i execute next to visualize my simulation?....

    thanx for the reply and the help!

  24. Hi, I'm new at tinyos and I'm having trouble with TOSSIM. I understand that tossim is a library and it seems that I have it on the directory /opt/tinyos-2.1.0/tos/lib/tossim . But when I try the command make micaz sim on the Blink directory I get back lots of errors including some TossimActiveMessageC saying it's not implemented. I would like to know if there is something I have to download other then the archives mentioned on the steps of this tutorial or if there is something wrong with my installation.

    Thanks a lot for the help!