Installing Arch Linux from Scratch

Gary Schafer, 30 December 2018

This will be a walk-through for installing Arch Linux on an older Sony Vaio laptop. While Arch Linux has its own installation wiki, I found it a bit hard to follow. I decided to write down what I needed to do for my own system. This post is a fairly large wall 'o text. That's because I copied-&-pasted what I had already written down. This post didn't take that long to write.

My laptop has an Intel i3 processor, 4 GB of RAM, and a 500 GB hard disk drive. Because this is an older computer that does not support UEFI, this walk-through will only cover MBR and not GPT partitioning of the hard drive.

What you'll need if you want to follow along:

  • a working computer, either a desktop or a laptop. Note that this computer MUST be a 64-bit machine. Arch no longer supports 32-bit machines.
  • a CD, DVD or thumb drive with the Arch Linux live install loaded
  • either a wired Ethernet connection, or an available wireless access point to which the computer can connect (once we get to that point)

Here's the walk-through:

  1. Plug the CD or DVD into the CD/DVD tray, or plug the USB thumb drive into an available USB port. In my case, I used a PNY 8 GB USB thumb drive loaded with Arch Linux live installer.
  2. Boot up the system from the CD/DVD or thumb drive. NOTE: This might require having to go through your computer's "setup" to boot from the CD/DVD or USB device.
  3. When the Arch Linux splash screen comes up, select the top-most option ("Boot Arch Linux (x86_64)") and hit "Enter".
  4. Once the system finishes booting, you'll be presented with a command line prompt:

    root@archiso ~ #

  5. Partition the hard drive:
    1. root@archiso ~ # fdisk -l

      This will show the available hard drives and storage devices. In my case, there were two storage devices listed, "/dev/sda" (my laptop hard drive) and "dev/sdb" (the USB thumb drive).
    2. root@archiso ~ # fdisk /dev/sda

      This starts fdisk, with the target being the hard drive (/dev/sda). It also opens the fdisk command prompt.
    3. Command (m for help): p

      This prints out the current partition table of the hard drive. In my case, it was loaded with Windows 7 and a back-up partition. These were marked "/dev/sda1" and "/dev/sda2".
    4. Command (m for help): d

      This will delete a partition. I selected "1" (the first partition), then pressed "Enter".
    5. Command (m for help): d

      I'm using this to delete the second partition. As this was the only partition left, it's deleted without any further prompt.
    6. My plan for the Arch Linux install is three partitions. Again, this is an MBR install, which means no need for an EFI partition. The three partitions will be the main (/), swap, and separate "/home" partition.

    7. Command (m for help): n

      Create a new partition. This will be the first partition for the main Linux system ("/") as well as for the "/boot" directory. As it contains the bootable files, it will also be set as the "boot" partition. For this, I entered "1".
      The system asks whether you want this to be a "primary" or an "extended" partition. As this partition will hold the running files, I'm making it a primary (p).
      The next part is to set the start and stop sectors for the size of the partition. As this is the first partition, I'm going to use the default (just press "Enter"), which in my case was sector 2048. The next part asks for the stop sector. fdisk lets you do this EITHER by setting the stop sector, or by simply entering the size of the partition. In my case, I wanted a 40 GB partition for all of the main files. I simply entered "+40G". I could have also calculated how many sectors were needed for 40 GB. My hard drive stores 512 bytes (0.5 kB) per sector, meaning two sectors is required for every kilobyte. One GB requires 1024 * 1024 = 1048576 kB, so I'd need 1048576 x 2 x 40 = 83886080 sectors. By entering "+40G" instead, Fdisk did the calculation for me.
      Lastly, after setting the stop sector, the system may give you a message stating something like "Do you want to keep the 'ntfs' signature?" or some such. It doesn't matter, because you'll use "mkfs" later to set the file system type.
    8. Command (m for help): n

      The second partition I made my "swap" drive. You can have up to four primary partitions in an MBR set-up. As I'm only going to have three, I'm going to make this a "primary" also. I made this partition "2", set it as a "primary" (p) partition, used the default beginning sector, then set the stop sector to an 8 GB (+8G) end.

    9. Command (m for help): n

      The third partition will be for the "/home" directory. I set it as partition "3", made it a "primary" partition, then used the defaults for both the start and stop sector.
    10. At this point, I've created three partitions, one that is 40 GB (for all of the Linux files), one that is 8 GB (for swap), and the remaining ~500 GB for all of the personal files ("/home" directory). The last, two steps here are to make the first partition bootable, and the second partition marked for "swap". (NOTE: Not being an expert on hard disk partitioning, it may NOT be necessary to use Fdisk to make the second partition into a "swap" drive. I'm going to use the Linux command "mkswap" later, which may be redundant.

    11. Command (m for help): a

      This sets the bootable partition. I set partiton #1 as the bootable, so I just entered "1" after this command.
    12. Command (m for help): t

      I'm going to use this to set the second partiton as the "swap" drive. After entering this command, it asks which partition, and I entered "2". It then asks the code. I entered "82", which is the code for "Linux Swap / Solaris". (NOTE: Again, not being an expert on hard drive partitioning
    13. Command (m for help): p

      Check the current partition table. Partition #1 should be bootable. Partition #2 should be set to "swap".
    14. Command (m for help): w

      This writes the current partition table to the hard drive and closes Fdisk.
  6. Create the file system on the partitions. For my installation, the 40 GB and 500 GB partitions will be "ext4", and the second partition will be "swap".
    1. root@archiso ~ # mkfs.ext4 /dev/sda1

      This sets the first partition (the 40 GB one) to the "ext4" file system. Depending on the speed of your system, this might take a minute.
    2. root@archiso ~ # mkfs.ext4 /dev/sda3

      This sets the third partition (in my case, the 500 GB one I'll use for the "/home" directory) to the "ext4" file system. In my case, this took a few minutes due to the speed of my system and the size of the partition. Or maybe it's nothing to do with my system and just the size of the partition.
    3. root@archiso ~ # mkswap /dev/sda2

      This sets the second partition to be a "swap" drive.
    4. root@archiso ~ # swapon /dev/sda2

      This activates the second partition as being a "swap" drive. I guess this is similar to setting the first partition as being a "boot" partition.

    At this point, I have a partitioned hard drive with its file systems set. I'm now ready to mount it and begin adding files.

  7. Mount the various partitions
    1. root@archiso ~ # mount /dev/sda1 /mnt

      This creates a mount point called "/mnt" and connects it with the first partition.
    2. root@archiso ~ # mkdir /mnt/boot

      This creates a "/boot" directory under the main mount point.
    3. root@archiso ~ # mount /dev/sda1 /mnt/boot

      This mounts the new "/boot" directory to the first partition as well. NOTE: Yeah, I have very little idea of what I'm doing here. Does this override the first "mount" command? I have no idea. I just know that this is what I did, and it worked. At the very least, it didn't cause it not to work.
    4. root@archiso ~ # mkdir /mnt/home

      This creates the "/home" directory. As the original main directory has been created as "/mnt", and all directories will be under the main one, the "/home" directory will be created as "/mnt/home" here.
    5. root@archiso ~ # mount /dev/sda3 /mnt/home

      This mounts the third partition (the 500 GB one) to the "/home" directory.
  8. root@archiso ~ # timedatectl set-ntp true

    Set the time and date on the system to poll an NTP server.
  9. For this next part, I needed a working interwebz connection. The first time I ran through this setup, I plugged in an Ethernet cable. The Arch Linux live install had enough smarts to make this "just work". One of the tweaks I worked on as I worked through the install process was to figure out how to make the wireless work. That's what I'm going to use for this install.
    1. root@archiso ~ # ip link

      This checks the wireless interface. Look for the interface that begins with a "w". In my case, it was "wlp7s0". It said "<BROADCAST,MULTICAST>", which meant that the driver was loaded for the wireless interface.
    2. root@archiso ~ # wifi-menu -o

      This starts the Arch Linux Wifi connection menu. The first menu shows all of the wireless access points that the system can currently see. In my case, I used the arrow keys to select the one that corresponded to my access point, and pressed "Enter". It then gave me a file name for the configuration file it was going to make. I used the default, pressed "Enter", then entered the password for my access point. At that point, it dropped me back to command prompt.
    3. root@archiso ~ # ip addr

      Check that the wireless interface has an IP address. In my case, I saw that it had "inet". This meant that it had an IP address ( and a subnet mask (/24, which is the equivalent to
    4. root@archiso ~ # ping -c 5

      This tests the connection by sending 5 pings to the URL "". If you get a response with a time at the end, you're connected properly.
  10. root@archiso ~ # pacstrap /mnt base

    This loads the Arch Linux base files. I'm fortunate to have a decent internet connection (10's of megabits per second speed), so it only takes about 10 minutes to download the files and install them.
  11. root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab

    This generates the "fstab" file so that each partition is properly mounted on boot-up. If you so desire, after this, you can run the command "cat /mnt/etc/fstab" to check that each partition is properly listed (/dev/sda1 as / and /boot, /dev/sda2 as swap, and /dev/sda3 as /home).
  12. root@archiso ~ # arch-chroot /mnt

    This changes the root command to the recently-created main mount point on the hard drive.
  13. The prompt will change to "[root@archiso /]#".

  14. [root@archiso /]# pacman -S dhcpcd btrfs-progs wpa_supplicant wpa_actiond dialog grub intel-ucode sudo iw networkmanager lshw

    This loads a set of extra applications that are not part of the "base" install, but will be needed later for various things.
  15. Set the time zone and clock:
    1. [root@archiso /]# ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

      This sets the time zone to that of New York in America.
    2. [root@archiso /]# hwclock --systohc

      This sets the system clock from the hardware clock. This helps to adjust the clock for drift.
    3. [root@archiso /]# nano /etc/locale.gen

      This opens the file "locale.gen" in the "nano" text editor. Use the arrow keys to scroll down to the appropriate lines and uncomment them. In my case, there are two lines that begin with "en_US". I uncommented both lines (took out the "#"), saved the file (Ctrl+o), then exited (Ctrl+x).
    4. [root@archiso /]# locale-gen

      This generates the locale file to maintain the system clock.
    5. [root@archiso /]# nano /etc/locale.conf

      This creates and opens the file "/etc/locale.conf". This file will set the language and encoding for the system. In my case, I created one line that said "LANG=en_US.UTF-8". I saved the file (Ctrl+o) and exited (Ctrl+x).
  16. Time to make the wireless connection on boot-up.
    1. [root@archiso /]# cd /etc/netctl

      Change to the directory where the wired and wireless connection profiles are stored. This is so that, when you run the next command, it will be automatically stored in this directory.
    2. [root@archiso /]# wifi-menu -o

      This re-runs the Arch Linux wireless set-up wizard. This should be the same settings as the first time. The difference is that the profile will be stored in the directory "/etc/netctl". Frankly, I have no idea where the first, generated profile was stored. But this time it will be stored in the current directory, which (if you did the last step) will be "/etc/netctl". NOTE: You might get a message stating that there is an error or some kind of problem. Ignore it. You're getting that message because you already have your wireless connection set-up. All you did with this step was to create the profile and store it such that the system can use it when you boot up your computer. Also, the "-o" in this command obfuscates your password as this file is stored in plain text. Using the "-o" option means that your password is essentially stored as a hash and someone cannot just read it out of this file.
    3. [root@archiso /]# ls

      List all of the files in the current directory. The reason for this is to determine the name of the profile you just created in the last step. If you already know it (because your memory retention is better than mine), you can skip this step.
    4. [root@archiso /]# netctl enable <interface name>

    5. In this step, you're going to enable the automatic set-up of the wireless profile so that it starts up when you boot the computer. Replace "<interface name>" with your profile filename. In my case, it was "wlp7s0_Tenda", so the command I entered was "netctl enable wlp7s0_Tenda".
  17. [root@archiso /]# passwd

    When you enter this command, the system will prompt you to enter a root password. Enter a root password, and then confirm it.
  18. Set-up "grub" for boot-up:
    1. [root@archiso /]# grub-install --target=i386-pc /dev/sda

      This installs the base "grub" application on the primary hard drive (/dev/sda).
    2. [root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg

      This generates the base "grub" configuration file, to include the microcode updates that may be required on boot-up.
  19. Reboot the system.
    1. [root@archiso /]# exit

      This moves the root from the system back to the installer.
    2. Remove the CD/DVD or USB thumb drive.
    3. root@archiso ~ # reboot

  20. The system should reboot, and present you with a command line prompt that states "archlinux login:". If so, congratulations! You've just installed Arch Linux on your computer, and it works!

At this point, you can go off and customize the install to your liking. In my case, I added a "normal" (non-root) user, added them to the "sudo" group, then loaded a graphical user interface (Gnome, in my case). I'm going to show you the steps I used to do that.

Add a normal user and give them "sudo" privileges

  1. At the "archlinux login:" prompt, enter "root" and then enter the root password you set earlier.
  2. [root@archlinux ~]# useradd --create-home <user name>

    This creates the new, non-root user and creates a user directory under the "/home" directory.
  3. [root@archlinux ~]# passwd <user name>

    This allows you to create a separate password for your non-root user. Just enter a password and then confirm it.
  4. Add the new user to the "sudoers" file so that they have "sudo" privileges. NOTE: If you don't want them to have root privileges, skip this step.
    1. [root@archlinux ~]# export VISUAL=nano; visudo

      This opens the "sudo" file using the "nano" text editor. If you simply use the command "visudo", it opens with the "vi" text editor. I find "nano" easier to use, and Arch has it loaded as part of the base file set. So why not?
    2. Below the line with "root ALL=(ALL) ALL", add the line "<user name> ALL=(ALL) ALL". Save the file (Ctrl+o) and exit nano (Ctrl+x).

At this point, I can type "logout" at the command prompt, and at the main "login" prompt, I can enter the name of the new user, enter their password, and I'll be logged in as the new user. However, I'm going to use the "root" account for the remaining step of setting up the graphical user interface.

Add and set-up the graphical user interface: I'm going to use Gnome for the graphical user interface. I've been using Ubuntu and Mint since I converted to Linux, so Gnome should be fairly easy for me to navigate.

  1. [root@archlinux ~]# lspci | grep -e VGA -e 3D

    This command allows me to see what kind of graphics system I have. In my case, it's an onboard Intel graphics chipset.
  2. [root@archlinux ~]# pacman -S xf86-video-intel gnome

    This loads the appropriate graphics drivers as well as the Gnome files. Since my system uses an Intel graphics chipset, that's why the last part of the video command is "-intel". If you have a different chipset, this will be different. At the part where it asks which of the Gnome files to install, I used the default and hit "Enter" to install all of them.
  3. [root@archlinux ~]# systemctl enable gdm.service

    This enables the Gnome service so that it starts up when you boot up the computer.
  4. [root@archlinux ~]# reboot

  5. This will reboot the computer, at which point it should start up with the Gnome display manager. You should be able to log in with any legitimate user accounts.

Here's a Random Fact...