Raspberry Pi 4BにArch Linux (64it)をインストールしてみました。

https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4

環境

  • Raspberry Pi 4B
  • 32GB SDカード
    • Arch Linux

構築

作業PC

  1. gpartedでSDカードのパーティションを削除しておく
  2. rootで作業する
su
  1. Start fdisk to partition the SD card:
fdisk /dev/sdX

私の環境では/dev/sdaでした

  1. At the fdisk prompt, delete old partitions and create a new one:
    入力 内容

o|This will clear out any partitions on the drive
p|list partitions. There should be no partitions left
n
p
1
ENTER
+400M|the first partition on the drive
t
c|set the first partition to type W95 FAT32 (LBA).
n
p
2
ENTER
ENTER|the second partition on the drive
w|Write the partition table and exit

  1. Create and mount the FAT filesystem:
mkfs.vfat /dev/sdX1
mkdir boot
mount /dev/sdX1 boot
  1. Create and mount the ext4 filesystem:
mkfs.ext4 /dev/sdX2
mkdir root
mount /dev/sdX2 root
  1. Download and extract the root filesystem (as root, not via sudo):
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root
sync
  1. Move boot files to the first partition:
mv root/boot/* boot
  1. Edit fstab
root/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
#/dev/mmcblk0p1 /boot vfat defaults 0 0
/dev/mmcblk1p1 /boot vfat defaults 0 0
/dev/mmcblk1p2 / ext4 defaults 0 0
  1. Unmount the two partitions:
umount boot root

Raspberry Pi (1)

  1. Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
  2. Use the serial console or SSH to the IP address given to the board by your router.
  • Login as the default user alarm with the password alarm.
  • The default root password is root.
  1. rootで作業する
su
  1. Initialize the pacman keyring and populate the Arch Linux ARM package signing keys:
pacman-key --init
pacman-key --populate archlinuxarm
  1. ミラーの設定
/etc/pacman.d/mirrorlist
### Japan
## Tokyo
# Server = http://jp.mirror.archlinuxarm.org/$arch/$repo
Server = http://jp.mirror.archlinuxarm.org/$arch/$repo
  1. パッケージの更新
pacman -Syu
  1. base-develのインストール
pacman -S base-devel
reboot

Raspberry Pi (2)

  1. gnomeのインストール
pacman -S gnome
  1. GDMのインストールと有効化
pacman -S gdm
systemctl enable gdm
  1. タイムゾーンの設定
curl https://ipapi.co/timezone
timedatectl set-timezone "Asia/Tokyo"
  1. ロケールの設定
locale-gen
localectl set-locale LANG="en_US.UTF-8"
  1. 再起動
reboot

利用

  • ChromiumはFlatpak版が動作する
  • alarmのユーザ名を変更(ユーザIDはそのまま)
    GDMの画面で、
    Ctrl+Alt+F4
    rootでログイン
    usermod -l arch alarm
    groupmod -n arch alarm
    usermod -d /home/arch -m arch
    exit
    Ctrl+Alt+F1
  • visudo
  • openssh
    sudo pacman -S openssh
  • ホスト名の変更
    hostnamectl set-hostname rpi4b
  • Bluetoothの有効化
    sudo pacman -S bluez bluez-utils gnome-bluetooth-3.0
    sudo systemctl enable bluetooth
    sudo systemctl start bluetooth
  • その他設定
    https://ktkr3d.github.io/archlinux/
    https://ktkr3d.github.io/GNOME/

TODO

  • Wifi
  • pritunl/wireguard
  • rdp
    sudo pacman -S gnome-remote-desktop freerdp inetutils
    RDP_USER="${USER}"
    RDP_PASS="12345678"
    sudo -u gnome-remote-desktop sh -c 'mkdir -p ~/.local/share/gnome-remote-desktop/'
    sudo -u gnome-remote-desktop sh -c "openssl req -new -newkey rsa:4096 -days 720 -nodes -x509 -subj /C=SE/ST=NONE/L=NONE/O=GNOME/CN=$(hostname) -out ~/.local/share/gnome-remote-desktop/tls.crt -keyout ~/.local/share/gnome-remote-desktop/tls.key"
    sudo grdctl --system rdp set-tls-key ~gnome-remote-desktop/.local/share/gnome-remote-desktop/tls.key
    sudo grdctl --system rdp set-tls-cert ~gnome-remote-desktop/.local/share/gnome-remote-desktop/tls.crt
    sudo grdctl --system rdp set-credentials "${RDP_USER}" "${RDP_PASS}"
    sudo grdctl --system rdp enable
    接続しても画面が真っ黒・・・
  • networkmanager
    sudo pacman -S networkmanager