{"id":8563,"date":"2023-10-02T11:23:56","date_gmt":"2023-10-02T03:23:56","guid":{"rendered":"https:\/\/blog.hoyo.idv.tw\/?p=8563"},"modified":"2023-10-02T11:23:56","modified_gmt":"2023-10-02T03:23:56","slug":"nanopi-dietpi","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=8563","title":{"rendered":"NanoPi - DietPi"},"content":{"rendered":"<p>--<\/p>\n<h2>\u9810\u8a2d\u5e33\u865f\u3001\u5bc6\u78bc<\/h2>\n<p>root<br \/>\ndietpi<\/p>\n<ul>\n<li><a href=\"https:\/\/wiki.friendlyarm.com\/wiki\/index.php\/DietPi\/zh\" target=\"_blank\" rel=\"noopener\">DietPi<\/a> wiki.friendlyarm.com<\/li>\n<li><a href=\"https:\/\/cloud.tencent.com\/developer\/article\/1677948\" target=\"_blank\" rel=\"noopener\">DietPi\u6298\u817e\u8bb0<\/a><\/li>\n<\/ul>\n<p>--<\/p>\n<pre class=\"lang:default decode:true\">\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n DietPi v7.3.2 : 08:25 - Tue 07\/13\/21\r\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n - Device model : NanoPi NEO (armv7l)\r\n - CPU temp : 42'C : 107'F (Optimal temperature)\r\n - LAN IP : 172.16.1.149 (eth0)\r\n - MOTD : DietPi v7.3 has been released:\r\n          https:\/\/dietpi.com\/docs\/releases\/\r\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n DietPi Team     : MichaIng (lead), Daniel Knight (founder), Joulinar (support)\r\n Image by        : DietPi Core Team (pre-image: Armbian)\r\n Web             : https:\/\/dietpi.com | https:\/\/twitter.com\/DietPi_\r\n Patreon Legends : Camry2731\r\n Contribute      : https:\/\/dietpi.com\/contribute.html\r\n DietPi Hosting  : Powered by https:\/\/myvirtualserver.com\r\n\r\n dietpi-launcher : All the DietPi programs in one place.\r\n dietpi-config   : Feature rich configuration tool for your device.\r\n dietpi-software : Select optimized software for installation.\r\n htop            : Resource monitor.\r\n cpu             : Shows CPU information and stats.\r\n\r\nroot@DietPi:~#<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<h2>vi<\/h2>\n<pre class=\"lang:default decode:true\"># apt install vim<\/pre>\n<p>--<\/p>\n<h2>https:\/\/apt.armbian.com buster Release Redirection from https to<\/h2>\n<pre class=\"lang:default decode:true\"># vi \/etc\/apt\/sources.list.d\/armbian.list\r\ndeb http:\/\/apt.armbian.com\/ buster main<\/pre>\n<p>\u5c07 https:\/\/ \u6539\u6210 http:\/\/<\/p>\n<p>\u90fd\u6703\u6307\u5411\u5927\u9678\u5b78\u6821\u7db2\u7ad9\uff0c\u4e0d\u77e5\u9053\u662f\u5426\u53f0\u7063\u6c92\u6709\u00a0armbian \u93e1\u5c04\u7db2\u7ad9\uff0c\u81f3\u5c11 Google \u904e\u662f\u6c92\u6709<\/p>\n<p>--<\/p>\n<h2>SSH<\/h2>\n<ul>\n<li><a href=\"https:\/\/dietpi.com\/phpbb\/viewtopic.php?f=11&amp;t=5240&amp;sid=8377a049b02bbd1403c70082f59ff379\" target=\"_blank\" rel=\"noopener\">[Solved] Unable to change SSH port?<\/a><\/li>\n<\/ul>\n<p>\u9810\u8a2d\u4f7f\u7528 Dropbear\uff0c\u5982\u8981\u4f7f\u7528 sftp \u5c31\u8981\u6539\u56de OpenSSH<\/p>\n<p>dietpi-software \u2192 SSH Server<\/p>\n<p>--<\/p>\n<h2>DietPi 7.6 UART \u7121\u6cd5\u958b\u555f<\/h2>\n<ul>\n<li><a href=\"https:\/\/forum.armbian.com\/topic\/8274-how-to-enable-uart-on-nano-pi-k2\/\" target=\"_blank\" rel=\"noopener\">how to enable UART on Nano Pi K2?<\/a><\/li>\n<li><a href=\"https:\/\/docs.armbian.com\/User-Guide_Allwinner_overlays\/\" target=\"_blank\" rel=\"noopener\">Device Tree overlays - Armbian Documentation<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \"># vi \/boot\/armbianEnv.txt<\/pre>\n<p>\u4fee\u6539 overlays \u589e\u52a0 uart1\uff0c\u4ee5\u53ca\u589e\u52a0 uart1 \u7684\u8a2d\u5b9a<\/p>\n<pre class=\"lang:default decode:true\">overlays=usbhost1 usbhost2 uart1<\/pre>\n<p>\u7de8\u8f2f\u5b8c\u6210\u5f8c\u91cd\u65b0\u555f\u52d5\uff0c\u4f7f\u7528 echo \"a\" &gt; \/dev\/ttyS1 \u61c9\u8a72\u5c31\u53ef\u4ee5\u6b63\u5e38\u57f7\u884c<\/p>\n<p>--<\/p>\n<h2>UART<\/h2>\n<ul>\n<li><a href=\"https:\/\/dietpi.com\/phpbb\/viewtopic.php?f=11&amp;t=1226\" target=\"_blank\" rel=\"noopener\">NanoPi Neo serial port<\/a><\/li>\n<\/ul>\n<p>\u786c\u9ad4\u8a18\u5f97\u958b\u555f\uff0c\u670d\u52d9\u5168\u90e8\u95dc\u9589<\/p>\n<p>dietpi-config \u2192 4 : Advanced Options \u2192\u00a0Serial\/UART<\/p>\n<p>--<\/p>\n<h2>route, ifconfig command not found<\/h2>\n<pre class=\"lang:default decode:true\"># apt-get install net-tools<\/pre>\n<p>--<\/p>\n<h2>\u95dc\u9589\u958b\u6a5f NTP<\/h2>\n<p>dietpi-config \u2192 4 : Advanced Options \u2192\u00a0Time sync mode : [Custom]<\/p>\n<p>--<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162342.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-8618\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162342-300x210.png\" alt=\"\" width=\"300\" height=\"210\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162342-300x210.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162342-430x300.png 430w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162342.png 746w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-8619\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352-300x140.png\" alt=\"\" width=\"300\" height=\"140\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352-300x140.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352-768x359.png 768w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352-1024x478.png 1024w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352-500x233.png 500w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2021\/07\/20210727_162352.png 1101w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>--<\/p>\n<h2>Python3 &amp; pip3<\/h2>\n<pre class=\"lang:default decode:true\"># apt install python3<\/pre>\n<p>\u9810\u8a2d\u5b89\u88dd\u7248\u672c\u70ba 3.7<\/p>\n<ul>\n<li><a class=\"question-hyperlink\" href=\"https:\/\/askubuntu.com\/questions\/1239829\/modulenotfounderror-no-module-named-distutils-util\" target=\"_blank\" rel=\"noopener\">ModuleNotFoundError: No module named 'distutils.util'<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\"># apt install python3-distutils python3-apt\r\n# wget --no-check-certificate https:\/\/bootstrap.pypa.io\/get-pip.py\r\n# python3 get-pip.py<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<h2>Python 3.9<\/h2>\n<ul>\n<li><a href=\"https:\/\/linuxize.com\/post\/how-to-install-python-3-8-on-debian-10\/\" target=\"_blank\" rel=\"noopener\">How to Install Python 3.8 on Debian 10<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\"># apt update\r\n# apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev\r\n# curl -O https:\/\/www.python.org\/ftp\/python\/3.9.6\/Python-3.9.6.tar.xz\r\n# tar -xf Python-3.9.6.tar.xz Python-3.9.6\/\r\n# cd Python-3.9.6\/\r\n# .\/configure --enable-optimizations\r\n# make -j 4\r\n# make altinstall\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\">WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https:\/\/pip.pypa.io\/warnings\/venv<\/pre>\n<p>pip3<\/p>\n<pre class=\"lang:default decode:true\"># python3.9 -m pip install pip<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<h2>\u78c1\u789f\u60c5\u6cc1\u7d00\u9304<\/h2>\n<pre class=\"lang:default decode:true \">g# df -h\r\nFilesystem      Size  Used Avail Use% Mounted on\r\nudev            189M     0  189M   0% \/dev\r\ntmpfs            50M  1.6M   48M   4% \/run\r\n\/dev\/mmcblk0p1   15G  2.6G   12G  19% \/\r\ntmpfs           246M     0  246M   0% \/dev\/shm\r\ntmpfs           5.0M     0  5.0M   0% \/run\/lock\r\ntmpfs           246M     0  246M   0% \/sys\/fs\/cgroup\r\ntmpfs            50M     0   50M   0% \/var\/log\r\ntmpfs           1.0G  520K  1.0G   1% \/tmp<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<h2>SD \u7626\u8eab<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/Drewsif\/PiShrink\" target=\"_blank\" rel=\"noopener\" data-pjax=\"#js-repo-pjax-container\">PiShrink<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \"># wget https:\/\/raw.githubusercontent.com\/Drewsif\/PiShrink\/master\/pishrink.sh\r\n# chmod +x pishrink.sh<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \"># dd if=SBS_A01.1.img of=\/dev\/mmcblk0 status=progress<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\"># .\/pishrink.sh dietpi.img\r\npishrink.sh v0.1.2\r\npishrink.sh: Gathering data ...\r\npishrink.sh: Checking filesystem ...\r\n\/dev\/loop1: 40925\/1418480 files (0.7% non-contiguous), 777985\/3888512 blocks\r\nresize2fs 1.45.5 (07-Jan-2020)\r\npishrink.sh: Shrinking filesystem ...\r\nresize2fs 1.45.5 (07-Jan-2020)\r\nResizing the filesystem on \/dev\/loop1 to 1107406 (4k) blocks.\r\nBegin pass 2 (max = 43386)\r\nRelocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\nBegin pass 3 (max = 119)\r\nScanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\nThe filesystem on \/dev\/loop1 is now 1107406 (4k) blocks long.\r\n\r\npishrink.sh: Shrinking image ...\r\npishrink.sh: Shrunk dietpi.img from 15G to 4.3G ...<\/pre>\n<p>&nbsp;<\/p>\n<p>\u555f\u52d5\u6062\u5fa9\u6700\u5927\u7a7a\u9593<\/p>\n<pre class=\"lang:default decode:true \"># systemctl restart dietpi-fs_partition_resize.service<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"8563\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;4,207&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>-- \u9810\u8a2d\u5e33\u865f\u3001\u5bc6\u78bc root...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"8563\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;4,207&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[308],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/8563"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8563"}],"version-history":[{"count":20,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/8563\/revisions"}],"predecessor-version":[{"id":12711,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/8563\/revisions\/12711"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}