Arch Linux with LVM in VirtualBox

Hey! Listen! To make sure you’re reading the most current version of this post, check the table below.

2017-01-02Encrypted Arch Linux install
  • New partition layouts
  • 2014-11-15Arch Linux with Encrypted LVM on hardware
  • Replaced Cinnamon with Openbox
  • 2014-11-10Arch Linux with Encrypted LVM on hardware
  • Installing on hardware instead of inside VM
  • 2014-10-06Arch Linux with Encrypted LVM in VirtualBox
  • Using 64bit instead of 32bit
  • Replaced GDM with LightDM
  • 2014-09-05Arch Linux with Encrypted LVM in VirtualBox
  • Replaced MBR with GPT
  • Added encryption
  • 2014-08-27Arch Linux with LVM in VirtualBox
  • Initial post

    I started using Linux in college when Ubuntu was still using Gnome 2. Eventually, Ubuntu started shipping with Gnome 3, then Unity, and I wasn’t a fan of either. I switched to Linux Mint and fell in love with the Cinnamon desktop environment. Wanting something more bleeding-edge, I switched to Fedora and installed Cinnamon on it as well. Fedora offered its own challenges; I had to learn a little about systemd, how to interact with yum instead of apt, and it was a struggle to get some of my hardware to work. But for the most part, everything was relatively easy and I wasn’t really out of my comfort zone.

    Recently, I’ve been trying to learn more about Linux. I considered picking up a Linux book, but I’m more of a hands-on guy. I asked r/linux and someone suggested Arch Linux. Arch Linux is notorious for not being “newbie friendly” and values simplicity and code correctness over convenience. It doesn’t have a fancy installer, and most configuration is done in a text editor working with config files. However, Arch Linux is almost infinitely customizable and is a rolling distribution, which means you never have to install a discrete version.

    Before I go all-out and install it on my laptop, I’m going to be testing it in VirtualBox as much as I can. My setup is as follows:

    Base Installation

    • 20GB disk with the following logical volumes:
      • 500MB boot
      • 1GB swap
      • 14GB root
      • 4.5GB home
    • Wired network connection (since I’m in a VM)
    • GRUB2 bootloader
    • Gnome display manager (GDM)
    • Muffin window manager (included with Cinnamon)
    • Cinnamon desktop environment
    • VirtualBox Guest Additions


    • Audio/video/DVD support
    • Archey
    • Firewall
    • Printing (CUPS)
    • Flash/Java browser plugins


    You’ll need the following before you begin:

    • A copy of the Arch Linux ISO (I recommend using a torrent instead of a direct download)
    • A copy of VirtualBox
    • The VirtualBox Extension Pack


    This tutorial is loosely based on the Arch Linux Beginner’s Guide.


    Base Install

    Step 0 – Explanation

    Before I begin, I wanted to explain a few of the decisions I made:

    1. I chose to go with a traditional BIOS instead of UEFI. My laptop doesn’t support UEFI, so I’m forced to stay with a traditional BIOS on hardware, and I’ll be doing the same thing in VirtualBox. This setting can be changed in VirtualBox, but I’m not going to cover that.
    2. I chose to go with a Master Boot Record (MBR) over a GUID Partition Table (GPT). MBR isn’t as new as GPT, and only offers partitions of up to 2TB in size. GPT, however, can allow partitions of around 9ZB (that’s zettabytes). But, MBR is easier to setup and what I’m familiar with. In addition, when using UEFI, you have to use GPT.
    3. I chose to use logical volume manager (LVM) instead of traditional partitions. LVM is more enterprise-focused with the following features: disk-pooling, hot-swapping, resize on-the-fly, snapshots, stripping across multiple disks, etc… However, I plan on eventually setting up disk encryption during an Arch Linux install. LVM will allow me to encrypt the entire volume group at once, and only require one password to unlock it, instead of a password for each partition. LVM is relatively new (compared to traditional partitions), but it’s mature enough to be considered stable.
    4. I chose ext4 over ext3. ext4 is faster than ext3, mature enough to be considered stable, and ships with almost all Linux distributions as the default filesystem. However, it isn’t as advanced as Btrfs, which is still experimental.


    Step 1 – Setup your VM

    Install VirtualBox on your host machine and then install the Extension Pack. Create a new virtual machine for a 32bit Arch Linux installation. I am using a 20GB hard drive with 2048MB of RAM. Once the virtual machine is setup, go to Settings–>General–>Advanced and set Shared Clipboard to Bidirectional.



    Next, go to Settings–>Display–>Video and set the Video Memory to 128MB (this is for Cinnamon). Then, on the same tab, enable 3D Acceleration (again, this is for Cinnamon).



    Finally, go to Settings–>Storage and mount the Arch Linux ISO under the empty IDE Controller. Check the box next to Live CD/DVD.



    Press OK to save and then Start to boot from the ISO. From the menu, select Boot Arch Linux (i686) and press Enter.



    At this point, you should be automatically logged into a root prompt. Until we get Cinnamon installed and working, this is all going to be text-based and you’ll only be using the keyboard, no mouse.

    Arch Linux 3.15.7-1-ARCH (tty1)
    archiso login: root (automatic login)
    root@archiso ~ #


    Step 1.5 – Setup SSH access

    I want to copy text from the VM to this blog to give you examples of what I’m seeing. Since Cinnamon isn’t installed yet, I’m going to setup SSH access as described here. Then, I need to forward a host post (e.g., 3022) to port 22 on the VM. I covered that in a previous post, here. You don’t need to do this step unless you want to copy/paste text to/from the VM.


    Step 2 – Test internet connectivity

    Enter the following at the prompt to test your internet connection. The DHCP daemon should have been started at boot, so you should expect a response with 0% packet loss. Since this build is in a VM, our internet connection will be wired. I won’t be covering wireless in this tutorial.

    ping -c 3


    Step 3 – Setup partitions

    First, we need to setup partitions. However, before we do anything, we need to make sure the device mapper kernel modules are loaded with the command below.

    modprobe -a dm-mod


    Next, use the fdisk utility to find the name of your disk. More than likely, the disk will be /dev/sda.

    fdisk -l

    Notice the 20GB disk we setup for the VM. This is the disk we want to work with.

    Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk /dev/mapper/arch_airootfs: 32 GiB, 34359738368 bytes, 67108864 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Note – I will be using /dev/sda in this guide. Please don’t copy/paste from this guide directly, as you could risk destroying your current system. I’m not responsible for anything you break 🙂


    Optionally, you can erase the partition tables on your disk (but it should be blank already).

    sgdisk --zap-all /dev/sda


    Next, we want to use fdisk to create the partition.

    fdisk /dev/sda


    Use the n option to create a new partition.

    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended


    Press Enter select the default option for a primary partition, then press Enter again to use the first partition.

    Select (default p): 
    Partition number (1-4, default 1):


    Since we want LVM to have access to all 20GB, press Enter to select the default option for the first sector of the partition, then Enter again for the last.

    First sector (2048-41943039, default 2048): 
    Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): 
    Created a new partition 1 of type 'Linux' and of size 20 GiB.


    Use the t option to specify a partition type, then use the L option to list all types.

    Command (m for help): t
    Selected partition 1
    Hex code (type L to list all codes): L
     0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
     1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
     2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
     3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
     4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
     5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
     6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
     7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
     8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
     9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
     a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
     b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
     c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
     e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            
     f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
    10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
    11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
    12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
    14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  
    16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
    17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
    18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
    1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        
    1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
    1e  Hidden W95 FAT1 80  Old Minix


    Since we want to use LVM, use 8e.

    Hex code (type L to list all codes): 8e
    Changed type of partition 'Linux' to 'Linux LVM'.


    Use the p option to preview your changes.

    Command (m for help): p
    Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0xf3238bba
    Device    Boot Start       End   Blocks  Id System
    /dev/sda1       2048  41943039 20970496  8e Linux LVM


    Use the w option to write your changes to disk.

    Command (m for help): w
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.


    Step 4 – Setup a physical volume

    First, we’re going to scan for disks that are capable of hosting a physical volume.


    In the example below, we’re going to focus on the partition /dev/sda1.

      /dev/loop0                [     236.34 MiB] 
      /dev/mapper/arch_airootfs [      32.00 GiB] 
      /dev/loop1                [      32.00 GiB] 
      /dev/sda1                 [      20.00 GiB] 
      /dev/loop2                [      32.00 GiB] 
      1 disk
      4 partitions
      0 LVM physical volume whole disks
      0 LVM physical volumes


    Now, we’re going to create a physical volume on /dev/sda1.

    pvcreate /dev/sda1


    Finally, we’ll display the physical volume we created.



    Step 5 – Setup a volume group

    We’re going to create a volume group named VolGroup00 on the physical volume /dev/sda1. You can name the volume group whatever you’d like.

    vgcreate VolGroup00 /dev/sda1


    Finally, we’ll display the volume group we created.



    Step 6 – Setup logical volumes

    In this step, we’re going to create four logical volumes on the volume group VolGroup00.

    lvcreate -L 500MB VolGroup00 -n lvolboot
    lvcreate -C y -L 1GB VolGroup00 -n lvolswap
    lvcreate -L 14GB VolGroup00 -n lvolroot
    lvcreate -l +100%FREE VolGroup00 -n lvolhome

    Note – In the second command, the -C y options are used to create a contiguous partition for swap. In the last command, the 100%FREE option is used to fill the remainder of the space.


    Finally, we’ll display the logical volumes we created.



    Step 7 – Create filesystems and mount logical volumes

    The first things we need to do are scan for volume groups and then import any changes.

    vgchange -ay


    Next, we’re going to create filesystems on each logical volume.

    mkfs.ext4 /dev/mapper/VolGroup00-lvolboot
    mkswap /dev/mapper/VolGroup00-lvolswap
    mkfs.ext4 /dev/mapper/VolGroup00-lvolroot
    mkfs.ext4 /dev/mapper/VolGroup00-lvolhome


    Now, we’re going to mount the filesystems we just created.

    mount /dev/mapper/VolGroup00-lvolroot /mnt
    mkdir /mnt/boot
    mount /dev/mapper/VolGroup00-lvolboot /mnt/boot
    mkdir /mnt/home
    mount /dev/mapper/VolGroup00-lvolhome /mnt/home
    swapon /dev/mapper/VolGroup00-lvolswap


    Finally, we’ll display the filesystems we created.

    lsblk /dev/sda

    Here, you can see the physical disk called /dev/sda, the physical volume called /dev/sda1, the volume group called VolGroup00, and the four logical volumes with their sizes and mount points.

    sda                       8:0    0   20G  0 disk
    └─sda1                    8:1    0   20G  0 part
      ├─VolGroup00-lvolboot 254:1    0  500M  0 lvm  /mnt/boot
      ├─VolGroup00-lvolswap 254:2    0    1G  0 lvm  [SWAP]
      ├─VolGroup00-lvolroot 254:3    0   14G  0 lvm  /mnt
      └─VolGroup00-lvolhome 254:4    0  4.5G  0 lvm  /mnt/home


    Step 8 – Select a mirror

    Next, we need to select a mirror to use when downloading packages. You can use the Mirrorlist Generator to find the best mirror for you based on your country.  Then, I would recommend renaming the current mirrorlist to have a backup.

    mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist_old


    Use vi to create a new list…

    vi /etc/pacman.d/mirrorlist

    …and populate it with the entries from the mirrorlist generator. Mine is below.

    ## Arch Linux repository mirrorlist
    ## Sorted by mirror score from mirror status page
    ## Generated on 2014-08-30
    ## Score: 0.5, United States
    Server =$repo/os/$arch
    ## Score: 1.0, United States
    Server =$repo/os/$arch
    ## Score: 1.0, United States
    Server =$repo/os/$arch
    ## Score: 1.1, United States
    Server =$repo/os/$arch
    ## Score: 1.3, United States
    Server =$repo/os/$arch
    ## Score: 1.4, United States
    Server =$repo/os/$arch
    ## Score: 1.6, United States
    Server =$repo/os/$arch
    ## Score: 1.6, United States
    Server =$repo/os/$arch
    ## Score: 1.7, United States
    Server =$repo/os/$arch
    ## Score: 1.8, United States
    Server =$repo/os/$arch
    ## Score: 1.8, United States
    Server =$repo/os/$arch
    ## Score: 2.0, United States
    Server =$repo/os/$arch
    ## Score: 2.0, United States
    Server =$repo/os/$arch
    ## Score: 2.0, United States
    Server =$repo/os/$arch
    ## Score: 2.4, United States
    Server =$repo/os/$arch
    ## Score: 2.8, United States
    Server =$repo/os/$arch
    ## Score: 2.9, United States
    Server =$repo/os/$arch
    ## Score: 3.5, United States
    Server =$repo/os/$arch
    ## Score: 3.6, United States
    Server =$repo/os/$arch
    ## Score: 4.0, United States
    Server =$repo/os/$arch
    ## Score: 4.1, United States
    Server =$repo/os/$arch
    ## Score: 4.4, United States
    Server =$repo/os/$arch
    ## Score: 4.4, United States
    Server =$repo/os/$arch
    ## Score: 4.6, United States
    Server =$repo/os/$arch
    ## Score: 7.0, United States
    Server =$repo/os/$arch
    ## Score: 12.5, United States
    Server =$repo/os/$arch
    ## Score: 12.7, United States
    Server =$repo/os/$arch
    ## Score: 13.3, United States
    Server =$repo/os/$arch
    ## Score: 23.5, United States
    Server =$repo/os/$arch
    Note – The list of mirrors generated has every server commented out. Use a text editor to do a find/replace on #Server with Server. The mirrors are used by pacman in the order they are listed.


    Finally, use pacman to refresh the package lists. You should do this every time you update your mirrorlist.

    pacman -Syy


    Step 9 – Install the base system

    Finally, we’re installing Arch Linux! Use the pacstrap command to install the system to /mnt. Use the -i option to ignore being prompted for all 75 packages we’re about to install.

    pacstrap -i /mnt base base-devel


    You’ll need to press Enter once to confirm all packages in the base group, then again for the base-devel group. This step will take 5-10 minutes.

    :: There are 50 members in group base:
    :: Repository core
       1) bash  2) bzip2  3) coreutils  4) cryptsetup  5) device-mapper
       6) dhcpcd  7) diffutils  8) e2fsprogs  9) file  10) filesystem
       11) findutils  12) gawk  13) gcc-libs  14) gettext  15) glibc
       16) grep  17) gzip  18) inetutils  19) iproute2  20) iputils
       21) jfsutils  22) less  23) licenses  24) linux  25) logrotate
       26) lvm2  27) man-db  28) man-pages  29) mdadm  30) nano  31) netctl
       32) pacman  33) pciutils  34) pcmciautils  35) perl  36) procps-ng
       37) psmisc  38) reiserfsprogs  39) s-nail  40) sed  41) shadow
       42) sysfsutils  43) systemd-sysvcompat  44) tar  45) texinfo
       46) usbutils  47) util-linux  48) vi  49) which  50) xfsprogs
    Enter a selection (default=all): 
    :: There are 25 members in group base-devel:
    :: Repository core
       1) autoconf  2) automake  3) binutils  4) bison  5) fakeroot  6) file
       7) findutils  8) flex  9) gawk  10) gcc  11) gettext  12) grep
       13) groff  14) gzip  15) libtool  16) m4  17) make  18) pacman
       19) patch  20) pkg-config  21) sed  22) sudo  23) texinfo
       24) util-linux  25) which
    Enter a selection (default=all):


    Step 10 – Generate an fstab

    The fstab file tells the sytem what each disk/partition/logical volume does and how to mount it. Use the command below to generate one.

    genfstab -U -p /mnt >> /mnt/etc/fstab


    It’s always recommended to check the fstab file for errors.



    Cat out the /mnt/etc/fstab file and compare the UUIDs and logical volumes types to what was returned by blkid above.

    cat /mnt/etc/fstab


    Step 11 – Set locales and system information

    We need to chroot into the newly installed system before we can configure it.

    arch-chroot /mnt /bin/bash


    Next, we’re going to set locales. Use vi to edit the /etc/locale.gen file to uncomment your preferred encoding from the file.

    vi /etc/locale.gen

    An excerpt of my file is below, notice the uncommented line.

    #en_PH ISO-8859-1
    #en_SG.UTF-8 UTF-8
    #en_SG ISO-8859-1
    en_US.UTF-8 UTF-8
    #en_US ISO-8859-1
    #en_ZA.UTF-8 UTF-8
    #en_ZA ISO-8859-1


    Then, use the command below to generate a locale.



    Now, run the following two commands to generate a locale.conf file and set the LANG variable. Substitute en_US.UTF-8 with the encoding you uncommented in the step above.

    echo LANG=en_US.UTF-8 > /etc/locale.conf
    export LANG=en_US.UTF-8


    Set a timezone with the following two commands. Substitute America and New_York with your zone and sub-zone.

    rm /etc/localtime
    ln -s /usr/share/zoneinfo/America/New_York /etc/localtime


    Set the hardware clock with the following command.

    hwclock --systohc --utc


    There’s still more work to be done. Here, set a hostname with the following command. Substitute ArchTest with your hostname of choice.

    echo ArchTest > /etc/hostname


    Now, use vi to edit the /etc/hosts file.

    vi /etc/hosts

    Add the same hostname to /etc/hosts.

    # /etc/hosts: static lookup table for host names
    #<ip-address>   <>   <hostname>       localhost.localdomain   localhost  ArchTest
    ::1             localhost.localdomain   localhost
    # End of file


    Find the name of your network adapter by using ip link.

    ip link

    In the example below, my adapter is enp0s3. Arch Linux uses Consistent Network Interface Naming to name its adapters, which is why you have enp0s3 instead of eth0.

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether 08:00:27:9a:53:40 brd ff:ff:ff:ff:ff:ff


    Now, enable the DHCP client daemon on that adapter. Substitute enp0s3 with your adapter name.

    systemctl enable dhcpcd@enp0s3


    Step 12 – Generate an initial ramdisk

    This step is very important. Since we’re using LVM, we need to edit the /etc/mkinitcpio.conf file to include the lvm2 hook between the block and filesystem entries.

    vi /etc/mkinitcpio.conf


    HOOKS="base udev autodetect modconf block filesystems keyboard fsck"


    HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"


    Finally, generate the ramdisk. For now, ignore any errors about missing firmware.

    cd /boot
    mkinitcpio -p linux


    Step 13 – Create users and set passwords

    Set a password for the root user with the command below.



    It’s also a good idea to create a normal user for you to use later on. Substitute logan with your username.

    useradd -m -g users -G audio,lp,optical,storage,video,games,power,scanner,wheel -s /bin/bash logan

    Note – I have this user added to the wheel group, which we’ll need to use sudo. More on that later.


    Then, change the password for your new user. Substitute logan with your username.

    passwd logan


    Step 14 – Install and configure a bootloader

    First, edit the /etc/lvm/lvm.conf file to set use_lvmetad = 0.

    vi /etc/lvm/lvm.conf

    An excerpt of my file is below.

    # is set at the same time, LVM always issues a warning message about this
    # and then it automatically disables lvmetad use.
    use_lvmetad = 0
    # Full path of the utility called to check that a thin metadata device
    # is in a state that allows it to be used.


    If you don’t edit this file, you may receive errors like below when installing and configuring GRUB2.

    /run/lvm/lvmetad.socket: connect failed: No such file or directory
    WARNING: Failed to connect to lvmetad. Falling back to internal scanning.


    Use pacman to install a few packages, including the GRUB2 bootloader.

    pacman -S fuse grub lvm2 os-prober


    Setup GRUB2 with the following two commands.

    grub-install --target=i386-pc --recheck /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg


    Exit chroot with exit and unmount any filesystems.

    umount /mnt/home
    umount /mnt/boot
    umount /mnt


    Finally, shutdown your VM.

    shutdown -h now


    Remove the ISO file from the virtual drive we inserted back in step 1.



    Step 15 – Start Arch Linux

    Start your VM, and you should be greeted by the GRUB2 bootloader.



    After the operating system loads, you should be back at a root prompt where you can login with the root username and root password you set earlier.



    The first order of business is to test your internet connectivity.

    ping -c 3


    Then, check for updates with pacman.

    pacman -Syu


    Here, we’ll disable some unnecessary services. I’m disabling FTP for security reasons, and Kerberos and RAID since they’re not being used.

    systemctl disable ftpd.service
    systemctl disable krb5-kadmind.service
    systemctl disable krb5-kdc.service
    systemctl disable mdadm.service

    UPDATE – Looks like there is an issue with systemd starting every service at boot instead of pre-selected services, which is why FTP, Kerberos, and RAID were running. Appears fixed as-of 2014-09-04.


    Next, we need to edit the /etc/sudoers file to allow use of the wheel group for our normal users. Only use visudo to edit /etc/sudoers, as it locks the file while editing, provides basic syntax checking, etc…


    Uncomment the %wheel ALL=(ALL) ALL line, like below.


    # %wheel ALL=(ALL) ALL


    %wheel ALL=(ALL) ALL


    Step 16 – Install VirtualBox Guest Additions

    Since this is a VM, you may want some of the features offered by the Guest Additions package. The Arch Linux wiki page recommends using a pacman packing instead of using the script on the virtual Guest Additions disk.

    pacman -S virtualbox-guest-utils virtualbox-guest-modules


    Next, load the kernel modules.

    modprobe -a vboxguest vboxsf vboxvideo


    To make the modules load at boot, create the following file in vi.

    vi /etc/modules-load.d/virtualbox.conf

    Then, add the three lines below to the file.



    Enable the systemd service at boot.

    systemctl enable vboxservice


    Step 17 – Install the GUI

    Now, we’re going to install and configure the GUI and a few other features. This will take about 10-15 minutes to download.

    pacman -S cinnamon cinnamon-control-center gdm gnome-terminal mesa networkmanager network-manager-applet networkmanager-dispatcher-ntpd


    Enable the newly installed Gnome display manager (GDM) so you can use it when we reboot.

    systemctl enable gdm


    Now, we’re going to enable the NetworkManager service at boot. However, by default, Arch Linux receives an IP address via DHCP by using the DHCP client daemon (dhcpcd). Since the two will conflict, we’re going to disable dhcpcd.

    systemctl enable NetworkManager.service
    systemctl disable dhcpcd


    Set the NetworkManager dispatcher service to start at boot. This will bring NTP up/down with your network connections.

    systemctl enable NetworkManager-dispatcher.service


    This is personal preference, but I like to make the panel in Cinnamon transparent by editing the /usr/share/cinnamon/theme/cinnamon.css file.

    vi /usr/share/cinnamon/theme/cinnamon.css

    Add background-color: rgba(0,0,0,0); to the end of the #panel section, like below.

    #panel {
            color: #ffffff;
            background-color: #555555;
            font-size: 8.5pt;
            font-weight: normal;
            height: 25px;
            background-color: rgba(0,0,0,0);


    We also need to configure the swappiness (yes, that’s the technical term) of the swap logical volume. A higher swappiness value means more data is swapped to disk, which decreases performance.

    vi /etc/sysctl.d/99-sysctl.conf

    The default value is 60, but I’m going to set it to 20.



    This is also personal preference, but I don’t want to be given the option to log into Gnome (that’s how much I can’t stand it) when GDM starts. Remove the option for Gnome by issuing the following command.

    mv /usr/share/xsessions/gnome.desktop /usr/share/xsessions/gnome.desktop_old


    Step 18 – Start and configure the GUI

    Finally, the moment of truth! Reboot your installation and cross your fingers.



    You should boot into GDM and be able to login using the normal user we created earlier (not root).



    Note how Gnome or Gnome (Software Rending) isn’t an option.



    If all goes well, Cinnamon should start (with a transparent bottom panel). If you resize the window, the background image and panels should adjust, showing that VirtualBox Guest Additions are working.


    Check that swappiness (lol) is still set to 20.

    cat /proc/sys/vm/swappiness


    Now is a good time to install some packages, my list is below. This is also a great way to test sudo!

    sudo pacman -S alsa-firmware alsa-utils arandr audacity baobab bash-completion banshee brasero bzip2 cheese chromium clamav coreutils deluge devede dia exfat-utils file-roller filezilla firefox font-mathematica freetype2 gedit gimp gksu gthumb gparted gzip htop inkscape k3b libreoffice macchanger mesa nemo-share networkmanager-openvpn networkmanager-pptp networkmanager-vpnc ntfs-3g openssh openvpn p7zip pidgin pinta pitivi pptpclient remmina terminus-font tigervnc ttf-dejavu ttf-droid ttf-freefont ttf-inconsolata ttf-liberation ttf-linux-libertine ttf-ubuntu-font-family unrar unzip util-linux vi vim vpnc wget zip


    Unmute and test your speakers with the commands below. This is assuming you’re using ALSA and have a 2.0 setup.

    amixer sset Master unmute
    speaker-test -c 2


    To create all of your default directories in $HOME (e.g., Documents, Music, Pictures, etc…), run the two commands below.

    sudo pacman -S xdg-user-dirs


    That’s all, folks! I’m going to keep testing out Arch Linux and working on making it a daily driver. I’m still looking for a few more features (below). When I get them working, I’ll update this post accordingly.

    • Encryption
    • Windows networking (Samba)
    • Wireless support  (on hardware, not in a VM)
    • Touchpad support (on hardware, not in a VM)
    • Power management (on hardware, not in a VM)

    A few extras

    Audio/video codecs and DVD support

    Unlike Ubuntu or Linux Mint, Arch Linux won’t support many codecs or DVD playback out-of-the-box. The packages below should cover most of what you need to do.

    sudo pacman -S ffmpeg flac gstreamer gstreamer0.10 gstreamer0.10-ffmpeg gstreamer0.10-good-plugins gst-libav gst-plugins-base gst-plugins-good lame libdvdcss libdvdnav libdvdread libmpeg2 libtheora libvorbis mplayer vlc x264 x265 xvidcore winff



    This is personal preference, but I’m going to install Archey from the Arch User Repository (AUR). The AUR is a community-driven repository for Arch Linux packages. Installing packages from the AUR involves downloading the tarball to your PC, then extracting it, building the package, and installing it using pacman. There are scripts that will do this automatically, but you should know how to do it manually.

    cd ~
    tar -xvzf archey.tar.gz
    cd archey
    makepkg -s
    sudo pacman -U archey*.pkg.tar.xz


    Edit your .bashrc file to add the archey line at the end.

    vi ~/.bashrc


    # ~/.bashrc
    # If not running interactively, don't do anything
    [[ $- != *i* ]] && return
    alias ls='ls --color=auto'
    PS1='[\u@\h \W]\$ '


    # ~/.bashrc
    # If not running interactively, don't do anything
    [[ $- != *i* ]] && return
    alias ls='ls --color=auto'
    PS1='[\u@\h \W]\$ '


    Now, whenever you start a terminal (in Cinnamon or over SSH), you’ll get that awesome Arch Linux system info page everyone likes to show off.




    Getting a firewall up and running should be near the top of your to-do list. I’m fairly comfortable with Fedora’s GUI firewall package, firewalld, but it doesn’t support iptables. I want to eventually learn iptables, but am not ready to jump right into it yet. Browsing the firewall wiki page presented an overwhelming amount of options, and I settled on ufw, which is a front-end for iptables. I’m also installing Gufw in case I need a little help 🙂

    sudo pacman -S gufw iptables ufw


    Start ufw and make it available after boot.

    sudo ufw enable
    sudo systemctl start ufw
    sudo systemctl enable ufw


    Make sure that the iptables service isn’t running, since it will conflict with ufw.

    sudo systemctl --type=service
    sudo systemctl disable iptables.service
    sudo systemctl disable ip6tables.service


    I’m going to be starting with a basic configuration and adding to it as needed.

    sudo ufw default deny
    sudo ufw allow from
    sudo ufw allow Deluge
    sudo ufw allow SSH


    Printing (CUPS)

    Let me tell you something. I. HATE. PRINTING. Every time there is a printer involved in any workflow, I can promise you it will all come to a grinding halt at the printer. Apparently, Matthew Inman of The Oatmeal agrees with me. At home, we have a HP Photosmart D110a that I’d love to go Michael Bolton on if I could.

    When using Ubuntu, Linux Mint, and Fedora, CUPS has always served me pretty well. I don’t know if I could print labels, envelopes, or photos, but printing a one-off document is relatively painless.

    We’ll need a few packages before we get started, and you’ll also need to know which driver pack you want. I also recommend skipping the config files and using an alternative interface to CUPS, in this case, that’s system-config-printer.

    sudo pacman -S cups cups-pdf hplip libcups system-config-printer


    You’ll need to create a new group, then add yourself to that group. Substitute logan with your username.

    sudo groupadd lpadmin
    sudo usermod -aG lpadmin logan


    Next, use vi to edit the /etc/cups/cups-files.conf file to add the newly created group to the SystemGroup line.

    sudo vi /etc/cups/cups-files.conf


    # Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
    SystemGroup sys root


    # Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
    SystemGroup sys root lpadmin


    Reboot your machine, since you changed your group membership and CUPS needs cycled.

    sudo reboot


    Next, launch the system-config-printer package by going to Menu–>Administration–>Print Settings then click on Add. If a login box appears, enter your username and password.



    On the left, select Network Printer, then Find Network Printer.  On the right, enter the IP address of the printer and click Find.



    When the printer is found, you’ll need to choose a Connection from the box at the bottom. Choose the connection that best represents the driver pack you installed earlier and click Forward.



    Give the printer a name, description, and location, then click Apply.



    When the dialog box appears, print a test page and start praying to the printing gods that it comes out.



    Flash player plugin

    As much as I hate relying on a closed source product, sometimes you just need Flash player. The official Adobe version of Flash player, as well as open source alternatives, are available in pacman. The command below installs the Adobe version.

    sudo pacman -S flashplugin

    Note – Adobe discontinued support for the Linux version of Flash player in 2012, but will provide security updates until 2017. Flash will still be available if you’re using Chrome/Chromium, but if you’re using anything else, you’ll need to use the package above.


    Java plugin

    Java support in Arch Linux is relatively easy, only requiring the plugin below.

    sudo pacman -S icedtea-web


    6 thoughts on “Arch Linux with LVM in VirtualBox

    1. Thanks for the guide. I am having issues updating the mirrorlist. I backed up the old mirrorlist and created the new one but I am not sure how to paste into Vi in Virtualbox. Any ideas?

      • Mike,

        There’s two things you can do.

        • Install openssh-server into your guest, then forward a port from your host to your guest, as described here. You could then SSH into your guest and paste into your terminal.
        • Enabled the shared clipboard, as described here. But you may need to install VirtualBox guest additions first.

        Let me know how it goes.


    Leave a Comment