Jetson nano environment construction
https://developer.nvidia.com/embedded/downloads
https://developer.nvidia.com/embedded/downloads
1. Basic settings
1.1. Use sudo password free
1. Open the terminal and enter the command:
sudo visudo
2. Add the following in the last line of the document:
xxx ALL=(ALL) NOPASSWD:ALL jetson ALL=(ALL) NOPASSWD:ALL Save and exit,among XXX User name for login
1.2. Terminal output IP address
Open the. bashrc file
sudo vim .bashrc
Add the following to the last face
alias python=python3 ip=$(ip addr show eth0 | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*) if [ -z $ip ]; then ip=$(ip addr show wlan0 | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*) fi if [ -z $ip ]; then ip=$(ip addr show lo | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*) fi export ROS_IP=$ip export ROS_MASTER_URI=http://$ROS_IP:11311 echo "-----------------------" echo -e "MY_IP: \033[32m$ROS_IP\033[0m" echo -e "ROS_MASTER_URI: " echo -e "\033[32m$ROS_MASTER_URI\033[0m" echo "-----------------------"
1.3,system program problem detected
How to solve "system program problem detected" under Ubuntu
# Delete crash file sudo rm /var/crash/* # Turn off pop up function sudo gedit /etc/default/apport sudo vim /etc/default/apport Put one of them enable=1 Change to enable=0 that will do
2. Remove unwanted software
Removing LibreOffice will save a lot of space for the system. This software is not very useful for deep learning and computer vision algorithms
sudo apt-get --purge remove docker* libopencv* libreoffice* thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku
eliminate
sudo rm -rf /etc/systemd/system/docker.service.d /var/lib/docker /var/run/docker sudo ifconfig docker0 down sudo brctl delbr docker0 sudo apt-get clean sudo apt-get update sudo apt-get upgrade sudo apt autoremove
In this way, the system is basically clean.
sudo vim /etc/gdm3/greeter.dconf-defaults
Uninstall firefox browser
- View Firefox related content
dpkg --get-selections |grep firefox
- Uninstall all files in the above instructions
sudo apt-get purge firefox unity-scope-firefoxbookmarks
The execution result is as follows, and Firefox browser is successfully uninstalled.
3. Replace domestic source
https://mirror.tuna.tsinghua.edu.cn/help/ubuntu-ports/
sudo gedit /etc/apt/sources.list sudo vim /etc/apt/sources.list sudo vi /etc/apt/sources.list
Then delete everything and copy
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
Image source of China University of science and technology
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic universe deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates universe deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security universe deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security multiverse
Save in the sources.list, and then open the terminal for input
sudo apt-get update sudo apt-get upgrade
4. Install the necessary software
Install vim, terminator, fast, pip, obs, typera, rar, zip, nmap, etc.
Add software source and secret key
sudo apt-add-repository ppa:apt-fast/stable
install
sudo apt install vim terminator libopencv* net-tools python-pip nano python3-pip ffmpeg v4l2loopback-dkms kazam unar rarunrar p7zip* apt-fast nmap tree
Method of unloading pip
python -m pip uninstall pip python3 -m pip uninstall pip
Upgrade pip
python2 -m pip install -U pip # python2.x python3 -m pip install -U pip # python3.x
5. Installing jupyter lab
1. Add dependency
sudo apt install nodejs libssl1.0-dev nodejs-dev node-gyp npm libffi-dev
2. Installing jupyter / jupyterab
pip3 install jupyter jupyterlab
3. Generate corresponding configuration file
jupyter server --generate-config
4. Set the password (it will be set twice here, and the second time is to confirm the entered password)
jupyter server password
5. Modify profile
First, enter the ipython generation key
ipython from notebook.auth import passwd passwd()
Open profile
sudo vim ~/.jupyter/jupyter_server_config.py
Find the following three sentences and modify them into corresponding changes
#c.ServerApp.ip = 'localhost' #c.ServerApp.open_browser = True #c.ServerApp.port = 8888 #c.ServerApp.notebook_dir = ''
Change to
# Allow remote access c.ServerApp.allow_remote_access = True #Line 82 c.ServerApp.ip='0.0.0.0' #Line 194 c.ServerApp.open_browser = False #255 lines c.ServerApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$RMkLlF34taue89xXnsmP4w$fhJAmY0eVS989lGeUJJsEw' #264 lines c.ServerApp.port =8888 #Line 275
6. Open service
jupyter lab --port 8080 --ip=0.0.0.0
7. Set startup and start Jupiter Lab
Method 1:
Create the jupyterlab.service file
sudo vim /etc/systemd/system/jupyterlab.service sudo rm /etc/systemd/system/jupyterlab.service sudo vim /etc/systemd/system/vnc_server.service
Add the following
------------------------------------- jupyterlab -------------------------------------- [Unit] Description=jupyter lab start service After=multi-user.target [Service] Type=idle User=ubuntu ExecStart=/bin/sh -c "jupyter lab" WorkingDirectory=/home/jetson [Install] WantedBy=multi-user.target [Unit] Description=jupyter lab start service After=multi-user.target ------------------------------------- vnc -------------------------------------- [Service] Type=idle User=ubuntu ExecStart=/usr/lib/vino/vino-server WorkingDirectory=/home/ubuntu [Install] WantedBy=multi-user.target
Update | start
sudo systemctl daemon-reload sudo systemctl start jupyterlab.service sudo systemctl enable jupyterlab.service sudo systemctl status jupyterlab.service
Method 2:
sudo vim ~/.config/autostart/jupyterlab.desktop [Desktop Entry] Type=Application Name=jupyter lab server Exec=jupyter lab NoDisplay=true
Method 3:
- First create a jupyterlab.sh
sudo vim ~/jupyterlab.sh
- Add the following
export PATH="$PATH:~/.local/bin/" jupyter lab
- Modify / etc/rc.local and add before exit 0
sudo vim /etc/rc.local su pi -c 'bash ~/jupyterlab.sh'
For example:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi # Start Jupyter Notebook Server at boot su pi -c 'bash /home/pi/lingshunlabboot.sh' exit 0
sudo apt-get install libopencv* libzbar-dev python-sklearn python-scikits-learn python3-scipy python-scipy ros-melodic-joy ros-melodic-joystick-drivers joystick sudo apt autoremove sudo apt-get update python3 -m pip install qrcode pyzbar scikit-image python2 -m pip install opencv-python==3.4.6.27 opencv-contrib-python==3.4.6.27 python3 -m pip uninstall opencv-python opencv-contrib-python numpy protobuf python3 -m pip install --upgrade --force pip numpy==1.19.3 protobuf python3 -m pip install opencv-python==3.4.13.47 opencv-contrib-python==3.4.13.47
6. Install VNC
The VNC remote desktop configuration process of raspberry pie is exactly the same as that of jetson nano. Just follow the steps below.
Take raspberry pie equipment as an example:
user name: yahboom password: yahboom Host name: yahboom-pi
6.1. Remote login
First, open putty software and input IP [192.168.2.68]

Enter the user name [yahboom] and password [yahboom], and click OK.

6.2 installation vino
sudo apt install vino
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-dwDM5VLK-1636679952308)(image-20210609112220771.png)]
6.3. Set Enable VNC service
(you can manually open vnc server at this time)
sudo ln -s ../vino-server.service /usr/lib/systemd/user/graphical-session.target.wants
[the external link image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-ytreddqu-163679952309) (image-20210609112000084. PNG)]
Configure VNC server:
gsettings set org.gnome.Vino prompt-enabled false gsettings set org.gnome.Vino require-encryption false
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-Eb8pXxen-1636679952311)(image-20210609112059651.png)]
Edit org.gnome, recover the missing "enabled" parameter, enter the command to enter the file, and add the key content below to the end of the file. Save and exit.
sudo vim /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-rccjtbrm-163679952312) (image-20210609112311047. PNG)]
<key name='enabled' type='b'> <summary>Enable remote access to the desktop</summary> <description> If true, allows remote access to the desktop via the RFB protocol. Users on remote machines may then connect to the desktop using a VNC viewer </description> <default>false</default> </key>
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-IE1RTH3Z-1636679952313)(image-20210609112354198.png)]
Set to Gnome compilation mode
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
[the external link image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-GMBIMwmz-1636679952314)(image-20210609112713244.png)]
Add the network card to VINO service; Execute to view the network card UUID
nmcli connection show
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-mORXqm72-1636679952315)(image-20210609112755055.png)]
Copy and paste the UUID between the single quotation marks ['] of the following command and execute
dconf write /org/gnome/settings-daemon/plugins/sharing/vino-server/enabled-connections "['e27c8ddd-b660-4e0b-a70d-78a39fd5c9c3 ']" export DISPLAY=:0
[the external link image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-rM5rJrie-1636679952315)(image-20210609112837035.png)]
6.4. Set VNC login password
(the password here is set to 'yahboom')
gsettings set org.gnome.Vino authentication-methods "['vnc']" gsettings set org.gnome.Vino vnc-password $(echo -n 'yahboom'|base64)
[the external link image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-r48UtXJC-1636679952316)(image-20210609112954876.png)]
6.5. Start VNC Server
6.5.1 manual start
/usr/lib/vino/vino-server
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-Q8SNK44X-1636679952317)(image-20210609112921643.png)]
If manual startup is required every time, it will be troublesome. The form of startup and self startup will be set below.
6.5.2 startup and self startup:
VNC server is available only after you log in to Jetson locally. If you want VNC to be automatically available, use the system settings application to enable automatic login.
gsettings set org.gnome.Vino enabled true mkdir -p ~/.config/autostart sudo vim ~/.config/autostart/vino-server.desktop
[external link picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-qdv5cirC-1636679952317)(image-20210609114012454.png)]
Add the following content to the file, save and exit.
[Desktop Entry] Type=Application Name=Vino VNC server Exec=/usr/lib/vino/vino-server NoDisplay=true
[the external link picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-nykoMmw8-1636679952318)(image-20210609114052663.png)]
If the system is set to enter the user password before entering the desktop, the above change script will not start until it enters the desktop. It is recommended to set the system to automatically log in to the desktop.
6.5.3 closing
ps -ef | grep vino
Get the following information
jetbot 7096 1 0 13:39 pts/0 00:00:00 /usr/lib/vino/vino-server jetbot 10082 6770 0 13:48 pts/0 00:00:00 grep --color=auto vino
kill the running number 7096 of the current vnc service program:
kill 7096
6.6 restart the machine
Verify that vnc is set successfully
sudo reboot
6.7. Connect VNC Server
To connect VNC using vnc viewer software, you first need to query the IP address. What I found here is [192.168.2.68]. Enter the IP address, click [Enter], double-click the corresponding VNC user, enter the password [yahboom], select and remember the password. There is no need to enter the password again when the IP remains unchanged next time. Finally, enter the VNC interface
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-9S6g4t57-1636679952318)(image-20210609115150023.png)]
6.8. Adjust resolution
6.8.1,Jetson nano
- Command line adjustment is only valid in this startup.
xrandr --fb 1920x1080 xrandr --fb 800x600 xrandr --fb 1024x600 xrandr --fb 1900x1000
[the external link picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-mjALuFTj-1636679952319)(image-20210609114719924.png)]
- Set startup
Click in the upper right corner to find the startup application in the search
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-d8fxUaHE-1636679952320)(image-20210609110456533.png)]
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-AFWD6VoK-1636679952320)(23425.png)]
After opening and starting the application, click Add; Add names, commands, and comments
[the external link image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-uflesnr5-163667995221) (image-20210609117565363. PNG)]
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (IMG cubabtbh-1636679952321) (43453. PNG)]
Here, we input the instruction to modify the resolution, where 1920x1080 is the resolution, which can be changed according to our own needs
xrandr --fb 1920x1080
Start and restart.
6.8.2 raspberry pie
Modify the config.txt file to be permanently valid
sudo vim /boot/firmware/config.txt
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-kp7dx3zd-163667995222) (image-20210609114700248. PNG)]
For example, add at the bottom (set the resolution to 1920x1080)
--------------------1920x1080----------------------- hdmi_force_hotplug=1 config_hdmi_boost=4 hdmi_group=2 hdmi_mode=82 hdmi_drive=2 hdmi_ignore_edid=0xa5000080 disable_overscan=1 --------------------1024x600----------------------- max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_drive=1 hdmi_cvt 1024 600 60 6 0 0 0
[the external link image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-13kf7lbl-163667995223) (image-20210609114758263. PNG)]
For configuration parameters, please refer to the blog:
https://blog.csdn.net/coolwriter/article/details/77719003
7. Chinese input method installation
7.1,pinyin
sudo apt-get install ibus-pinyin
Then open the system settings, select language support, select ibus, click apply to the whole system, restart the system, and enter
ibus-setup
In the input method interface, click add Chinese, intelligent Pinyin, and enter after completion
ibus restart
7.2,googlepinyin
sudo apt-get install fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin -y perhaps sudo apt-get install fcitx-googlepinyin -y
After installation, click language support in the system settings in the upper right corner of ubuntu and select fcitx. The system defaults to ibus initially; Enter reboot at the terminal
Configure fcitx:
Click the upper right keypad and left click Configure fcitx
When switching input methods: press shift or ctrl+ space
8. Write cuda environment to environment variable
View cuda version
ll /usr/local/cuda
Open. bashrc
sudo vim ~/.bashrc
Add at the end
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} export CUDA_ROOT=/usr/local/cuda
activation
source ~/.bashrc
View cuda version
nvcc -V
9. Configuring jtop to implement NVIDIA SMI tutorial
jetson nano is based on arm architecture. It implements NVIDIA SMI to check the GPU occupation. jtop can be installed!!!
install
sudo pip3 install jetson-stats
View usage
sudo jtop
Open service
sudo systemctl restart jetson_stats.service
Shut down service
sudo systemctl disable jetson_stats.service
Existence path
cd /etc/systemd/system/ perhaps cd /usr/lib/systemd
View service list
systemctl list-sockets
10. Problem collection
10.1. Error apt:
Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
- Find and kill all apt get and apt processes
ps -A | grep apt
Find all apt and apt get processes
sudo kill -9 process ID
- Delete locked file
sudo rm -r /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
10.2. Add serial port to user name
sudo adduser jetson tty sudo adduser xtark tty sudo gpasswd --add jetson dialout
Add permissions to / dev/ttyUSB * under linux
sudo usermod -aG dialout $USER
10.2. vim common shortcut keys
vim/vi operation 1.Skip to the last line of text: Press“ G",Namely“ shift+g" 2.Skip to the last character of the last line: repeat the operation of 1 first, that is, press“ G",Then press“ $"Key, i.e“ shift+4". 3.Skip to the first character on the first line: press twice first“ g", 4.Jump to the first character of the current line: press "0" on the current line. 5.vi Encryption. Enter vi,"Input":" + "X" Then you will be prompted to enter your password twice:wq Save and exit. When you enter again, you will be prompted for your password. If you don't want your password, you can:X When you are prompted to enter your password, press enter twice in a row. 6.vim Delete all contents of the file: :0,$d
10.3. Install and switch lightdm graphical interface for Ubuntu
install
sudo apt install lightdm
switch
sudo dpkg-reconfigure lightdm
10.4. Garbled code
(1) vim garbled code
Modify the. vimrc file
sudo gedit .vimrc sudo vim .vimrc
Add the following line of code
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
(2) gedit garbled code
gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']"
reference resources: https://www.linuxidc.com/Linux/2012-07/65713.htm
(3) Ubuntu 18.04 Chinese garbled code
First, install the Chinese support package language pack zh Hans:
sudo apt-get install language-pack-zh-hans
Then, modify
sudo gedit /etc/environment
Append at the end
LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh:en_US:en"
Modify again
sudo gedit /var/lib/locales/supported.d/local
Append at the end
en_US.UTF-8 UTF-8 zh_CN.UTF-8 UTF-8 zh_CN.GBK GBK zh_CN GB2312
Finally, execute the command:
sudo locale-gen
(4) zip decompression garbled code
Install software:
sudo apt-get install unar unrar p7zip*
Use the lsar command to view the file name in the compressed file:
lsar intelligence.zip
Use the command unar to unzip the file:
unar intelligence.zip
11. Display manager
gdm3, kdm and lightdm are all display managers. They provide graphical login and handle user authentication. The display manager displays the login screen to the user. When the user successfully enters a valid combination of user name and password, the session begins.
kdm and SDDM are the graphics manager of KDE series; kdm is the display of KDE manager. However, in KDE5, it is rejected as SDDM, which is more suitable as the display manager. Therefore, by default, it is on the screen.
LightDM is a standard solution for display manager. It should be lightweight. By default, it is Ubuntu. Xubuntu and Lubuntu. It can be configured and a variety of welcome topics are available.
sudo apt-get install gdm3 lightdm sddm
Uninstall command, there is at least one display manager in the system, otherwise you cannot enter the graphical interface.
sudo apt-get --purge remove gdm3 lightdm sddm
Configuration and switching, you can choose between them. You must restart to take effect.
sudo dpkg-reconfigure gdm3
Check the display manager currently in use
cat /etc/X11/default-display-manager
View how many desktops are installed in the current system
ls /usr/share/xsessions