blob: 20ca0d8ee2ae81ea89460e623ee6f9adbc2c7fd5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
---
categories:
- embedded
date: 2016-01-30
title: Installing Arch Linux ARM on a Raspberry Pi
---
My cheat sheet for deploying multiple Arch Linux machines, Raspberry Pis here.
Installs `pacserve`, `rngd` and `yaourt` in a btrfs subvolume `root`. To allow local users to poweroff, `polkit` is also installed.
# Filesystem setup
See also the [Archlinux ARM guide](http://archlinuxarm.org/platforms/armv6/raspberry-pi).
Change `sdx` to `sdb`/`sdc`/…
``` bash
sudo fdisk /dev/sdx
sudo mkfs.btrfs /dev/sdx2
sudo mkfs.vfat /dev/sdx1
mkdir -p tmp/{r,b}oot
cd tmp
sudo mount /dev/sdx2 root
sudo btrfs subvolume create root/root
sudo umount root
```
# Copying the files
Use `ArchLinuxARM-rpi-2-latest.tar.gz` for the Raspberry Pi 2 or 3.
``` bash
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
sudo mount /dev/sdx1 boot
sudo mount -o subvol=root,autodefrag,compress=lzo /dev/sdx2 root
sudo su -c "bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root" && sync
sudo mv root/boot/* boot
sudo umount boot
sudo mount /dev/sdx1 root/boot
```
# QEMU chroot
[Optional](https://wiki.archlinux.org/index.php/Raspberry_Pi#QEMU_chroot). You can skip this and power the Pi up instead.
``` bash
sudo cp /usr/bin/qemu-arm-static root/usr/bin
sudo arch-chroot root /bin/bash
```
# Configuration
``` bash
echo "root=/dev/mmcblk0p2 rootflags=subvol=root,autodefrag,compress=lzo rw rootwait console=tty1 elevator=deadline" > /boot/cmdline.txt
sed -i "s/gpu_mem=64/gpu_mem=16/" /boot/config.txt
cat << EOF >> /boot/config.txt
start_file=start_x.elf
fixup_file=fixup_x.dat
start_x=1
EOF
sed -i '/\[options\]/a CacheDir = /var/cache/pacman/pkg/' /etc/pacman.conf
sed -i '/\[options\]/a CleanMethod = KeepCurrent' /etc/pacman.conf
cat << EOF >> /etc/pacman.conf
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/arm
[xyne-any]
Server = http://xyne.archlinux.ca/repos/xyne
EOF
```
# Package installation
``` bash
pacman -Syu --needed pacserve git yajl rng-tools polkit archlinuxarm-keyring archlinux-keyring base-devel
systemctl enable pacserve rngd
echo 'RNGD_OPTS="-o /dev/random -r /dev/hwrng"' > /etc/conf.d/rngd
echo "alarm ALL=(ALL) ALL" >> /etc/sudoers
pacman.conf-insert_pacserve > /tmp/pacman.conf
mv /tmp/pacman.conf /etc/pacman.conf
su alarm
cd
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -s
mv package-query*.tar.xz /tmp
cd ..
rm -rf package-query
exit
pacman -U /tmp/package-query*.tar.xz
pacman -S yaourt
exit
```
`sudo umount root/boot root` or `reboot`
# Post installation (on the Pi)
SSH into alarm with password alarm. root password is root, but SSH login for root is by default disabled.
``` bash
sudo hostnamectl set-hostname xxx
sudo timedatectl set-timezone Yourtime/zone
sudo vi /etc/systemd/timesyncd.conf
sudo timedatectl set-ntp true
sudo pacman-key --init
passwd
sudo passwd
```
# Troubleshooting
Can't unmount for some reason? Use the hammer (not recommended): `sudo fuser -km mntpoint || sudo umount -l mntpoint`
# Further information
For more, see [the Arch wiki](https://wiki.archlinux.org/index.php/Raspberry_Pi).
|