Arch Linux
The purpose of this document is to provide the minimum necessary information to get Arch up and reasonably secure.
The Arch Wiki has a page devoted to installing Arch Linux from within an existing Linux, which effectively describes the underlying steps being performed here. The following steps apply that process to a VM on prgmr.
Contents
Accessing the Management Console
You need to access the Management Console for your VM. If you're not familiar with this, please see Management Console. The following instructions assume that you are NOT using the legacy console.
Boot from rescue image
The install will be performed from a Rescue image. This is equivalent to booting off a Rescue CD or USB stick, except the process is fully remote. We must configure the VM to boot off the Rescue image, which we will use as a starting point for installing Arch into the VM disk. For more information, see accessing your guest from the rescue image. After install has completed, the VM will be switched back to booting directly from its main disk which contains the new Arch installation.
Shut down the machine
Check if the machine is currently running by looking at the Current status
at the top of the Management Console's main menu. If it's currently running, it needs to be shut down. You may use option 4 in the main menu to force it to power off. It's about to be reformatted so a clean shutdown isn't really necessary.
4. force power off (destroy/hard shutdown)
Switch to rescue mode
Now that the machine is shut down, you should configure its bootloader to use the rescue image. For example, from the main menu the options would be something like this:
6. set bootloader or rescue mode
3. Linux-based Live Rescue
2. Linux Live Rescue, 64 bit
After selecting the rescue image you will be prompted about adding SSH keys. This is optional, and is only necessary if you intend to SSH into the rescue image while it's running. This is not required for setting up Arch.
After enabling the rescue image, hit 0 a couple times until you're back at the main menu again.
Start in rescue mode
Now that you have enabled booting into the rescue image, the machine can be started again. Select option 2 from the main menu:
2. create/start, opens OOB console (try this if the machine is not running)
At this point the machine will be booted into the rescue image configured above. If you are presented with a GRUB prompt, you should select the option that looks like Debian GNU/Linux, kernel <version>-amd64 Live Rescue
. If you don't see any GRUB prompt then don't worry about it.
After a minute or two of startup output, you should be presented with a login prompt:
Debian GNU/Linux 8 rescue ttyS0 rescue login:
Log in as root
with no password.
Install Arch
You are now booted into a rescue image. Your VM's hard drive is located at /dev/xvda
while the rescue image itself is located at /dev/xvdz
. Installation of Arch can now proceed against /dev/xvda
.
If you wished to do so, at this point you could install Arch by hand, but for the purposes of this guide, we will use some helper scripts which greatly simplify the initial setup. Feel free to examine and customize the scripts to meet your needs. For example, the scripts default to a single large root partition, while you may instead wish to have a customized partition table.
Download/run install scripts
The scripts are provided in this repo and can be installed as follows (or see the README
within the repo):
WARNING: This is the point of no return. The script will destroy any and all data in your VM. Did you make backups? Did you check that the backups are good?
cd /tmp wget https://github.com/prgmrcom/archinstall-scripts/archive/master.zip unzip master.zip cd archinstall-scripts-master/ ./archinstall.sh
When the script has finished, it should display a message like the following before exiting:
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ finished ******** root ~ #
Follow install guide
The scripts should have taken care of the hardware aspects of configuring an Arch install, however you will still need to set up timezones, user accounts, passwords and so forth. For that you should follow the Arch Installation Guide, specifically starting where it has an arch-chroot
command to switch into the Arch environment. In our case we can just perform a regular chroot
:
chroot /mnt
Continue with the Arch installation guide from that point. Once you have finished the installation (and BEFORE restarting the system), see below for a few final steps.
If you do accidentally restart at the wrong time and find yourself with an unbootable system, you can regain access using the rescue image.
Finalize installation
Once you have installed everything you need (for now), a couple additional steps are needed before you can reboot into the new image.
Enable serial access
In order for your Arch image to be accessible via the Management Console, you must enable serial access via GRUB and the Linux console. Without these changes, it will not be accessible via the Management Console and it will appear to be unresponsive when booting up. These instructions assume that you're using GRUB2 (the default) and not GRUB Legacy.
Edit /etc/default/grub
as follows:
GRUB_TERMINAL_INPUT=serial GRUB_TERMINAL_OUTPUT=serial GRUB_SERIAL_COMMAND="serial --speed 115200 --unit=0 --word=8 --parity=no --stop=1" GRUB_CMDLINE_LINUX_DEFAULT="YOUR_OPTIONS_HERE console=ttyS0,115200n8"
The above settings will do the following:
- The
GRUB_TERMINAL_INPUT
andGRUB_TERMINAL_OUTPUT
lines tell GRUB to output to the Management Console during system startup. These default toconsole
. - The
GRUB_SERIAL_COMMAND
setting configures that serial output from GRUB. It shouldn't be strictly required but it silences a configuration warning about default options. This setting is not present by default. - The added
console=...
parameter to theGRUB_CMDLINE_LINUX_DEFAULT
tells the Linux kernel to enable terminal access via the Management Console. This parameter should be included in addition to any others that you specify, for example"quiet console=ttyS0,115200n8"
.
The above changes will only take effect after you have regenerated your GRUB configuration as follows:
grub-mkconfig -o /boot/grub/grub.cfg
Enable IPv6
The helper scripts do not currently enable IPv6 for you. To do this, first fetch your IPv6 address.
Using the example from the linked page with user cnryhilln, we would append the following lines to /etc/systemd/network/prgmrDhcp.network
below [Network]
Address=2605:2700:0:17::4713:9b0f/64 Gateway=2605:2700:0:17::1
If you've already rebooted into Arch, then systemctl restart systemd-networkd.service && ip link set dev eth0 down && ip link set dev eth0 up
. Otherwise, just continue to follow the instructions below.
Boot from Arch
Once you have finished configuring your new Arch system (including enabling serial access), you can now switch the boot process from the Rescue disk back to Arch.
- After you've installed and configured everything (don't forget to enable serial access!), shut down the system with
shutdown -h now
. If you are in a chrooted environment then you may need to first exit that withCtrl+D
- Exit back to the Management Console with
Ctrl+]
- From the main menu of the Management Console, set the bootloader to boot from disk:
6. set bootloader or rescue mode
1. Boot from disk
- Go back to the main menu of the Management Console by pressing 0, then start the system again. If it's currently running (did you run
shutdown
?) then you can just reboot it first.
2. create/start, opens OOB console (try this if the machine is not running)
At this point you should boot into your new Arch system. If it fails to boot, you don't need to start over again, instead you can just switch back to the rescue image and make any needed repairs:
Recover from unbootable instance
If you forgot to do something when setting up your Arch image, it's possible that it will be left in an unbootable state when you attempt to boot into it. These steps will allow you to access and repair the instance without needing to reinstall from scratch:
- Follow the above instructions to switch the VM's bootloader back to the rescue image, and then log into the rescue image (again).
- From the rescue image, you can mount your Arch disk as follows (assuming that your root partition is at
/dev/xvda1
):
mount /dev/xvda1 /mnt mount --rbind /proc /mnt/proc mount --rbind /sys /mnt/sys mount --rbind /dev /mnt/dev mount --rbind /run /mnt/run chroot /mnt
From here you should be able to make any needed repairs to your Arch image.
Bibliography
Some reference info that you may find useful. In general, the Arch Wiki is an extremely useful resource for getting your new system up and running, even if you aren't necessarily running Arch.
- Setting Up a New User -- Definitely should do this!!
- Networking
- Console Improvements
- Available Applications
- Booting into the rescue image