Arch Linux is the Linux distro most people are talking about when you hear things like “expert friendly” and “unwelcoming.” When you go to sign up for their forum you receive a “warm and friendly” greeting.
The reason their are so many forks of Arch Linux is because it doesn’t really have an installer. Not one any SuSE, Unbuntu, Mint, i.e. popular, Linux distro user would recognize. Eventually kids get past this stage of life:
They come to realize that knowing the name of every Linux package ever created for Arch and what it doesn’t really isn’t worth the time and energy. They realize that “I only install this tiny subset of packages for this desktop, so wouldn’t it be cool if I had an installer to do that?”
Maybe this installer could provide a GUI partitioning tool? How about if it also had a few default partitioning options? Perhaps it could automatically install the boot loader for me? Yeah, that would be great!
Why I Had to Install Arch?
Well, you saw it, that greeting. If you are a regular reader you read my post about installing PostgreSQL on Manjaro. I ran into an issue documented in that post. Asking for help on the Manjaro user forum presented me with a deafening sound of silence more than a week later.
I was certain this was a bug Manjaro inherited from Arch Linux. Off I went to the Arch Linux forum and received that warm and friendly greeting. I thought “Okay, I’ll play by the rules. I’ll install an Arch VM to prove the problem.” I’ve been warned about thinking before. Totally forgot just how horrible installing Arch Linux is.
So. I took good notes and will write it all down for you. Even if you never go down this path, with my luck I will have to again and I want it all in one easy to find place.
I will be installing Arch Linux within an Oracle VM running on a Windows 10 host. You will need to tweak these steps for your host.
Note: I have a small 480Gig SSD as the boot drive and a 6TB Western Digital Black installed as drive D. I have quite a few projects rumbling around in my head and will need to use much of the space for a database for one of them. To save SSD space and abuse I create my VMs on drive D.
Change Settings Before First Boot
This host has 28Gig of RAM and I like to give a VM at least 8Gig.
Yes I skimped on the disk giving it only 88Gig. I may do some development here, just not a lot. May create an Arch package for Red Diamond (my fork of Diamond text editor) but I was planning on using Manjaro for that. Still, be nice to know it installs on Arch.
Even with Guest Additions installed, Bidirectional doesn’t work properly with this version of Arch. I turn it on anyway just in case it starts working with an update.
I like to give at least 2 CPU to a “dev” machine. Only 1 CPU for a “test” machine.
The default video memory is just low. I have really good luck with 64MB. Not every OS you install can function properly with the max of 128. I left the default VGA controller in for the installation.
Later we will change that because the “recommended” doesn’t play well. At least it didn’t work well on this host with an NVIDIA video card. You could see everything, you just couldn’t resize the screen.
I always have a directory I call windows-share somewhere. I always add it as a shared folder to every VM. This makes copying things into and out of the VM simple.
Naturally your host will determine how your disk selector looks. Your Arch Linux file name will probably be different as well.
At this point a great many people will be lulled into a false sense of comfort that this distro has the kind of installer they expect. No child. You are about to have a rude awakening.
The refer you to the Installation Guide. Don’t expect something nice like this blog post. We are command line all the way. You are expected to keep huge quantities of Linux specific information in your head. In particular, partitioning a disk and installing a boot loader from the command line is something you are supposed to “just know.”
When you go to the forum and see people complaining about this they will always ask for someone to explain it “in English” and not provide a link. The people who hang out in the forum will respond back that a link is all they get because this distro spends a lot of time on its documentation. They provide links rather than spoon feed noobs.
You will notice the details on “how” are rather sparse. Rather good information about what one might want, not how to get there from here. If your help forum is only there to help experts, then your documentation needs to spoon feed noobs.
Again, Manjaro and most of the other Arch based distros popped up because people got tired of having to go through this shit each and every time. They wanted an actual installer that installed the subset of stuff they actually used so they could have a live rather than living to memorize every package and command line required to set up a new version.
You get a surprising amount of information about formatting partitions you still have no idea how to create.
You get close to nothing for boot loader.
The link really only tells you what is out there. The secondary Grub information tells you how to do some things from the command line. It just skips the things you really need to do.
In the technical writing world we call these “Then a miracle happens” instructions. Instructions must be very specific with as many pictures as possible.
The Manual Install Now Begins
The default keymap is US and I did not modify the layout.
If that file does not exist you booted in BIOS mode. My VM booted BIOS and so should yours. We did not check the UEFI box when configuring our VM.
Thankfully VirtualBox will take care of providing what the VM believes to be a hardwired connection.
ip link ping archlinux.org
You must have a functioning Internet connection to install Arch Linux. Before you go any further you need to fix your system clock. For some reason you have to hit return again when it says “System Time Synchronized.” It’s done. Just doesn’t show you the prompt.
timedatectl set-ntp true
Partitioning the Hard Drive
BIOS was very important. These instructions won’t work for UEFI. I didn’t feel the need to suffer through figuring out how to UEFI boot a VM. It just needs to boot.
All of the Arch instructions show them putting the SWAP space at the beginning. They all use hard numbers. If you gave your VM enough RAM and you don’t do anything intensive like run a ninja build of CopperSpice without using -j1, you won’t really use SWAP.
The one and only hard drive in your VM should be sda unless Arch Linux decides to change the naming convention.
parted /dev/sda mklabel msdos parted /dev/sda mkpart primary ext4 0% 90% mkpart primary linux-swap 90% 100% print set 1 boot on
Notice I didn’t use “hard” numbers. I simply give 90% to what will be root and 10% to SWAP. While it isn’t obvious, the changes for parted are saved on quit.
If you want details, mklabel msdos puts an MBR (DOS) partition table on the disk limiting you to for main partitions. “set 1 boot on” turns on the flag indicating the partition is bootable for partition 1.
Now You Have to Make Those Partitions Usable
mkfs.ext4 /dev/sda1 mkswap /dev/sda2 mount /dev/sda1 /mnt swapon /dev/sda2
The physical mounting of /dev/sda1 at /mnt is critical for the rest of the instructions.
It is important to sit around for a bit now. Go get a glass of iced tea or something. If you don’t you can have odd issues. You need to wait until you see the following:
There is a mirror list refresh going on in the background. It needs to complete so you get the correct software. After you see that message you will need to hit return to get your prompt back.
Installing Arch and Software
Careful readers will notice we haven’t actually installed anything. The ISO file is a stand-alone boot environment providing limited functionality so you could install Arch if you wanted. You could also use it to format a disk or perform some rescue operation.
You begin actual installation with this command.
pacstrap /mnt base linux linux-firmware nano sudo networkmanager
This is what I’m talking about when I speak of having to memorize every package there is for Arch Linux. You install the “base” (whatever that is), linux, and linux-firmware. That won’t get you a booting system. It will get you a system that could boot if it had a boot loader.
Note: When this runs you might see some “failed retrieving” messages as it searches for a mirror that is up.
If you don’t like nano as a terminal editor you can install whatever terminal editor you like if you know the package name. There will not be a desktop and you will need to edit things. You will also need to obtain root privilege which is why we are installing sudo.
At some point the installation of packages will end much like this:
genfstab -U /mnt >> /mnt/etc/fstab
That command creates your /etc/fstab file listing your root and swap partitions. If you had a boot loader and it tried to boot this installation Arch Linux would now know what disk drives and partitions it could use.
Now it is Time to Work Within Your Baby OS
For those who don’t build distribution packages or do other kinky system level things, chroot is the time honored (and cursed) utility for changing the root device. Not everything works within chroot! Don’t get kinky. This is especially true if you are using chroot to create custom Ubuntu ISO files with all updates installed. Not cool things happen when you try that.
We will stay in the center lane. We will rest confident in the fact that no matter how bad something goes with chroot, it cannot write into the ISO file we booted from. (When you chroot from a real running OS and updates/installs write to places they aren’t supposed to, bad things happen.)
Find your country
Now find your city
Create a link to set your localtime. (Isn’t this just obvious?)
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Now you have to fix the time. Remember, you are fixing it on the OS that will boot, not the tiny installation OS you booted.
I have you fix the time so you don’t end up with wacky date/time values on the rest of these files. Some security things can give you hardship if your date is out of whack. When you boot you want the date and time to be correct.
Finish Setting Up Your Locale
Are we having fun yet? I wouldn’t want to miss any of the fun!
Scroll down and uncomment the correct language and local. When done Ctrl-x to exit. Yes to save. Use default file name. You almost always want a UTF-8 version unless you have extremely old hardware
Define your local language
This will be an empty file you add one line to. My line was this.
When done Ctrl-x to exit. Yes to save. Use default file name. Of course use the same name you uncommented in the previous step. Do not be surprised when Caps-Lock lights up on your keyboard and doesn’t work. This is an extremely limited terminal. Some people have luck with using <Shift><Caps Lock> to turn Caps Lock on. I just held the shift key down. There weren’t enough capital letters to make it worth the effort of finding a work around.
Thankfully I did nothing with the keyboard during boot so I could skip figuring out what to put in for KEYMAP when editing /etc/vconsole.conf. If you needed to change the keyboard then you need to figure this step out.
Setup Your Network
Choose a name for your host and enter it. Don’t get real creative as there are network limits and rules. Must be lowercase
This is a one line file. I put “lenovo-arch” in mine because Arch was going to be running on a Lenovo machine. Like I said, don’t get real creative here. It will cause you great pain.
You even have to create your own hosts file! You will appreciate a simple hostname here.
When done Ctrl-x to exit. Yes to save. Use default file name. By default Nano editor will use tabs. When lining things up you need to use TAB not spaces
Now you have to do your own initramfs
Create a root password. Yes, it appears Arch still has a root account though most distros have gotten rid of it.
Keep in mind that running under chroot means you are “root” as far as this partition is concerned.
The most critical of instructions physically aren’t contained in the Installation Guide. You need to update the list of software in this machine, install grub then install its recommendations. In case the display below wraps funny, there are three pacman commands. If you see a line staring with something other than pacman it wrapped.
pacman -Sy pacman -S grub pacman -S freetype2 fuse2 dosfstools efibootmgr mtools os-prober libisoburn
Just installing the grub package and its recommendations doesn’t actually give you a bootable system. You have to physically execute grub-install targeting /dev/sda. This installs the portion of grub needed in the MBR.
I told you BIOS was important. This is why. UEFI is a completely different animal. For those who just want the commands.
grub-install /dev/sda grub-mkconfig -o /boot/grub/grub.cfg
Create a User Account
useradd -m roland passwd roland
Keep in mind you are “root” right now. When you type passwd userName it is setting the password for userName not the root password. This account is “just a user.” You want it to have sudo privs.
visudo is the only thing you can use to edit the sudoers file. You can change the editor it brings up to nano via this command line.
All of those other distros, they give you nice graphic things and assume you want the first account to have sudoer priv so they handle that behind the sceens. You have to do everything yourself in Arch.
All of the Installation Guide and blog post information about network was wrong. It all seems to be ASS-U-ME-ing you installed some package that was obvious to everyone writing the documentation.
For me an OS is a tool. I only want to know as much as I absolutely have to in order to do my job. Sometimes my job means I have to know way too much. Today isn’t one of those times. Here’s what they left out.
systemctl enable NetworkManager.service
Install the Desktop
Here is where I really appreciate Manjaro. Arch bundles all KDE packages, even the sucky ones, into one package. You have to hand pick knowing what works with what if you want to skip the sucky ones. I was not in the mood for more pain.
I don’t know which packages are needed for the packages I wanted so I took the defaults on everything. All I knew is that I liked some of the KDE desktop and that the KDE Network Manager (whatever it is called now) would make networking easier. Just happy-key hitting return until you are asked to type Y to proceed.
pacman -S xorg plasma plasma-wayland-session kde-applications
We need base-devel so Guest Additions can install properly. If you get some message about appcache failure just ignore. Like I told you chroot isn’t for everything.
pacman -Sy base-devel
We need the base-devel packages so Guest Additions will insall properly. Now we need to make certain we login via KDE.
systemctl enable sddm.service
exit umount -R /mnt shutdown now
Get Ready for First Desktop Boot
We need a better display controller. Just ignore the “Invalid settings detected” message. Oracle know not what it talk about.
Now restart your VM and you should be greeted with a login screen.
After logging in you should also find your network is functional. Now Open a terminal (Konsole in KDE) because we still have a ways to go.
Guest Additions won’t install unless you have a development environment. Just take the default of all. Now we need to set a few things up to make your life easier.
mkdir bin mkdir share nano .bashrc
Ubuntu and quite a few other distros have a .profile, .bashrc, or some other dot-file that runs at user login. Usually that file will check for a bin directory in the user’s home directory. If there it will add it to PATH. Arch does very little for you automatically.
I had you create the share directory so you would have some place to mount windows-share. Remember? We added that as a shared directory back in the beginning. When you want to transfer files between host and VM a shared directory is the easiest way. You can just copy between them.
cd bin nano mount-share sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) windows-share $HOME/share
You are adding one line to the file. When done Ctrl-x to exit. Yes to save. Use default file name.
chmod +x mount-share
The above command makes the file we just created executable. After you reboot (or log out then back in) $HOME/bin will be in your path and you can type mount-share from anywhere to mount the shared directory.
My entire reason for enduring this was to prove Manjaro inherited an Arch Linux bug.
sudo pacman -Ss postgres | less sudo pacman -Sy postgresql sudo pacman -Sy libpqxx sudo -u postgres -i initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data/' exit sudo systemctl enable postgresql.service
You are now ready to enable Guest Additions.
For most other distros, that’s all you do. The image has an autorun script and the Linux distro runs it. Prompts you to allow. Opens a terminal window. Stuff scrolls past and it finally tells you the kernel will be replaced on next boot. Arch Linux does almost nothing for you.
With almost every other Linux distro any media mounted via the desktop is placed in /media. Some will place it under /media/user but you can always rely on it being in /media. This ain’t that kind of movie.
cd /run/media/$USER/VB then hit tab key
I’m not a big fan of using the TAB key for command line completion but here is a good place to use it. You should notice that your Caps Lock key has been working since you logged in as well.
Once you are in that directory you need to run under sudo VBoxLinuxAdditions.run
Shutdown and Clone
One thing that always amazes me is the number of people who finally get a VM configured the way they need it that don’t immediately clone it. If you are doing development you are going to trash it at some point. Wouldn’t you like a nice clean fallback position?
Shutdown the VM you are running then right click on its entry in VirtualBox.
Then click the clone button and wait for the clone to complete. Now you can freely use your dev machine knowing you can nuke it and rename and re-clone this one.
You should be making heavy use of the windows-share directory. Keep snapshot copies of your work out there so you don’t lose much/any ground when you trash your VM.