- Saved searches
- Use saved searches to filter your results more quickly
- passard/ArchLinux-ARM-Raspberry-Pi
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- larsch / install-arch-linux-rpi-zero-w.sh
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Setup a Raspberry Pi (1, 2, 3 and 4, model B and B+) with Arch Linux, from scratch.
passard/ArchLinux-ARM-Raspberry-Pi
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
ArchLinuxARM installation on Raspberry Pi (from an Arch Linux)
Setup a Raspberry Pi with Arch Linux, from scratch — Support RPI 1, 2, 3, 3B+, 4, 4B, Zero 2 W
All steps described below should be done in a terminal (command line interface), either from Mac OS or your favorite Linux distribution.
1) Micro SD Card Partition Table and File System Creation
Open a terminal and type ‘df -h’ to identify your micro SD card.
Replace sdX in the following instructions with the device identifier for the micro SD card as it appears on your computer (eg. sda, sdb, sdc, sdd. ).
Start fdisk (as root or with sudo) to start partitioning :
At the fdisk prompt, delete old partitions (if there is any) and create a new one:
Type ‘o’. This will clear out any partitions on the drive.
Type ‘p’ to list partitions. There should be no partitions left.
Type ‘n’, then ‘p’ for primary, ‘1’ (Default) for the first partition on the drive, press ENTER to accept the default first sector, then type ‘+100M’ for the last sector.
Type ‘t’, press ENTER, then type ‘c’ to set the first partition as W95 FAT32 (LBA). Changed type of partition ‘Linux’ to ‘W95 FAT32 (LBA)’. Type ‘a’, default partition number should be ‘1’, press ENTER to toggle bootable flag on boot partition. The bootable flag on partition 1 is enabled now.
Type ‘n’, then ‘p’ for primary, ‘2’ (Default) should be the next partition on the drive, press ENTER to accept the default first sector, then ‘+49G’ (eg: this will create a 49gb partition) for root partition size.
Type ‘n’ : then ‘p’ for primary, ‘3’ (Default) should be the next partition on the drive, press ENTER to accept default first sector, then ENTER again for default last sector (it will take all the available space left).
Type ‘t’, default partition number should be ‘3’, press ENTER, then ’82’ to set the second logical partition to type Linux Swap.
Type ‘p’ to check how partition table is looking, if everything looks good, write the partition table and exit by typing ‘w’.
Creating file system operations (must be done as a root user)
1.5 Create and mount the FAT file system (-n is for FAT label option):
mkfs.vfat /dev/sdX1 -n boot mkdir /mnt/boot mount /dev/sdX1 /mnt/boot
1.6 Create and mount the extfile system (-L is for label option):
mkfs.ext4 /dev/sdX2 -L root mkdir /mnt/root mount /dev/sdX2 /mnt/root
1.7 Create and mount Swap file system (-L is for label option):
mkswap /dev/sdX3 -L swap swapon /dev/sdX3
1.8 Download with ‘wget’ and extract the appropriate root filesystem :
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz
To extract, run as root (not via sudo):
bsdtar -xpf ArchLinuxARM-rpi*.tar.gz -C /mnt/root && sync
Move boot files to the first partition (still as root):
1.9 Unmount the two partitions:
2 Installation from the Pi
Insert the SD card into the Raspberry Pi, connect ethernet and power supply (at least 2.5A power for rpi3, 2A for rpi2).
Use the serial console or SSH to the IP address given to the board by your router.
If you don’t know your IP yet, you can use ‘arp -a’ or ‘netstat -r’ commands to retrieve devices connected to your network.
Login as the default user alarm with the password alarm. The default root password is root.
2.1 Update the system with pacman
First update PGP signatures
pacman-key --init && pacman-key --populate archlinuxarm
then type ‘pacman -Syyu’
2.2 Install desktop UI (I use xfce4) and basic tools (I use slim as greeter, despite being discontinued, it is easy and fast to set up)
pacman -S xfce4 xfce4-goodies sudo xorg alsa-utils slim wget bluez bluez-utils blueman baobab wireless_tools mlocate binutils synapse firefox p7zip xarchiver networkmanager ffmpeg tinc
Optionnally, add some developer tools:
pacman -S base-devel openssh python2 qt5 pygtk mono libva-mesa-driver python2-dbus gvfs python-setuptools python-pip pcmanfm --needed
2.3 Create a new user and enable sudo rights if necessary. Replace ‘username’ by a name of your choice.
useradd -m -g users -G storage,power,wheel -s /bin/bash "username" nano /etc/sudoers and uncomment _%wheel_ line by removing the "#" sign passwd "username" to define a password and su "username" to login as newly created user
Type ‘starxfce4’ then save (ctrl+o) and exit (ctrl+x)
2.5 Edit slim.conf (as root or with sudo)
Type ‘sudo nano /etc/slim.conf’ then uncomment default_user line and replace simone with your default username If you want the session to start automatically, uncomment autologin line and replace no by ‘yes’.
3 Raspberry Pi configuration and tweaks
Reboot and login with username credentials (if you did not chose autologin)
If xfce4 desktop does not start after a first reboot, type ‘startxfce4’ to start it manually.
Edit /boot/config.txt according to current display. I use the following for HD (1080px). More info on raspberrypi.org
As root or with sudo, type ‘sudo nano /boot/config.txt’
Then uncomment following lines to force a specific HDMI mode (for example, this will force VGA) hdmi_group=2 hdmi_mode=82
Uncomment to force a HDMI mode rather than DVI. This can make audio work in some cases.
Avoid warnings at boot for lower power supply (only if you understand the risks):
To avoid even more warnings and allow turbo when low-voltage is present.
We will use systemd network control (netctl). All commands must be run as root or with sudo.
Create a network profile; /etc/netctl/examples/ contains some examples.
To setup a WPA2-PSK network, copy over the example file and start editing:
# cd /etc/netctl /etc/netctl# install -m640 examples/wireless-wpa wireless-home /etc/netctl# cat wireless-home Description='A simple WPA encrypted wireless connection' Interface=wlan0 Connection=wireless Security=wpa IP=dhcp ESSID='MyNetwork' # Prepend hexadecimal keys with \" # If your key starts with ", write it as '"""' # See also: the section on special quoting rules in netctl.profile(5) Key='WirelessKey' # Uncomment this if your ssid is hidden #Hidden=yes
Edit MyNetwork and WirelessKey as needed. Note the 640 permissions, you do not want to leak your wireless passphrase to the world!
Proceed with testing: netctl start wireless-home
If you do not get an error, you should be connected. Let’s network by pinging goggle DNS $ ping 8.8.8.8
To make this network start on boot: # netctl enable wireless-home
Then reload systemd # systemctl daemon-reload
Raspberryi 3 Broadcom embed chip
Skip this part if you are running on an older version of the Raspberry Pi
Further setup is require on rpi3. First, configure access to AUR packages I used yaourt, pacaur or apacman in the past, feel free to chose your favorite, their setup is quite similar.
Now I will use yay as an AUR helper: git clone https://aur.archlinux.org/yay.git && mv yay .yay && cd .yay && makepkg -si
You can now use yay to install packages! So let’s install pi-bluetooth and hciattach-rpi3: yay -S pi-bluetooth hciattach-rpi3
Then enable and start bcrm43438: sudo systemctl enable brcm43438 sudo systemctl start brcm43438
Then enable and start bluetooth: sudo systemctl enable bluetooth sudo systemctl start bluetooth
Download ad install bluetooth utilities
install bluez, bluez-utils by pacman -Sy bluez
You must be root or using sudo for this. Load generic drivers: ‘modprobe btusb’ Enable service: ‘systemctl enable bluetooth’ Start service: ‘systemctl start bluetooth’
4.1 Configure bluetooth device(s):
Tip: To automate bluetoothctl commands, use echo -e «\n\n» | bluetoothctl
bluetoothctl [bluetooth]# list Controller BlueZ 5.5 [default] [bluetooth]# select [bluetooth]# power on [bluetooth]# scan on [bluetooth]# agent on [bluetooth]# devices [bluetooth]# pairable on Device Name: Bluetooth Mouse [bluetooth]# pair [bluetooth]# trust [bluetooth]# connect
[bluetooth]# agent KeyboardOnly [bluetooth]# default-agent [bluetooth]# pairable on [bluetooth]# scan on [bluetooth]# pair ?keyboard mac? [bluetooth]# trust ?keyboard mac? [bluetooth]# connect ?keyboard mac? [bluetooth]# quit
Enable bluetooth at startup
Create new udev rule: nano /etc/udev/rules.d/10-local.rules # Set bluetooth power up ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"
About
Setup a Raspberry Pi (1, 2, 3 and 4, model B and B+) with Arch Linux, from scratch.
larsch / install-arch-linux-rpi-zero-w.sh
Install Arch Linux ARM for Raspberry Pi Zero W on SD Card (with commands to configure WiFi before first boot).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
#! /bin/sh -exu |
dev= $1 |
cd $( mktemp -d ) |
function umountboot |
umount boot || true |
umount root || true |
> |
# RPi1/Zero (armv6h): |
archlinux=/tmp/ArchLinuxARM-rpi-latest.tar.gz |
url=http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz |
# RPi2 (armv7h): |
# archlinux=/tmp/ArchLinuxARM-rpi-2-latest.tar.gz |
# url=http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz |
curl -L -o $archlinux -z $archlinux $url |
parted -s $dev mklabel msdos |
parted -s $dev mkpart primary fat32 1 128 |
parted -s $dev mkpart primary ext4 128 — -1 |
mkfs.vfat $ 1 |
mkfs.ext4 -F $ 2 |
mkdir -p boot |
mount $ 1 boot |
trap umountboot EXIT |
mkdir -p root |
mount $ 2 root |
bsdtar -xpf $archlinux -C root |
sync |
mv root/boot/ * boot |
# Commands to configure WiFi before first boot (netctl-auto) |
# — you need to temp edit root/etc/pacman.d to point to /path/to/root/etc/pacman.d/mirrorlist |
# — change it back after installing |
# pacman -r root —arch armv6h —config root/etc/pacman.conf —cachedir root/var/cache/pacman/pkg —dbpath root/var/lib/pacman -Sy |
# pacman -r root —arch armv6h —config root/etc/pacman.conf —cachedir root/var/cache/pacman/pkg —dbpath root/var/lib/pacman -S wpa_actiond |
# ln -sf /usr/lib/systemd/system/netctl-auto@.service root/etc/systemd/system/netctl-auto@wlan0.service |
# cat >root/etc/netctl/wlan0-SSID |
# Description=’WiFi — SSID’ |
# Interface=wlan0 |
# Connection=wireless |
# Security=none |
# ESSID=enter-ssid-here |
# IP=dhcp |
# EOF |