Install Arch-Linux on a Raspberry Pi

Arch Linux is a very clean and lightweight Linux distribution. With the following steps you can install it on a SD-Card to run it on a Raspberry Pi:

  1. Get the device name (dev-path) of the SD-Card to run the operating system (see Get a list of partitions or List, partitioning and format drives)
    $> sudo fdisk -l

    You should see some partitions named /dev/mmcblk0pX. X is a Number. Then the device to format is mmcblk0.

  2. Format the SD-Card:
    1. Unmount all partitions currently mounted
      $> sudo umount /dev/mmcblk0p1
      $> sudo umount /dev/mmcblk0p2
    2. $> sudo fdisk /dev/mmcblk0 # run fdisk to create partitions
    3. That opens a commandline tool that accepts further commands to manage the device partitions.
      Here is the command order, that creates two partitions on the device (boot- and root-partition) :

      • p -> shows all existing partitions
      • o -> deletes all existing partition on the SD-Card (you can check it with p afterwards)
      • n -> to create a new partition:
        • p -> to create a primary partition
        • 1 -> to set the partition number to 1
        • press enter to confirm the default value for the first sector
        • enter +100M for the second prompt. Its the last sector value. So the first partition will be 100M in size.
        • set the type of the partition to W95 FAT32 (LBA) with t followed by c (To get a List of all supporter partition types you can use the l command.)
      • n -> to create a second partition
        • p -> to create a primary partition again
        • 2 -> to set the partition number to 2
        • two times enter to accept the default values for first and last sector -> the second partition will use all the remaining space on the drive.
        • we don’t set a type -> so the default type is 83 (Linux)
      • w -> will write the newly created partition information to the partition table of the device
  3. Format partitions and mount them to local folders:
    1. change to media directory of your user:
      $> cd /media/YOURUSERNAME

      That isn’t really necessary but I prefer to have mounted folders all together there. (on Ubuntu)

    2. create mountpoints:
      $> sudo mkdir root
      $> sudo mkdir boot
    3. format partitions:
      $> sudo mkfs.vfat /dev/mmcblk0p1 # make partition 1 (boot) a FAT32 filesystem 
      $> sudo mkfs.ext4 /dev/mmcblk0p2 # make partition 2 (root) a ext4 filesystem
    4. mount the partitions to previously created mountpoints
      $> sudo mount /dev/mmcblk0p1 boot
      $> sudo mount /dev/mmcblk0p2 root
  4. Download Arch Linux and extract contents for root and boot filesystems:
    1. switch to root account (IMPORTANT!!! sudo is not enough):
      $> sudo su -
    2. Go to media mount folder again:
      $> cd /media/YOURUSERNAME
    3. Download Arch Linux archive:
      $> wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz # Raspberry Pi v. 1
      $> wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz # Raspberry Pi v. 2
    4. Extract contents to root partition:
      $> tar xvfz ArchLinuxARM-rpi-latest.tar.gz -C root
    5. Copy boot filesystem to boot partition:
      $> mv root/boot/* boot
  5. Unmout partitions:
    $> umount /dev/mmcblk0p1
    $> umount /dev/mmcblk0p2
  6. Now you could remove the SD-Card and put it into your Raspberry Pi. That’s it! You’ll have a lot of fun with Arch! The default credentials are root for the user and root as password.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.