-
Notifications
You must be signed in to change notification settings - Fork 3
arch linux install
This assumes you are creating an installed Arch OS on a microSD card for use in a RaspberryPi 2 or 3 from a PC running Lubuntu or other Ubuntu derivative, or Raspbian (rather than from Arch)
You should choose which OS image to download. As of Summer 2018, AArch64 almost fully supports all built-in Pi 3 hardware, including the wifi.
IMAGE_FILENAME=ArchLinuxARM-rpi-3-latest.tar.gz
However if you use any additional hardware which require overlays, such as DACs, then you might be better sticking to the ARMv7 install.
IMAGE_FILENAME=ArchLinuxARM-rpi-2-latest.tar.gz
see also:
- example build of mpd/snapcast on alarm
- [https://github.com/artmg/MuGammaPi/wiki/multi-room-audio#arch-linux-arm]
- ALarm tweaks for Pi hardware
- [https://archlinuxarm.org/wiki/Raspberry_Pi]
- Arch tweaks for Pi hardware
- [https://wiki.archlinux.org/index.php/Raspberry_Pi]
- Pragmatic installation guide
- [http://elinux.org/ArchLinux_Install_Guide]
Credit:
- [http://elinux.org/ArchLinux_Install_Guide]
- main steps
- [https://github.com/artmg/MuGammaPi/wiki/Raspbian-basics]
- personalisation via variables
Browsing in pcmanfm in the folder containing the ISO image, press F4 for a terminal
NB: although the variables below include a new user name and password this is not yet implemented so to the alarm user and password need changing on first boot.
Note: this automation in the rest of this page is similar to that used in the pages below, so perhaps they could be merged at some point?
#### Set your variables
# Media Device as Drive (e.g. sdb) rather than partition (e.g. sdb1)
MEDIA_DEVICE=
MEDIA_LABEL=
IMAGE_FILENAME=
NEWHOSTNAME=
USER_NAME=
USER_GROUP=
USER_DESC=
USER_PWD=
ROOT_PWD=
WIFI_SSID=
WIFI_PSK=
#### Download
# If you don't yet have the image on your device
cd ~/Downloads
wget http://os.archlinuxarm.org/os/$IMAGE_FILENAME
#### Prepare
# enter your password for su
sudo echo
#### not used for now
## install mkpasswd
#sudo apt install -y whois
#### Partition
sudo fdisk /dev/$MEDIA_DEVICE
- 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 for the first partition on the drive
- press ENTER to accept the default first sector,
- OR should it be larger (e.g. 8192) for some flash media?
- then type +100M for the last sector.
- Y to remove vfat signature
- Type t, then c to set the first partition to type W95 FAT32 (LBA).
- type p,
- to check the end sector of that first partition
- Type n, then p for primary, 2 for the second partition on the drive,
- and then press ENTER twice to accept the default first and last sector.
- Type w, to Write the partition table and exit
# review partitions
sudo fdisk -l /dev/$MEDIA_DEVICE
# Create the filesystems
sudo mkfs.vfat /dev/${MEDIA_DEVICE}1
sudo mkfs.ext4 /dev/${MEDIA_DEVICE}2
# Setting name on both partitions so Ext4 shows up on booted Pi and FAT shows up when inserted on other system
# Prepare
SHORT_LABEL=${MEDIA_LABEL:0:8}
# detect unix release
. /etc/os-release
. /etc/*-release
case "${ID}" in
raspbian)
FAT_LABEL_SET="sudo dosfslabel /dev/${MEDIA_DEVICE}1 ${SHORT_LABEL^^}_OS"
FAT_LABEL_GET="sudo dosfslabel /dev/${MEDIA_DEVICE}1"
;;
ubuntu)
# udisks2 is probably installed by default
sudo apt install -y udisks2 mtools
# avoid the error "not a multiple of sectors"
echo mtools_skip_check=1 > ~/.mtoolsrc
FAT_LABEL_SET="sudo mlabel -i /dev/${MEDIA_DEVICE}1 ::${SHORT_LABEL^^}_OS"
FAT_LABEL_GET="sudo mlabel -i /dev/${MEDIA_DEVICE}1 -s ::"
esac
# Rename 1 FAT and 2 Ext4
${FAT_LABEL_SET}
sudo e2label /dev/${MEDIA_DEVICE}2 $MEDIA_LABEL\_disk
# display labels
${FAT_LABEL_GET}
sudo e2label /dev/${MEDIA_DEVICE}2
sudo mkdir -p /media/$USER/archboot
sudo mkdir -p /media/$USER/archroot
# maybe not needed now as we had to sudo the extract and move below
sudo chmod 777 /media/$USER/archboot
sudo chmod 777 /media/$USER/archroot
sudo mount /dev/${MEDIA_DEVICE}1 /media/$USER/archboot
sudo mount /dev/${MEDIA_DEVICE}2 /media/$USER/archroot
#### unpack the files from the image
# extract but avoid messages about Ignoring unknown extended header keyword from Mac-built tarballs
sudo tar xvzf $IMAGE_FILENAME -C /media/$USER/archroot --warning=no-unknown-keyword
# finish the writes
sync
# move the boot files to the fat partition
sudo mv /media/$USER/archroot/boot/* /media/$USER/archboot
# finish those writes
sync
#### configure the OS
# set the hostname
sudo sed -i "s/alarmpi/$NEWHOSTNAME/g" /media/$USER/archroot/etc/hostname
# on AArch64 default is just `alarm`
sudo sed -i "s/alarm/$NEWHOSTNAME/g" /media/$USER/archroot/etc/hostname
sudo sed -i "s/localhost/$NEWHOSTNAME/g" /media/$USER/archroot/etc/hosts
#### wifi
if [[ $WIFI_SSID ]] ; then
# AArch64 version
sudo tee -a /media/$USER/archroot/etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF!
ctrl_interface=/run/wpa_supplicant
update_config=1
network={
ssid="$WIFI_SSID"
psk="$WIFI_PSK"
}
EOF!
# ARMv7 version
sudo tee -a /media/$USER/archroot/etc/wpa_supplicant/wpa_supplicant.conf <<EOF!
network={
ssid="$WIFI_SSID"
psk="$WIFI_PSK"
}
EOF!
fi
# enable DHCP on all (including wireless)
# required on AArch64
# config wrapper and dhcp credit http://archpi.dabase.com/#wireless
sudo tee -a /media/$USER/archroot/etc/systemd/network/any.network <<EOF!
[Match]
Name=*
[Network]
DHCP=both
EOF!
# NEEDS TESTING: enable the service without chroot and systemctl enable
ln -s /media/$USER/archroot/usr/lib/systemd/system/[email protected] /etc/systemd/system/multi-user.target.wants/[email protected]
## The following instructions might be flakey if installing from Ubuntu
## It may be best to leave the password as default until you ssh in
## and make sure you set it there immediately
# best practice not to use root but create new user
# also set a strong root password
## credit https://wiki.archlinux.org/index.php/reset_root_password
#passwd --root /media/$USER/archroot root
#echo "root:${ROOT_PWD}" | sudo chpasswd --root /media/$USER/archroot --crypt-method SHA512
### or see the manual bash commands if you could not use --root
### https://gist.github.com/jriguera/f97925ca7534a75eedfa
PASS="$(mkpasswd --method=sha-512 '${ROOT_PWD}')"
sudo sed -i "s|^\(root\):\([^:]*\):\(.*\)\$|\1:${PASS}:\3|g" /media/$USER/archroot/etc/shadow
# also set default alarm user
PASS="$(mkpasswd --method=sha-512 '${USER_PWD}')"
sudo sed -i "s|^\(alarm\):\([^:]*\):\(.*\)\$|\1:${PASS}:\3|g" /media/$USER/archroot/etc/shadow
## add new user as sudoer in own group
#groupadd --root /media/$USER/archroot $USER_GROUP
#useradd --root /media/$USER/archroot $USER_NAME --gid $USER_GROUP --comment "${USER_DESC}" --create-home
#echo "$USER_NAME:${ROOT_PWD}" | chpasswd --root /media/$USER/archroot
## useradd --root /media/$USER/archroot $USER_NAME --gid $USER_GROUP --comment "${USER_DESC}" --create-home --password "$(mkpasswd --method=sha-512 '${USER_PWD}')"
# #### $USER_PWD
## according to /etc/login.defs in image default hash on arch is SHA512
## hope the --root takes this into consideration
## if not need to use chpasswd --crypt-method SHA512
# Unmount the two partitions:
sudo umount /media/$USER/archboot /media/$USER/archroot
# remove the mount points
sudo rmdir /media/$USER/archboot
sudo rmdir /media/$USER/archroot
In the armv7l release with linux kernel 4.9.36-1-ARCH (Fri 7 Jul 2017) you get 144 packages installed including the following notables:
- cryptsetup, dhcpcd, inetutils, iptables, openssh, perl
- sqlite, systemd (incl. systemd-timesyncd), wpa_supplicant
Most things you will want, however, you'll likely have to install yourself!
-
You might find these shortcuts useful:
-
install + configure
- check wifi
- http://archpi.dabase.com/#wireless
- [https://wiki.archlinux.org/index.php/WPA_supplicant#At_boot_.28systemd.29]
- initramfs ? [https://gist.github.com/rasschaert/0bb7ebc506e26daee585]
- check wifi
- if you don't get a response from wifi when you first power up
- plug into ethernet to complete the setup
# credit and help - http://archpi.dabase.com/#wireless
systemctl enable wpa_supplicant@wlan0
systemctl enable systemd-networkd
# ssh as user (default password alarm)
ssh alarm@myhostname
# set passwd if you haven't
passwd
# then su to root (default password root)
su
# set passwd if you haven't
passwd
# credit - https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3#installation
# Initialize the pacman keyring and
# populate the Arch Linux ARM package signing keys
pacman-key --init
pacman-key --populate archlinuxarm
# Update all packages
pacman -Syu
# Install sudo
pacman -S sudo --noconfirm
# add privilege for alarm via wheel group without password
# uncomment %wheel ALL=(ALL) NOPASSWD: ALL
# with x then :w save :x exit
visudo
# check
cat /etc/sudoers
### Locale / region
SET_LANG=en_GB.UTF-8
SET_ENC=UTF-8
SET_TIMECITY=Europe/London
echo "$SET_LANG $SET_ENC" > /etc/locale.gen
locale-gen
export LANG=$SET_LANG
echo "LANG=$SET_LANG" >> /etc/locale.conf
timedatectl set-timezone $SET_TIMECITY
#ln -s /usr/share/zoneinfo/$SET_TIMECITY /etc/localtime
# back to alarm
exit
Moved out to [https://github.com/artmg/lubuild/blob/master/help/configure/Networked-Services.md#nfs]
For an introduction or comparison see https://github.com/artmg/lubuild/blob/master/help/configure/Networked-Services.md#rsyslog-server
See the cower example below for instructions.
# credits - based on [https://wiki.archlinux.org/index.php/AUR#Installing_packages]
# [https://raspberrypi.stackexchange.com/a/511] from 2010 mentions additional packages and has git command
# [http://web.archive.org/web/20130809225135/http://archlinuxarm.org/developers/building-packages] says just base-devel
sudo pacman -Syu base-devel git
PACKAGE_NAME=package
git clone http://aur.archlinux.org/$PACKAGE_NAME.git
cd $PACKAGE_NAME
makepkg -Acs
# or if needed ... makepkg --asroot -Acs
sudo pacman -U --noconfirm $PACKAGE_NAME-*.pkg.tar.xz
- according to [https://github.com/archlinuxarm/PKGBUILDs] the ALArm repos include:
- cower
- packer
# Initialize the pacman keyring and
# populate the Arch Linux ARM package signing keys
sudo pacman-key --init
sudo pacman-key --populate archlinuxarm
sudo pacman -Syu cower
# 'recursing' the download tells cower to also download dependencies
cower -dd rsyslog -d rsyslog
# but you need to make them individually!
cd libestr && makepkg -Acs && cd ..
cd libfastjson && makepkg -Acs && cd ..
cd liblogging && makepkg -Acs && cd ..
cd librelp && makepkg -Acs && cd ..
# and finally make the main package
cd rsyslog && makepkg -Acs && cd ..