Nao troubleshooting

Jump to: navigation, search

Go to root: TFM-Nao-Goalkeeper

You may run into annoying problems while developing for Nao (I certainly did), some easier to solve than others. I will try to explain how to fix the most common ones. If you have any questions regarding this subject or know of a different bug, feel free to send me an email describing it, and I will add it to this section. Just remember to try Google first!

NOTE: This 2011 tutorial was targeted for version 1.10.10 of the SDK and OS. Newer versions have changed a lot of things, making most of these tutorials deprecated.

Python fails to run

Using Naoqi in a Python program requires some environment variables to be set. Also, forgetting to remove them before running "normal" programs may give an error. Read this section to know which variables you should declare, among other things.


If you get an error like "ImportError: No module named naoqi" while trying to run a test, do the following. Open your .bashrc file:

nano ~/.bashrc

Go to the end (Page Down) and add this, changing the first path so it points to the location where your SDK is:

export AL_DIR=/media/data/naoqi-sdk-1.10.10-linux
export PATH=$AL_DIR/bin:$PATH

Save, close, exit the terminal and open it again so the changes are applied. Check it with this if you want:


You can try now rerunning the test. Please mind that "normal" Python programs (not for Nao) may fail with something like "ImportError: No module named os". This means that you will have to comment the two last exports (the Python ones) and reopen the terminal. It is a bit tiring, but necessary:

export AL_DIR=/media/data/naoqi-sdk-1.10.10-linux
export PATH=$AL_DIR/bin:$PATH


If you get an error like "ImportError: cannot open shared object file: No such file or directory", it is because Python is trying to access that library using the wrong name. The following will fix it in a "brute force" way. First, locate the library in your system:

sudo updatedb

This will tell you the real location, mine was /usr/lib/ Python expects it to be just /usr/lib/ Let's fix it in an unglamorous fashion:

sudo cp /usr/lib/ /usr/lib/

And rerun the test. It is possible that you get the same error relating to It is fixed the same way, I just had to change the names. Of course, we could create symbolic links or adapt some files here and there, but I am not in the mood.

Cmake fails to run

Cmake is easier to get running in Debian than in Ubuntu, where it tends to complain a lot about undefined variables. If this happens to you, try to pass them as -D parameters, using absolute paths for files or directories. This is the only advice I can give to you.

Can't compile my module

Have you installed all dependencies? If you did, this issue may be similar to the one with Python: the compiler is looking for libraries that have the wrong name. For example, when compiling for Geode I got this: "error while loading shared libraries: cannot open shared object file: No such file or directory".

I solved it using the solution exposed before. I issued:

sudo cp /usr/lib/ /usr/lib/

And tried again to compile.

Nao doesn't load my module

Probably your code has some error that allowed it to compile, but is making it crash when Nao tries to load it. Check Nao's OS logs, and try to debug your application using the common tools (GDB, etc).

It is wise to test your applications in Naoqi before moving them to the real robot (that is, if it is feasible, because Naoqi does not implement all features, like movement), as the debugging will be easier to carry out (and you can easily check the output, too).

ALSpeechRecognition not found

If you are trying to work with Nao's speech recognition but it can't find the module, either it hasn't been added to autoload.ini, or you own the RoboCup edition of Nao. Only the Academics edition has this module available.

Proxy fails to connect

In 99% of the cases, you provided the wrong IP address and/or port. Is Nao up and running, and is your module listed as loaded?

If not, check if the Python call uses the right module and function names.

How to create your own broker

I already told you a few times how important using your own brokers is. If your application hangs while it is "hooked" to Nao's default MainBroker, it will hang too, and the robot may fall to the ground. It is an undesirable situation, believe me.

Creating your own broker is so easy that it hurts. Connect to Nao via SSH as root and edit the module's file:

nano /home/nao/naoqi/preferences/autoload.ini

Then, seek the line where your module is, and prepend "[broker name]" to it, like:


This tells Nao to create a new module with that name, that will load the module(s) specified next. Be aware that any other module(s) situated after yours will also be associated to this new broker, unless there is another "[broker name]" line before it/them.

Now you must reboot Nao. Then, before testing your new broker using a Python example, you must find the port it has binded to (it is no longer 9559). This can be easily done with Nmap (use your robot's IP address):

sudo nmap -p9500-10000 -sV

The output will say something like "9561/tcp open unknown". That's the port of your new broker. Edit the Python code and you are a go.

How to flash Nao

Did you break something? Have you edited so many files of your Nao that there is no way you can make him run again? Fear not, as you can flash his USB unit anytime to return it to factory state. I will show you how, you just need a bit of patience. After this, he will boot without problems and you will be able to configure him again.

WARNING: Flashing Nao's USB drive will delete forever any file or configuration you uploaded to him. Be sure to back them up before you proceed.

The first thing is to download the OS image from here. Downloads section, "All Downloads", select your SDK's version (1.10.10 as I write this), "NAO OS", and download "NAOos RoboCup Image v1.10.10" (124 MB). Do not extract it! The file nao-system-image-robocup-1.10.10.gz must remain as it is.

Remove Nao's USB stick and plug it to your computer. Go to the bin/ subdirectory of your SDK's directory, where a script named flash-usbstick lies. Open a terminal here and issue this, giving the path to the OS image:

sudo ./flash-usbstick ../../nao-system-image-robocup-1.10.10.gz

The script will try to detect and use a good enough removable USB drive, that is:

  • Not specially big (512 MB-2 GB).
  • Named "Kingmax".

The script will tell you to "Please umount: /dev/sdb1" (the device name may vary). You have to umount both partitions of the device:

sudo umount /dev/sdb1
sudo umount /dev/sdb2

And retry the script. Now it should take some minutes to format the drive and copy the files. After this, you can remove the stick and plug it back on Nao.

NOTE: You can force the script to use a certain drive with -d<device> (like "sda"), and -f (as in "force").

Go to root: TFM-Nao-Goalkeeper

Links to articles:

Nao tutorial 1: First steps

Nao tutorial 2: First module

Nao troubleshooting