Linux實用TUI

Jetson設定

  1. 遠端桌面
    Nomachine

  2. 硬體狀態jtop

    1
    2
    3
    sudo apt update
    sudo apt install python3-pip
    sudo pip3 install -U jetson-stats
  3. 關閉GUI節省GPU資源

  • 暫時關閉以及打開方法
    1
    sudo init 3  #暫時關閉
1
sudo init 5  #打開
  • 重啟後不再打開GUI
    1
    sudo systemctl set-default multi-user.target #關閉
1
sudo systemctl set-default multi-user.target #打開

參考:
https://forum.nomachine.com/topic/problems-connecting-with-nomachine-in-pc-client-without-monitor

樹梅派列印機和掃描器伺服器

L3110-主要依照這篇
https://antivirus.com/2021/05/26/raspberry-pi-project-how-to-convert-a-usb-all-in-one-printer-to-a-wireless-printer/

下面方法解決問題並且成功列印測試頁。

1
2
sudo apt install printer-driver-escpr #安裝後解決
sudo apt install hplip #下次測試不安裝可不可以順利運作(epson)

https://forums.raspberrypi.com/viewtopic.php?t=225739

local列印成功後,設定網路

  • 開啟網路管理服務以及nmtui
    1
    2
    systemctl start NetworkManager
    sudo nmtui

不要設定AllowUser以免權限不足

如果發現錯誤,請在網頁AllowUser留白並且儲存

1
Returning IPP client-error-not-authorized for Create-Job (ipps://192.168.50.169:631/printers/epson_l3110_series) from 192.168.50.9.

https://askubuntu.com/a/708217

掃描器

使用SANE:Setting up a Raspberry Pi Scanner Server using SANE

安裝必要軟體後,檢查SANE能不能找到你的掃描器,如果不行就必須手動設定,方法如官網Helpful commands for Troubleshooting sane

網頁板掃描頁面

https://github.com/sbs20/scanservjs/tree/master

安裝後出現以下說明

1
2
3
4
5
6
7
Created symlink /etc/systemd/system/multi-user.target.wants/scanservjs.service → /etc/systemd/system/scanservjs.service.

scanservjs installed and running
http://127.0.0.1:8080

If you encounter problems when running, try
sudo journalctl -e -u scanservjs

桌面版軟體

安裝後在windows上面安裝前端軟體SaneTwain

其他參考:
https://ubuntu.com/server/docs/service-cups

airprint
https://www.developer.com/mobile/cups-and-raspberry-pi-airprinting/

https://unix.stackexchange.com/questions/394687/printer-drivers-required-if-cups-is-installed

Deepstream辨識結果遠端觀看

RTSP遠端觀看設定

可以參考這篇
特別注意如果Deepstream不是在Jetson上面跑記得要換成下面指令啟動server,因為dGPU的Deepstream沒有nvvidconv原件!!

1
./test-launch "videotestsrc is-live=1 ! videoconvert  ! x264enc ! h264parse ! rtph264pay name=pay0 pt=96"

整合到自己的程式裡

sources\apps\apps-common\src\deepstream_sink_bin.c有詳細的整合方式。

https://github.com/aler9/mediamtx#installation

Ubuntu安裝CUDA cuDNN TeosorRT

  1. 安裝CUDA
    將CUDA的repo加入apt
    1
    2
    3
    4
    5
    6
    wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-debian11-11-7-local_11.7.1-515.65.01-1_amd64.deb
    sudo dpkg -i cuda-repo-debian11-11-7-local_11.7.1-515.65.01-1_amd64.deb
    sudo rm /etc/apt/sources.list.d/*cuda*
    sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
    sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
    sudo apt-get update

接下來注意不要直接sudo apt-get -y install cuda,因為可能會直接安裝最新版的CUDA,而不是你指定的版本

首先確認有哪些版本可以下載

1
apt-cache policy vlc

輸出如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cuda:
Installed: (none)
Candidate: 12.1.1-1
Version table:
12.1.1-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
12.1.0-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
12.0.1-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
12.0.0-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
11.8.0-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
11.7.1-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
11.7.0-1 500
500 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 Packages
......

在這裡我們想安裝CUDA 11.7.1,指令如下

1
sudo apt-get  install cuda=11.7.1-1

再次確認即將安裝的是不是CUDA11.7,是的話再按y

  1. 安裝cuDNN和TensorRT
    1
    2
    3
    4
    5
    sudo apt-get install libnvinfer8=8.4.1-1+cuda11.6 libnvinfer-plugin8=8.4.1-1+cuda11.6 libnvparsers8=8.4.1-1+cuda11.6 \
    libnvonnxparsers8=8.4.1-1+cuda11.6 libnvinfer-bin=8.4.1-1+cuda11.6 libnvinfer-dev=8.4.1-1+cuda11.6 \
    libnvinfer-plugin-dev=8.4.1-1+cuda11.6 libnvparsers-dev=8.4.1-1+cuda11.6 libnvonnxparsers-dev=8.4.1-1+cuda11.6 \
    libnvinfer-samples=8.4.1-1+cuda11.6 libcudnn8=8.4.1.50-1+cuda11.6 libcudnn8-dev=8.4.1.50-1+cuda11.6 \
    python3-libnvinfer=8.4.1-1+cuda11.6 python3-libnvinfer-dev=8.4.1-1+cuda11.6

參考:
https://docs.nvidia.com/metropolis/deepstream/6.1.1/dev-guide/text/DS_Quickstart.html#

https://askubuntu.com/questions/340530/how-can-i-check-the-available-version-of-a-package-in-the-repositories

Ubuntu設定自動化安全性更新

  • install

    1
    sudo apt install unattended-upgrades
  • Verify

    1
    systemctl status unattended-upgrades
  • config

    1
    sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
  • Blacklist
    Unattended-Upgrade::Package-Blacklist

  • Email Notifications
    Unattended-Upgrade::Mail example@email.com;

Unattended-Upgrade::MailOnlyOnError “true”;

  • Enable Automatic Upgrades

    1
    sudo nano /etc/apt/apt.conf.d/20auto-upgrades
  • Testing Automatic Upgrades

    1
    sudo unattended-upgrades --dry-run --debug
  • check log

    1
    /var/log/unattended-upgrades/unattended-upgrades.log

參考:
https://phoenixnap.com/kb/automatic-security-updates-ubuntu