Raspberry Pi4 に Ubuntu Server と Ubuntu desktop を入れた.
Env
- Raspberry Pi4
- 4GB model B
- Ubuntu Server
- 20.04 arm64 for raspi LTS (until April 2025.)
- Ubuntu desktop
- lubuntu
- debian like
- Mac OSX 10.15.4
- For flash OS image
- balenaEtcher
- version 1.5.81
- Flash OS images to SD cards & USB drives.
- microSD card
- FAT32形式に format
- 32GB (format の為, 容量は ~32GB)
- ※ SDHC 規格、 CLASS10 が好ましい
- ※ 64GB 以上は FAT32 形式の format 方法が異なる
Procedure
各種 Download
- https://ubuntu.com/download/raspberry-pi から
Raspberry Pi 4 Download 64-bit
を選択し download。 - balenaEtcher.app の download, install
microSD card の format
Format trial and error.1 (Unresolved)
eraseDisk
で format を試みたが Error: -69877: Couldn't open device
な error が発生.
# Check disk `IDENTIFIER` $ diskutil list $ diskutil list disk2 /dev/disk2 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *32.2 GB disk2 1: <your_format> <device_name> 32.2 GB disk2s1 # Unmount micro SD card disk $ diskutil unMountDisk /dev/disk2 $ sudo diskutil eraseDisk FAT32 "MICROSD" MBRFormat /dev/disk2 # If the following error occurs, please change the microSD card. # - Error: -69877: Couldn't open device
Format trial and error.2 (Unresolved)
Disk Utility > SD Card > Erase
で MS-DOS (FAT)
を選択する.
Couldn’t modify partition map. : (-69874)
, Cannot format write protected card.
(protect mode にしていないにも関わらず) がエラー出力され format 出来ず.
Format trial and error.3 (Unresolved)
# Check disk `IDENTIFIER` $ diskutil list # Unmount micro SD card disk $ diskutil unmountDisk disk2 $ sudo newfs_msdos -F 32 -c 8 disk2s1 512 bytes per physical sector newfs_msdos: 65404 clusters too few clusters for FAT32, need 65525 $ sudo newfs_msdos -F 32 -S 4096 -s 1 /dev/disk2 newfs_msdos: warning: /dev/disk2 is not a character device 512 bytes per physical sector
newfs_msdos
で disk を操作して (今回は FAT) partition を作成しようと試みたが, error に.- sector size は 4096.
- FAT32 file system には最小 size があり, 少なくとも65525の cluster が含まれなければならない.
- cluster size は sector size の倍.
-c 8
で cluster 辺りの sector 数に default の8の倍数を使用.-s 1
で cluster ごとに 1 sector を指定するようにしている.
Format trial and error.4 (Resolved)
eraseDisk
ではなく eraseVolume
で FAT32 を使用する.
# Check disk `IDENTIFIER` $ diskutil list # Unmount micro SD card disk $ diskutil unmountDisk disk2 # Erase volume with FAT32 $ diskutil eraseVolume FAT32 WIN8 /dev/disk2s1 Started erase on disk2s1 Unmounting disk Erasing 512 bytes per physical sector /dev/rdisk2s1: 516190 sectors in 516190 FAT32 clusters (512 bytes/cluster) bps=512 spc=1 res=32 nft=2 mid=0xf8 spt=32 hds=54 hid=2048 drv=0x80 bsec=524288 bspf=4033 rdcl=2 infs=1 bkbs=6 Mounting disk Finished erase on disk2s1 WIN8 $ diskutil partitionDisk disk2 1 MBR FAT32 MICROSD R Started partitioning on disk2 Unmounting disk Creating the partition map Waiting for partitions to activate Formatting disk2s1 as MS-DOS (FAT32) with name MICROSD 512 bytes per physical sector /dev/rdisk2s1: 60599360 sectors in 1893730 FAT32 clusters (16384 bytes/cluster) bps=512 spc=32 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=8192 drv=0x80 bsec=60628992 bspf=14795 rdcl=2 infs=1 bkbs=6 Mounting disk Finished partitioning on disk2 /dev/disk2 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *31.0 GB disk2 1: DOS_FAT_32 MICROSD 31.0 GB disk2s1
Flash microSD card
- balenaEtcher を利用して image を microSD card に flash する.
- 若しくは Ubuntu 公式サイトに記載されているように microSD card に flash する.
- micro SD card を Raspberry Pi4 へ挿入し, Raspberry Pi を起動する.
Wi-Fi network に接続する
有線 LAN に接続する.
Package の install, update
https://wiki.ubuntu.com/ARM/RaspberryPi の通りに install する.
$ sudo apt-get install net-tools $ sudo apt-get install linux-firmware-raspi2 $ sudo apt-get install linux-image-raspi2 $ sudo apt-get install u-boot-rpi $ sudo apt-get install flash-kernel $ sudo apt-get update $ sudo apt-get upgrade
※ 次の repository を追加すると参照出来なくなった為, repository を remove した.
$ sudo add-apt-repository ppa:ubuntu-raspi2/ppa E: The repository 'http://ppa.launchpad.net/ubuntu-raspi2/ppa/ubuntu eoan Release' does not have a Release file.
軽量版 desktop の install
- xubuntu, lubuntu, kubuntu 各種違いはこの辺りを参考にした.
- lubuntu を install した.
- install は数時間掛かる.
$ sudo apt-get install lubuntu-desktop $ reboot
Trouble shooting
lubuntu (debian) において有線 LAN 接続しても wired unmanaged.
となり LAN を認識しない
default の debian は有線 LAN が無効になっているらしいので, ifup で有線LANを有効化する.
# bring a network interface up. $ sudo ifup eth0 Command ‘ifup’ not found, but can be installed with: sudo apt install ifupdown # version 0.8.35ubuntul, or sudo apt install netscript-2.4 # version 5.5.3 $ sudo apt install ifupdown $ sudo apt install netscript-2.4 $ sudo ifup eth0
/etc/NetworkManager/NetworkManager.conf
の managed
option を以下の通り変更し # systemctl restart network-manager
を実施して network-manager を再起動する。
[main] plugins=ifupdown,keyfile [ifupdown] managed=false #change to true.
/etc/netplan/50-cloud-init.yaml
を backup し, 次の通り変更し適用する.
network+
renderer: NetworkManager # added
ethernets:
eth0:
dhcp4: true
optional: true
version: 2
$ sudo netplan apply
Ubuntu 18.04 辺りから Netplan と呼ばれる新しい network management が導入され, networkd
, NetworkManager
の両 network daemon を切り替えられるようになった. default では networkd は Ubuntu server 用に構成され NetworkManager は Ubuntu desktop 用に構成される為, Ubuntu server に desktop を install している場合は networkd daemon を使用している為 desktop は network 構成を変更出来なかったと思われる.