Project

General

Profile

Support #682

Installing Arch Linux on a Raspberry Pi 2

Added by Daniel Curtis about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Operating Systems
Target version:
Start date:
10/22/2015
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:

Description

The following instructions use /dev/mmcblk0 as the micro SD card that Arch will be installed on. Replace it according to your device path.

NOTE: This setup guide includes a swap partition; if you do not want to use swap space skip over the steps and make sure to set root=/dev/mmcblk0p2 in the /boot/config.txt at the end of the guide.

  • Start fdisk to partition the SD card:
    sudo fdisk /dev/mmcblk0
    
  • At the fdisk prompt, delete old partitions 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 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
    • Type t, then c to set the first partition to type W95 FAT32 (LBA).
    • Type n, then p for primary, 2 for the second partition on the drive, and then ENTER to accept the default first sector, then type +1024M for the last sector.
    • Type n, then p for primary, 3 for the third partition on the drive, and then press ENTER twice to accept the default first and last sector.
    • Write the partition table and exit by typing w.
  • Create and mount the boot partition on the first partition:
    sudo mkfs.vfat /dev/mmcblk0p1
    sudo mkdir /mnt/boot
    sudo mount /dev/mmcblk0p1 /mnt/boot
    
  • Create the swap space on the second partition:
    sudo mkswap /dev/mmcblk0p2
    
  • Create and mount the root filesystem on the third partition:
    sudo mkfs.ext4 /dev/mmcblk0p3
    sudo mkdir /mnt/root
    sudo mount /dev/mmcblk0p3 /mnt/root
    
  • Download and extract the root filesystem (as root, not via sudo):
    wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
    sudo bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C /mnt/root
    sudo sync
    
  • Move boot files to the first partition:
    sudo mv /mnt/root/boot/* /mnt/boot
    
  • Edit the cmdline.txt file:
    sudo vi /mnt/boot/cmdline.txt
    
    • And change the default root location to the third partition:
      root=/dev/mmcblk0p3 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop
      
  • Unmount the two partitions:
    sudo umount /mnt/boot /mnt/root
    

Now insert the SD card into the Raspberry Pi 2, connect ethernet, and apply 5V power. Use the serial console or SSH to the IP address given to the board by your router.

NOTE: The default user alarm with the password alarm.
NOTE: The default root password is root.

Activating the Swap space

  • To activate the swap after logging into the Pi 2 as root, edit /etc/fstab and add the following:
    sudo -s
    echo '/dev/mmcblk0p2 none    swap    defaults 0 0' >> /etc/fstab
    exit
    
  • Now reboot the Raspberry Pi 2 or run the following to activate the swap:
    sudo swapon -a
    

Resources

Also available in: Atom PDF