Photo: Taken at Lingbo Gate of Wuhan University

As a system engineer who faces all kinds of bare boards every day, I am fully prepared for the various pits that The Jetson Nano will step on. In the spirit of stepping on pits and filling pits, I would like to record my experience of stepping on pits here for everyone’s amusement. How to avoid these potholes? I think too much, because in the future even if you bypass these pits, there will be other pits waiting for you 🙂 the important thing is to do people block killing, Buddha block killing Buddha, encounter the pit directly wading through.

The software installation encountered a lock

The following message is displayed when you run the apt-get install command to install the software package:

alex@alex-jetson-nano:~$ sudo apt-get install xrdp
[sudo] password for alex: 
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

Copy the code

After the restart, do nothing, install the software package, the prompt is still.

Guide to Pit filling:

First check to see if any apt processes are working:

Alex @ alex - jetson - nano: ~ $ps aux | grep -i apt root 6569 1912 496 0.0 0.0? Ss 0:00 he/bin/sh/usr/lib/apt/apt systemd. Daily update root 6582 1912 1272 0.0 0.0? S he 0:00 / bin/sh/usr/lib/apt/apt systemd. Daily lock_is_held update _apt 7736 19552 8036 5.4 0.1? S he 0:20 / usr/lib/apt/methods/HTTP alex 7883 7416 640 PTS / 0 R + 0.0 0.0 when 0:00 grep -- color = auto - I aptCopy the code

You can see that the system is doing daily check for updates. The solution is simple: Disable daily check for updates:

System Settings | Software & Updates, the Updates page and Automatically check for Updates, Never

The remote connection

There is no separate display for Jetson Nano, which is shared with the development machine. However, both use HDMI interface, so every time you switch the display, you have to plug and unplug the HDMI cable, which is very troublesome. At this time, remote connection is required.

There are two ways to log in to the Jetson Nano remotely. One is to log in to the Jetson Nano remotely through SSH. This method has low latency and resource consumption, but only supports the command line. The other is to support GUI through the Remote Desktop Protocol (RDP). Those who are familiar with Windows may know that Windows supports Remote login. The same effect can be achieved on Ubuntu.

Jetson Nano runs on Ubuntu, and supporting the remote desktop protocol is simple:

sudo apt-get update
sudo apt-get install xrdp
Copy the code

However, I used Remmina Remote Desktop Client software on my development machine, configured various parameters to connect, but always flash by and quit the application. At first, I suspected that there was a compatibility problem with Remmina Remote Desktop Client. Later, I changed the Remote login under Windows, but it was still the same. View the $HOME/.xorgxrdp.10.log file and you can see that the Server exits.

Guide to Pit filling:

Unlike the normal Ubuntu desktop, Jetson Nano does not support simultaneous login from two clients. In order to save trouble, the automatic login system was selected so that each time the Jetson Nano was started, a user would log in, at which point I would be rejected for logging in remotely. To solve this problem, edit the /etc/gdm3/custom.conf file to find the AutomaticLoginEnable and AutomaticLogin lines and comment them out:

sudo vi /etc/gdm3/custom.conf

# AutomaticLoginEnable=true
# Automatic Login=[user1]
Copy the code

The CV2 module cannot be imported

Python 2.7 is the default version for Jetson Nano, but Python3 is required to install tensorflow-GPU. Python3 is required to import OpencV module.

(tensorflow-GPU) alex@alex-jetson-nano:~$python3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on Linux Type"help"."copyright"."credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>>
Copy the code

If you use the default Python version 2.7, this problem does not exist.

Guide to Pit filling:

Python 2.7 has the opencV module installed by default, but Python3 does not.

sudo apt-get install python3-opencv
Copy the code

If you do not add the –system-site-package parameter to the python virtual environment, you will still have problems in the virtual environment. Delete the no-global-site-packes. TXT file from the virtual environment. If the virtual environment name is tensorflow-gpu, run the following command:

The rm ~ /. Virtualenvs/tensorflow - gpu/lib/python3.6 / no - global - site - packages. TXTCopy the code

Python Virtual Environment

When it comes to python versioning, Python programmers are in absolute tears. The incompatibility between Python 2 and Python 3 has long been a problem, and so far, Python 3 has not killed Python 2, and the two coexist awkwardly. In addition to Python itself, there are also issues with the versions of python third-party packages. Fortunately, we can solve this problem with the help of the Python virtual environment. Unlike virtual machines, python virtual environments are simply environment isolation, with no performance penalty, and are very suitable for Python applications. On the development machine, I used the Anaconda package. However, the Linux version of Anaconda only comes with x86 32-bit and 64-bit packages, not arm64 packages. I had no choice but to use python’s Virtualenv tool.

Guide to Pit filling:

Virtualenv is enough on its own, but for ease of administration I use a wrapper. This is actually a script that wraps a layer around virtualenv for easy use:

sudo apt-get install virtualenvwrapper
Copy the code

To make these scripts easier to use, I added a line to the $HOME/.profile file:

source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
Copy the code

Create a virtual environment named tensorflow-GPU:

mkvirtualenv -p /usr/bin/python3 --system-site-package tensorflow-gpu
Copy the code

Activating a Virtual Environment

workon tensorflow-gpu
Copy the code

Exiting a Virtual Environment

deactivate
Copy the code

Install tensorflow

The Jetson Nano does not ship with TensorFlow and was not even officially supported, so there are a lot of instructions on how to install TensorFlow on the Internet. However, Nvidia is aware of the problem and has officially supported TensorFlow.

Guide to Pit filling:

Install dependency packages:

sudo apt-get install libhdf5-serial-dev hdf5-tools
sudo apt-get install python3-pip
pip3 install -U pip
sudo apt-get install zlib1g-dev zip libjpeg8-dev libhdf5-dev
sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker grpcio six mock requests gast h5py astor termcolor
Copy the code

Notice that some of the steps were so slow that I thought the installation package was blocked. I tried a few times and still did so. Later I realized that some packages were compiled on the fly, so they were slow and required patience.

Then install the latest Tensorflow-GPU:

pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu
Copy the code

To install the specified version:

pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==$TF_VERSION+nv$NV_VERSION
Copy the code

Where TF_VERSION is the release version of TensorFlow, such as 1.12.0. NV_VERSION is the NVIDIA container version of Tensorflow, such as 19.01.

summary

In use Jetson Nano, met a lot of unusual problems, here can’t write, solve the problem mainly by Google, Nvidia developers BBS Nano edition piece, of course, is also worth to have a look, the address is: devtalk.nvidia.com/default/boa… I tried to ask other developers questions in broken English and got a lot of responses.

In fact, the biggest fun of Jetson Nano is the trouble, and we can expect to hit a lot of potholes in the future, but the hardware potholes are bigger than the software potholes, after all, it requires real money. In the next article, I will write about the hardware potholes, so stay tuned.