NanoPi M4V2をArmbianで使う(初期セットアップ)

Posted by 雅楽斎 on Thursday, March 26, 2020

TOC

Armbian (Bionic Server)

多数のSBCをサポートするArmbianが一番素のUbuntu環境に近いため、これを使うことにします。

Nanopi M4 V2 – Armbian

現在NanoPi M4V2用に公開されているArmbianは以下のものがあります。

  • Bionic server(Kernel 5.4)
  • Bionic desktop(Kernel 4.4)
  • Buster server(Kernel 5.4)
  • Buster desktop(Kernel 5.4)
  • Buster server(Kernel 4.4)
  • Buster desktop(Kernel 4.4)

BionicはUbuntu 18.04LTS、BusterはDebian 10のことなので、好みと用途から選べば問題ないでしょう。ということで、Bionic serverのKernel5.4のものを選びます。

※NanoPi M4V2でのArmbianはKernel5.4だと問題が多少はありそうなので、全く問題なく動かすことを期待する場合はKernelが4.4のものを選んだ方が安全ですが、この場合はBionicのdesktopかBusterのserver/desktopを選ぶことになります。

NanoPi M4 V2 - M4 Image not working

Hi guys. I've received the NanoPi M4 V2 today. I tried Armbian images for the M4 on SD and eMMC. None boot. So I tried the RockPi4 images since that's got lpddr4 too. That works. Of course no on-board wifi since another chip. So my guess is the lpddr4 isn't supported by the uboot for the M4. It i...

Armbian_20.02.1_Nanopim4v2_bionic_current_5.4.20.7zを展開して取り出したArmbian_20.02.1_Nanopim4v2_bionic_current_5.4.20.imgをetcher等でmicroSDに焼いて、挿して起動します。

SSHログイン、パスワードの変更、一般ユーザーの作成

ArmbianはデフォルトでSSHログイン可能で、初回ログイン時にrootユーザーのパスワード変更、一般ユーザーの作成を行います。正常に起動すればDHCPサーバーからIPアドレスを割り振られるので、ルーターの管理画面等でIPアドレスを確認して接続するのが一番手間がないと思います。

初回接続時のユーザーはroot、パスワードは1234です。SSHで接続すると以下もろもろ表示されます。

$ ssh root@192.168.1.106
The authenticity of host '192.168.1.106 (192.168.1.106)' can't be established.
ECDSA key fingerprint is SHA256:(snip).
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.106' (ECDSA) to the list of known hosts.
root@192.168.1.106's password: 
You are required to change your password immediately (root enforced)
 _   _ ____  _   __  __ _  ___     ______  
| \ | |  _ \(_) |  \/  | || \ \   / /___ \ 
|  \| | |_) | | | |\/| | || |\ \ / /  __) |
| |\  |  __/| | | |  | |__   _\ V /  / __/ 
|_| \_|_|   |_| |_|  |_|  |_|  \_/  |_____|
                                           
Welcome to Armbian Bionic with Linux 5.4.20-rockchip64

System load:   0.06 0.29 0.16  	Up time:       5 min		
Memory usage:  3 % of 3868MB 	IP:            192.168.1.106
CPU temp:      40°C           	
Usage of /:    7% of 15G    	

[ General system configuration (beta): armbian-config ]

rootユーザーのパスワードを変更します。

New to Armbian? Check the documentation first: https://docs.armbian.com
Changing password for root.
(current) UNIX password: 
Enter new UNIX password: 
Retype new UNIX password: 


Thank you for choosing Armbian! Support: www.armbian.com

次に一般ユーザーの作成をします。Debian/Ubuntuのadduserを内部で呼んでいるように見えるので、ユーザー作成をしたことがある場合は迷うことなく行えるでしょう。

Creating a new user account. Press <Ctrl-C> to abort

Please provide a username (eg. your forename): hogehoge
Trying to add user hogehoge
Adding user `hogehoge' ...
Adding new group `hogehoge' (1000) ...
Adding new user `hogehoge' (1000) with group `hogehoge' ...
Creating home directory `/home/hogehoge' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for hogehoge
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] 

Dear hogehoge, your account hogehoge has been created and is sudo enabled.
Please use this account for your daily work from now on.

root@nanopim4v2:~#

apt-lineの確認

備忘録として、Armbian Bionic Server 5.4のデフォルトのapt-lineを記載します。

# cat /etc/apt/sources.list
deb http://ports.ubuntu.com/ bionic main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ bionic main restricted universe multiverse

deb http://ports.ubuntu.com/ bionic-security main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ bionic-security main restricted universe multiverse

deb http://ports.ubuntu.com/ bionic-updates main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ bionic-updates main restricted universe multiverse

deb http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse
# cat /etc/apt/sources.list.d/armbian.list 
deb http://apt.armbian.com bionic main bionic-utils bionic-desktop

kernelの情報等

# uname -a
Linux nanopim4v2 5.4.20-rockchip64 #20.02.1 SMP PREEMPT Mon Feb 17 04:45:00 CET 2020 aarch64 aarch64 aarch64 GNU/Linux

タイムゾーン変更

# timedatectl
                      Local time: Thu 2020-03-19 14:40:38 UTC
                  Universal time: Thu 2020-03-19 14:40:38 UTC
                        RTC time: Thu 2020-03-19 14:40:39
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
# timedatectl list-timezones | grep -i tokyo
Asia/Tokyo
# timedatectl set-timezone Asia/Tokyo
# timedatectl
                      Local time: Thu 2020-03-19 23:41:49 JST
                  Universal time: Thu 2020-03-19 14:41:49 UTC
                        RTC time: Thu 2020-03-19 14:41:50
                       Time zone: Asia/Tokyo (JST, +0900)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

ロケール設定(日本語ロケール追加、更新

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
# apt-get install language-pack-ja
# update-locale LANG=ja_JP.UTF-8
(OS再起動)
$ locale
LANG=ja_JP.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=ja_JP.UTF-8

IPアドレスの固定(Netplan)

Netplan | Backend-agnostic network configuration in YAML

Ubuntu 17.10からデフォルトのネットワーク設定はNetplanを使用することになっているはずですが、Armbianには入っていないのでインストールします。

# apt-get install netplan.io

設定は基本的に/etc/netplan/の下にyamlファイルを書く形になっていますが、ファイル名については辞書順に読み込まれ、後勝ちになるため注意が必要です。

【Ubuntu】 /etc/netplan/50-cloud-init.yamlを編集するの止めろ - Qiita

この記事はSFC-RG AdventCalender 14日目です.まえがき筆者反省の記録.注意cloud-init/netplanのアーキテクチャについては説明しません.対象者Ubun…

/etc/netplan/99-manual.yamlという名前で以下のファイルを作成します。ここでは192.168.1.210というIPアドレスを振っています。

network:
  ethernets:
    eth0:
      dhcp4: false
      addresses:
      - 192.168.1.210/24
      - fd00:dead:beef::10/64
      gateway4: 192.168.1.1
      gateway6: fd00:dead:beef::1
      nameservers:
        addresses:
        - 192.168.1.1
  version: 2

設定ファイルを書いたら反映します。SSHで接続している場合は反映後にIPアドレスが変わるので接続し直します。

# netplan apply

neofetch

どんなdistroか一目瞭然!現在使っているdistroを確認するならneofetchを使おう!

どんな環境なのかターミナル上でグラフィカルに教えてくれるneofetchをインストールします。

# apt-get install neofetch
$ neofetch
            .-/+oossssoo+/-.               hogehoge@nanopim4v2 
        `:+ssssssssssssssssss+:`           ------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 18.04.4 LTS aarch64 
    .ossssssssssssssssssdMMMNysssso.       Host: FriendlyElec NanoPi M4 Ver2.0 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.4.26-rockchip64 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 22 hours, 58 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 449 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 4.4.20 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Terminal: /dev/pts/1 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: (6) @ 1.512GHz 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Memory: 121MiB / 3867MiB 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.                           
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ 
  +sssssssssdmydMMMMMMMMddddyssssssss+ 
   /ssssssssssshdmNNNNmyNMMMMhssssss/ 
    .ossssssssssssssssssdMMMNysssso. 
      -+sssssssssssssssssyyyssss+- 
        `:+ssssssssssssssssss+:` 
            .-/+oossssoo+/-. 

lshw

最後に、lshwの実行結果を貼り付けます。

nanopim4v2                  
    description: Computer
    product: FriendlyElec NanoPi M4 Ver2.0
    serial: 6a4a2da445b43825
    width: 64 bits
    capabilities: smp cp15_barrier setend swp tagged_addr_disabled
  *-core
       description: Motherboard
       physical id: 0
     *-cpu:0
          description: CPU
          product: cpu
          physical id: 0
          bus info: cpu@0
          size: 600MHz
          capacity: 1512MHz
          capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid cpufreq
     *-cpu:1
          description: CPU
          product: cpu
          physical id: 1
          bus info: cpu@1
          size: 600MHz
          capacity: 1512MHz
          capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid cpufreq
     *-cpu:2
          description: CPU
          product: cpu
          physical id: 2
          bus info: cpu@2
          size: 600MHz
          capacity: 1512MHz
          capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid cpufreq
     *-cpu:3
          description: CPU
          product: cpu
          physical id: 3
          bus info: cpu@3
          size: 600MHz
          capacity: 1512MHz
          capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid cpufreq
     *-cpu:4
          description: CPU
          product: cpu
          physical id: 4
          bus info: cpu@4
          size: 2016MHz
          capacity: 2016MHz
          capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid cpufreq
     *-cpu:5
          description: CPU
          product: cpu
          physical id: 5
          bus info: cpu@5
          size: 2016MHz
          capacity: 2016MHz
          capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid cpufreq
     *-cpu:6 DISABLED
          description: CPU
          product: cpu-map
          physical id: 6
          bus info: cpu@6
     *-cpu:7 DISABLED
          description: CPU
          product: idle-states
          physical id: 7
          bus info: cpu@7
     *-memory
          description: System memory
          physical id: 8
          size: 3868MiB
  *-usbhost:0
       product: EHCI Host Controller
       vendor: Linux 5.4.20-rockchip64 ehci_hcd
       physical id: 1
       bus info: usb@1
       logical name: usb1
       version: 5.04
       capabilities: usb-2.00
       configuration: driver=hub slots=1 speed=480Mbit/s
  *-usbhost:1
       product: EHCI Host Controller
       vendor: Linux 5.4.20-rockchip64 ehci_hcd
       physical id: 2
       bus info: usb@2
       logical name: usb2
       version: 5.04
       capabilities: usb-2.00
       configuration: driver=hub slots=1 speed=480Mbit/s
  *-usbhost:2
       product: Generic Platform OHCI controller
       vendor: Linux 5.4.20-rockchip64 ohci_hcd
       physical id: 3
       bus info: usb@3
       logical name: usb3
       version: 5.04
       capabilities: usb-1.10
       configuration: driver=hub slots=1 speed=12Mbit/s
  *-usbhost:3
       product: Generic Platform OHCI controller
       vendor: Linux 5.4.20-rockchip64 ohci_hcd
       physical id: 4
       bus info: usb@4
       logical name: usb4
       version: 5.04
       capabilities: usb-1.10
       configuration: driver=hub slots=1 speed=12Mbit/s
  *-usbhost:4
       product: xHCI Host Controller
       vendor: Linux 5.4.20-rockchip64 xhci-hcd
       physical id: 5
       bus info: usb@5
       logical name: usb5
       version: 5.04
       capabilities: usb-2.00
       configuration: driver=hub slots=1 speed=480Mbit/s
  *-usbhost:5
       product: xHCI Host Controller
       vendor: Linux 5.4.20-rockchip64 xhci-hcd
       physical id: 6
       bus info: usb@6
       logical name: usb6
       version: 5.04
       capabilities: usb-3.00
       configuration: driver=hub slots=1 speed=5000Mbit/s
  *-usbhost:6
       product: xHCI Host Controller
       vendor: Linux 5.4.20-rockchip64 xhci-hcd
       physical id: 7
       bus info: usb@7
       logical name: usb7
       version: 5.04
       capabilities: usb-2.00
       configuration: driver=hub slots=1 speed=480Mbit/s
     *-usb
          description: USB hub
          product: USB2.0 Hub
          vendor: VIA Labs, Inc.
          physical id: 1
          bus info: usb@7:1
          version: 0.50
          capabilities: usb-2.10
          configuration: driver=hub slots=4 speed=480Mbit/s
  *-usbhost:7
       product: xHCI Host Controller
       vendor: Linux 5.4.20-rockchip64 xhci-hcd
       physical id: 8
       bus info: usb@8
       logical name: usb8
       version: 5.04
       capabilities: usb-3.00
       configuration: driver=hub slots=1 speed=5000Mbit/s
     *-usb
          description: USB hub
          product: USB3.0 Hub
          vendor: VIA Labs, Inc.
          physical id: 1
          bus info: usb@8:1
          version: 0.50
          capabilities: usb-3.10
          configuration: driver=hub slots=4 speed=5000Mbit/s
  *-network:0
       description: Ethernet interface
       physical id: 9
       logical name: eth0
       serial: 92:73:a3:xx:xx:xx
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt
 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=st_gmac driververs
ion=Jan_2016 duplex=full ip=192.168.1.106 link=yes multicast=yes port=MII speed=
1Gbit/s
  *-network:1
       description: Ethernet interface
       physical id: a
       logical name: wlan0
       serial: cc:4b:73:xx:xx:xx
       capabilities: ethernet physical
       configuration: broadcast=yes driver=brcmfmac driverversion=7.35.17 firmwa
re=01-2ed3ee81 multicast=yes
  *-network:2 DISABLED
       description: Ethernet interface
       physical id: b
       logical name: dummy0
       serial: ee:41:85:bf:48:68
       capabilities: ethernet physical
       configuration: broadcast=yes driver=dummy driverversion=1.0

スポンサーリンク


comments powered by Disqus